root/trunk/libnotify/tests/test-basic.c

Revision 2454 (checked in by chipx86, 3 years ago)

Remove notify_notification_show_and_forget(). It's less confusing to have one show function, and require that the user unref. It also simplifies the code quite a bit.

Line 
1 /*
2  * @file tests/test-basic.c Unit test: basics
3  *
4  * @Copyright (C) 2004 Mike Hearn <mike@navi.cx>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library 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 GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA  02111-1307, USA.
20  */
21
22 #include <libnotify/notify.h>
23 #include <stdio.h>
24 #include <unistd.h>
25
26 int main() {
27     NotifyNotification *n;
28
29     notify_init("Basics");
30
31     n = notify_notification_new ("Summary",
32                                      "Content that is very long 8374983278r32j4 rhjjfh dw8f 43jhf 8ds7 ur2389f jdbjkt h8924yf jkdbjkt 892hjfiHER98HEJIF BDSJHF hjdhF JKLH 890YRHEJHFU 89HRJKSHdd dddd ddddd dddd ddddd dddd ddddd dddd dddd ddd ddd dddd Fdd d ddddd dddddddd ddddddddhjkewdkjsjfjk sdhkjf hdkj dadasdadsa adsd asd sd saasd fadskfkhsjf hsdkhfkshfjkhsd kjfhsjdkhfj ksdhfkjshkjfsd sadhfjkhaskd jfhsdajkfhkjs dhfkjsdhfkjs adhjkfhasdkj fhdsakjhfjk asdhkjkfhd akfjshjfsk afhjkasdhf jkhsdaj hf kjsdfahkfh sakjhfksdah kfdashkjf ksdahfj shdjdh",
33                                      NULL, NULL);
34         notify_notification_set_timeout (n, 3000); //3 seconds
35
36     if (!notify_notification_show (n, NULL)) {
37         fprintf(stderr, "failed to send notification\n");
38         return 1;
39     }
40
41     g_object_unref(G_OBJECT(n));
42
43     return 0;
44 }
Note: See TracBrowser for help on using the browser.