My favorites | Sign in
Project Logo
                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include<libnotify/notify.h>

int main(int argc, char **argv)
{
// initialize gtk
gtk_init(&argc,&argv);

char name[40] = "Sample Notification";

// initiate notify
notify_init(name);

// create a new notification
NotifyNotification *example;
example = notify_notification_new(name,"Checking it out",NULL,NULL);

/* Status Icon is not working properly */
// create an icon for the notification
GtkStatusIcon *icon = gtk_status_icon_new_from_stock (GTK_STOCK_YES);
gtk_status_icon_set_visible(icon,TRUE);
// attach that icon to the notification
notify_notification_attach_to_status_icon (example,icon);

// set the timeout of the notification to 3 secs
notify_notification_set_timeout(example,3000);

// set the category so as to tell what kind it is
char category[30] = "Testing Notifications";
notify_notification_set_category(example,category);

// set the urgency level of the notification
notify_notification_set_urgency (example,NOTIFY_URGENCY_CRITICAL);

GError *error = NULL;
notify_notification_show(example,&error);

}
Show details Hide details

Change log

r11 by manishsinha27 on Mar 27, 2009   Diff
Added libnotify example code
Go to: 
Project members, sign in to write a code review

Older revisions

All revisions of this file

File info

Size: 1153 bytes, 37 lines
Hosted by Google Code