Yet another try to get 0.51.2-pre2 in cvs
[wmaker-crm.git] / WINGs / testnot.c
bloba745801cfb1e3dccc6199dae66ceef86f779e017
2 /*
3 * test notifications
4 */
7 #include "WUtil.h"
8 #include <stdio.h>
9 #include <stdlib.h>
12 char *notificationA = "notificationA";
13 char *notificationB = "notificationB";
14 char *notificationC = "notificationC";
16 void
17 observer1(void *data, WMNotification *notification)
19 printf("ObserverAction 1 got %s with object=%s, clientdata=%s\n",
20 WMGetNotificationName(notification),
21 (char*)WMGetNotificationObject(notification),
22 (char*)WMGetNotificationClientData(notification));
25 void
26 observer3(void *data, WMNotification *notification)
28 printf("ObserverAction 3 got %s with object=%s, clientdata=%s\n",
29 WMGetNotificationName(notification),
30 (char*)WMGetNotificationObject(notification),
31 (char*)WMGetNotificationClientData(notification));
34 void
35 observer2(void *data, WMNotification *notification)
37 printf("ObserverAction 2 got %s with object=%s, clientdata=%s\n",
38 WMGetNotificationName(notification),
39 (char*)WMGetNotificationObject(notification),
40 (char*)WMGetNotificationClientData(notification));
48 main(int argc, char **argv)
50 int i;
51 char *obser1 = "obser1";
52 char *obser2 = "obser2";
53 char *obser3 = "obser3";
54 char *obj1 = "obj1";
55 char *obj2 = "obj2";
56 char *obj3 = "obj3";
57 char *cdata1 = "client data1";
58 char *cdata2 = "client data2";
59 char *cdata3 = "client data3";
61 WMInitializeApplication("test", &argc, argv);
63 WMAddNotificationObserver(observer1, obser1, notificationA, obj1);
65 WMAddNotificationObserver(observer1, obser1, notificationA, obj2);
67 WMAddNotificationObserver(observer1, obser1, notificationA, obj3);
69 puts("post1");
70 WMPostNotificationName(notificationA, obj3, cdata1);
71 puts("post2");
72 WMPostNotificationName(notificationA, obj2, cdata2);
73 puts("post3");
74 WMPostNotificationName(notificationA, obj1, cdata3);
76 puts("REMOVE1");
77 WMRemoveNotificationObserverWithName(obser1, notificationA, obj2);
79 puts("REMOVE2");
80 WMRemoveNotificationObserverWithName(obser1, notificationA, obj2);
82 puts("post1");
83 WMPostNotificationName(notificationA, obj3, cdata1);
84 puts("post2");
85 WMPostNotificationName(notificationA, obj2, cdata2);
86 puts("post3");
87 WMPostNotificationName(notificationA, obj1, cdata3);
89 return 0;