Debian Codegraph @

tests/test-size-changes.c

raw
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
2 *
3 * @file tests/test-size-changes.c Unit test: Notification size changes
4 *
5 * @Copyright (C) 2006 Christian Hammond <[email protected]>
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
21 */
22
23 #include <libnotify/notify.h>
24 #include <stdio.h>
25 #include <unistd.h>
26
27 int
28 main ()
29 {
30 NotifyNotification *n1, *n2, *n3;
31
32 notify_init ("Size Changes");
33
34 n1 = notify_notification_new ("Notification 1",
35 "Notification number 1!",
36 NULL);
37 notify_notification_set_timeout (n1, 7000);
38
39 if (!notify_notification_show (n1, NULL)) {
40 fprintf (stderr, "failed to send notification\n");
41 return 1;
42 }
43
44 g_object_unref (G_OBJECT (n1));
45
46 n2 = notify_notification_new ("Notification 2",
47 "Notification number 2!",
48 NULL);
49 notify_notification_set_timeout (n2, 7000);
50
51 if (!notify_notification_show (n2, NULL)) {
52 fprintf (stderr, "failed to send notification\n");
53 return 1;
54 }
55
56
57 n3 = notify_notification_new ("Notification 3",
58 "Notification number 3!",
59 NULL);
60 notify_notification_set_timeout (n3, 7000);
61
62 if (!notify_notification_show (n3, NULL)) {
63 fprintf (stderr, "failed to send notification\n");
64 return 1;
65 }
66
67 g_object_unref (G_OBJECT (n3));
68
69 sleep (2);
70
71 notify_notification_update (n2,
72 "Longer Notification 2",
73 "This is a much longer notification.\n"
74 "Two lines.\n"
75 "Well, okay, three.\n" "Last one.",
76 NULL);
77
78 if (!notify_notification_show (n2, NULL)) {
79 fprintf (stderr, "failed to send notification\n");
80 return 1;
81 }
82
83 return 0;
84 }