~ubuntu-branches/debian/stretch/alarm-clock-applet/stretch

« back to all changes in this revision

Viewing changes to src/tests/test_libnotify.c

  • Committer: Bazaar Package Importer
  • Author(s): Chow Loong Jin
  • Date: 2010-03-17 09:02:44 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20100317090244-ni0ye04mva2hxe10
Tags: 0.3.0-1
* New upstream release
* debian/control:
  + No change bump of Standards-Version to 3.8.4
  + Update build-deps:
    - Drop libglade, libpanel-applet, libgnomevfs2, libgnome{2,ui}
    - Add libxml2-dev and libunique-dev, intltool
* debian/patches/01_update-alarms-eta,patch:
  + Dropped, applied upstream
* debian/(alarm-clock-applet.1, alarm-clock-applet.manpages):
  + Add manpage for alarm-clock-applet, now that the binary is moved to
    /usr/bin.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * test_libnotify.c -- Test libnotify
 
3
 * 
 
4
 * Copyright (C) 2010 Johannes H. Jensen <joh@pseudoberries.com>
 
5
 * 
 
6
 * This program is free software; you can redistribute it and/or
 
7
 * modify it under the terms of the GNU General Public License
 
8
 * as published by the Free Software Foundation; either version 2
 
9
 * of the License, or (at your option) any later version.
 
10
 *
 
11
 * This program is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 * GNU General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU General Public License
 
17
 * along with this program; if not, write to the Free Software
 
18
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
19
 * 
 
20
 * Authors:
 
21
 *              Johannes H. Jensen <joh@pseudoberries.com>
 
22
 */
 
23
 
 
24
#include <libnotify/notify.h>
 
25
#include <stdio.h>
 
26
 
 
27
#include <glib.h>
 
28
#include <gtk/gtk.h>
 
29
/*
 
30
#include <dbus/dbus.h>
 
31
#include <dbus/dbus-glib.h>
 
32
#include <dbus/dbus-glib-lowlevel.h>*/
 
33
 
 
34
GMainLoop *loop;
 
35
NotifyNotification *n;
 
36
 
 
37
gboolean
 
38
close_notify (gpointer data)
 
39
{
 
40
    g_debug("CLOSE NOTIFY: %d", notify_notification_close (n, NULL));
 
41
 
 
42
    return FALSE;
 
43
}
 
44
 
 
45
int
 
46
main(int argc, char *argv[])
 
47
{
 
48
        gtk_init(&argc, &argv);
 
49
    
 
50
        if (!notify_init("Alarm Clock"))
 
51
                return 1;
 
52
 
 
53
    GtkStatusIcon *si = gtk_status_icon_new_from_icon_name ("alarm-clock");
 
54
 
 
55
        /* Stock icon */
 
56
        n = notify_notification_new_with_status_icon("Alarm & <b>Test</b>",
 
57
                                                 "Click the alarm icon to snooze",
 
58
                                                 "alarm-timer", si);
 
59
 
 
60
        if (!notify_notification_show(n, NULL))
 
61
        {
 
62
                fprintf(stderr, "failed to send notification\n");
 
63
                return 1;
 
64
        }
 
65
 
 
66
    g_timeout_add_seconds (1, close_notify, NULL);
 
67
 
 
68
    gtk_main ();
 
69
    
 
70
        return 0;
 
71
}