1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
3
* This library is free software; you can redistribute it and/or
4
* modify it under the terms of the GNU Lesser General Public
5
* License as published by the Free Software Foundation; either
6
* version 2.1 of the License, or(at your option) any later version.
8
* This library is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
* Lesser General Public License for more details.
13
* You should have received a copy of the GNU Lesser General Public
14
* License along with this library; if not, write to the
15
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16
* Boston, MA 02111-1307, USA.
20
#include <libnotify/notify.h>
24
next_callback (NotifyNotification *n,
27
g_assert (action != NULL);
29
printf ("You clicked Next\n");
31
notify_notification_close (n, NULL);
37
main (int argc, char *argv[])
39
NotifyNotification *n;
41
gtk_init (&argc, &argv);
43
notify_init ("Urgency");
45
n = notify_notification_new ("Low Urgency",
48
notify_notification_set_urgency (n, NOTIFY_URGENCY_LOW);
49
if (!notify_notification_show (n, NULL)) {
50
fprintf (stderr, "failed to send notification\n");
56
if (!notify_notification_close (n, NULL)) {
57
fprintf (stderr, "failed to remove notification\n");
61
g_object_unref (G_OBJECT (n));
64
n = notify_notification_new ("Normal Urgency",
65
"You have a meeting in 10 minutes.",
67
notify_notification_set_urgency (n, NOTIFY_URGENCY_NORMAL);
68
if (!notify_notification_show (n, NULL)) {
69
fprintf (stderr, "failed to send notification\n");
75
if (!notify_notification_close (n, NULL)) {
76
fprintf (stderr, "failed to remove notification\n");
80
g_object_unref (G_OBJECT (n));
83
n = notify_notification_new ("Critical Urgency",
84
"This message will self-destruct in 10 seconds.",
86
notify_notification_set_urgency (n, NOTIFY_URGENCY_CRITICAL);
87
notify_notification_set_timeout (n, NOTIFY_EXPIRES_NEVER);
88
notify_notification_add_action (n,
91
(NotifyActionCallback) next_callback,
95
if (!notify_notification_show (n, NULL)) {
96
fprintf (stderr, "failed to send notification\n");
102
if (!notify_notification_close (n, NULL)) {
103
fprintf (stderr, "failed to remove notification\n");
109
g_object_unref (G_OBJECT (n));