Merge lp:~indicator-applet-developers/libindicate/ubuntu into lp:~ubuntu-desktop/libindicate/ubuntu
- ubuntu
- Merge into ubuntu
Proposed by
Ted Gould
Status: | Merged | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Merge reported by: | Ken VanDine | ||||||||||||||||
Merged at revision: | not available | ||||||||||||||||
Proposed branch: | lp:~indicator-applet-developers/libindicate/ubuntu | ||||||||||||||||
Merge into: | lp:~ubuntu-desktop/libindicate/ubuntu | ||||||||||||||||
Diff against target: | None lines | ||||||||||||||||
To merge this branch: | bzr merge lp:~indicator-applet-developers/libindicate/ubuntu | ||||||||||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ken VanDine | Approve | ||
Review via email: mp+11529@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Ken VanDine (ken-vandine) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file '.bzrignore' | |||
2 | --- .bzrignore 2009-08-07 15:06:32 +0000 | |||
3 | +++ .bzrignore 2009-09-03 21:57:34 +0000 | |||
4 | @@ -103,3 +103,47 @@ | |||
5 | 103 | data/GNOME_IndicatorAppletSUS.server | 103 | data/GNOME_IndicatorAppletSUS.server |
6 | 104 | data/GNOME_IndicatorAppletSUS.server.in | 104 | data/GNOME_IndicatorAppletSUS.server.in |
7 | 105 | src-sus/indicator-applet-no-sus | 105 | src-sus/indicator-applet-no-sus |
8 | 106 | docs/reference/libindicate-decl-list.txt.bak | ||
9 | 107 | docs/reference/libindicate-decl.txt.bak | ||
10 | 108 | INSTALL | ||
11 | 109 | Makefile | ||
12 | 110 | Makefile.in | ||
13 | 111 | aclocal.m4 | ||
14 | 112 | autom4te.cache | ||
15 | 113 | config.guess | ||
16 | 114 | config.h | ||
17 | 115 | config.h.in | ||
18 | 116 | config.log | ||
19 | 117 | config.status | ||
20 | 118 | config.sub | ||
21 | 119 | configure | ||
22 | 120 | depcomp | ||
23 | 121 | gnome-doc-utils.make | ||
24 | 122 | install-sh | ||
25 | 123 | libtool | ||
26 | 124 | ltmain.sh | ||
27 | 125 | missing | ||
28 | 126 | omf.make | ||
29 | 127 | stamp-h1 | ||
30 | 128 | xmldocs.make | ||
31 | 129 | docs/Makefile | ||
32 | 130 | docs/Makefile.in | ||
33 | 131 | docs/reference/Makefile | ||
34 | 132 | docs/reference/Makefile.in | ||
35 | 133 | examples/Makefile | ||
36 | 134 | examples/Makefile.in | ||
37 | 135 | libindicate/Makefile | ||
38 | 136 | libindicate/Makefile.in | ||
39 | 137 | libindicate/indicate-0.2.pc | ||
40 | 138 | libindicate-gtk/Makefile | ||
41 | 139 | libindicate-gtk/Makefile.in | ||
42 | 140 | libindicate-gtk/indicate-gtk-0.2.pc | ||
43 | 141 | tests/Makefile | ||
44 | 142 | tests/Makefile.in | ||
45 | 143 | tests/test-max-indicators-client | ||
46 | 144 | tests/test-max-indicators-server | ||
47 | 145 | tests/test-max-indicators-server-repeat | ||
48 | 146 | tests/test-indicator-display-client | ||
49 | 147 | tests/test-indicator-display-server | ||
50 | 148 | tests/test-indicator-display-half-server | ||
51 | 149 | tests/test-indicator-display-half-client | ||
52 | 106 | 150 | ||
53 | === modified file 'configure.ac' | |||
54 | --- configure.ac 2009-08-18 18:10:11 +0000 | |||
55 | +++ configure.ac 2009-09-03 22:33:32 +0000 | |||
56 | @@ -1,10 +1,10 @@ | |||
57 | 1 | 1 | ||
59 | 2 | AC_INIT(libindicate, 0.2.0dev, ted@canonical.com) | 2 | AC_INIT(libindicate, 0.2.0, ted@canonical.com) |
60 | 3 | 3 | ||
61 | 4 | AC_PREREQ(2.53) | 4 | AC_PREREQ(2.53) |
62 | 5 | 5 | ||
63 | 6 | AM_CONFIG_HEADER(config.h) | 6 | AM_CONFIG_HEADER(config.h) |
65 | 7 | AM_INIT_AUTOMAKE(libindicate, 0.2.0dev) | 7 | AM_INIT_AUTOMAKE(libindicate, 0.2.0) |
66 | 8 | 8 | ||
67 | 9 | AM_MAINTAINER_MODE | 9 | AM_MAINTAINER_MODE |
68 | 10 | m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES]) | 10 | m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES]) |
69 | @@ -18,11 +18,13 @@ | |||
70 | 18 | AC_SUBST(VERSION) | 18 | AC_SUBST(VERSION) |
71 | 19 | AC_CONFIG_MACRO_DIR([m4]) | 19 | AC_CONFIG_MACRO_DIR([m4]) |
72 | 20 | 20 | ||
73 | 21 | m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) | ||
74 | 22 | |||
75 | 21 | ########################### | 23 | ########################### |
76 | 22 | # Libindicate versioning | 24 | # Libindicate versioning |
77 | 23 | ########################### | 25 | ########################### |
78 | 24 | 26 | ||
80 | 25 | LIBINDICATE_CURRENT=2 | 27 | LIBINDICATE_CURRENT=3 |
81 | 26 | LIBINDICATE_REVISION=0 | 28 | LIBINDICATE_REVISION=0 |
82 | 27 | LIBINDICATE_AGE=0 | 29 | LIBINDICATE_AGE=0 |
83 | 28 | 30 | ||
84 | @@ -34,7 +36,7 @@ | |||
85 | 34 | # Libindicate versioning | 36 | # Libindicate versioning |
86 | 35 | ########################### | 37 | ########################### |
87 | 36 | 38 | ||
89 | 37 | LIBINDICATEGTK_CURRENT=0 | 39 | LIBINDICATEGTK_CURRENT=1 |
90 | 38 | LIBINDICATEGTK_REVISION=0 | 40 | LIBINDICATEGTK_REVISION=0 |
91 | 39 | LIBINDICATEGTK_AGE=0 | 41 | LIBINDICATEGTK_AGE=0 |
92 | 40 | 42 | ||
93 | 41 | 43 | ||
94 | === modified file 'debian/changelog' | |||
95 | --- debian/changelog 2009-08-25 06:30:03 +0000 | |||
96 | +++ debian/changelog 2009-09-09 13:42:06 +0000 | |||
97 | @@ -1,3 +1,47 @@ | |||
98 | 1 | libindicate (0.2.0-0ubuntu1~ppa6) karmic; urgency=low | ||
99 | 2 | |||
100 | 3 | * Merge from the extra funcs branch | ||
101 | 4 | * Big change is renaming some signal names. :( | ||
102 | 5 | * Bug fixes in getting properties. | ||
103 | 6 | * Removing looking at the type on indicator lists. | ||
104 | 7 | * Fixing the count callback. | ||
105 | 8 | |||
106 | 9 | -- Ted Gould <ted@ubuntu.com> Wed, 09 Sep 2009 08:42:01 -0500 | ||
107 | 10 | |||
108 | 11 | libindicate (0.2.0-0ubuntu1~ppa5) karmic; urgency=low | ||
109 | 12 | |||
110 | 13 | * Merging with ~ubuntu-desktop | ||
111 | 14 | |||
112 | 15 | -- Ted Gould <ted@ubuntu.com> Fri, 04 Sep 2009 14:08:34 -0500 | ||
113 | 16 | |||
114 | 17 | libindicate (0.2.0-0ubuntu1~ppa4) karmic; urgency=low | ||
115 | 18 | |||
116 | 19 | * Merging things onto a trunk branch. | ||
117 | 20 | |||
118 | 21 | -- Ted Gould <ted@ubuntu.com> Fri, 04 Sep 2009 14:04:30 -0500 | ||
119 | 22 | |||
120 | 23 | libindicate (0.2.0-0ubuntu1~ppa3) karmic; urgency=low | ||
121 | 24 | |||
122 | 25 | * Adding back indicator-messages.h for some defines. | ||
123 | 26 | |||
124 | 27 | -- Ted Gould <ted@ubuntu.com> Fri, 04 Sep 2009 12:47:52 -0500 | ||
125 | 28 | |||
126 | 29 | libindicate (0.2.0-0ubuntu1~ppa2) karmic; urgency=low | ||
127 | 30 | |||
128 | 31 | * 64-bit build fixes. | ||
129 | 32 | |||
130 | 33 | -- Ted Gould <ted@ubuntu.com> Thu, 03 Sep 2009 22:01:57 -0500 | ||
131 | 34 | |||
132 | 35 | libindicate (0.2.0-0ubuntu1~ppa1) karmic; urgency=low | ||
133 | 36 | |||
134 | 37 | * Upstream merge | ||
135 | 38 | * debian/control: Increasing library versions to libindicate3 | ||
136 | 39 | and libindicate-gtk1. Moving .install files as well. | ||
137 | 40 | * libindicate-dev and libindicate-gtk-dev.install change to | ||
138 | 41 | /usr/include/libindicate-0.2 from 0.1 | ||
139 | 42 | |||
140 | 43 | -- Ted Gould <ted@ubuntu.com> Thu, 03 Sep 2009 17:34:56 -0500 | ||
141 | 44 | |||
142 | 1 | libindicate (0.2.0~bzr325-0ubuntu1) karmic; urgency=low | 45 | libindicate (0.2.0~bzr325-0ubuntu1) karmic; urgency=low |
143 | 2 | 46 | ||
144 | 3 | [ Ken VanDine ] | 47 | [ Ken VanDine ] |
145 | @@ -8,10 +52,5 @@ | |||
146 | 8 | * Setting the icon path in the .pc file. | 52 | * Setting the icon path in the .pc file. |
147 | 9 | * debian/control: | 53 | * debian/control: |
148 | 10 | - Set both Vcs-Bzr and Vcs-Bzr-Browser | 54 | - Set both Vcs-Bzr and Vcs-Bzr-Browser |
156 | 11 | - Changed branch to ~ubuntu-desktop | 55 | |
157 | 12 | 56 | -- Ted Gould <ted@ubuntu.com> Thu, 03 Sep 2009 17:16:51 -0500 | |
151 | 13 | [ Martin Pitt ] | ||
152 | 14 | * Flush changelog, the packaging changed pretty much completely. | ||
153 | 15 | * Fix Vcs-* links. | ||
154 | 16 | |||
155 | 17 | -- Ken VanDine <ken.vandine@canonical.com> Tue, 25 Aug 2009 08:29:59 +0200 | ||
158 | 18 | 57 | ||
159 | === modified file 'debian/control' | |||
160 | --- debian/control 2009-08-25 06:23:53 +0000 | |||
161 | +++ debian/control 2009-09-04 19:08:30 +0000 | |||
162 | @@ -16,7 +16,7 @@ | |||
163 | 16 | Vcs-Bzr: https://code.launchpad.net/~ubuntu-desktop/libindicate/ubuntu | 16 | Vcs-Bzr: https://code.launchpad.net/~ubuntu-desktop/libindicate/ubuntu |
164 | 17 | Vcs-Browser: http://bazaar.launchpad.net/~ubuntu-desktop/libindicate/ubuntu | 17 | Vcs-Browser: http://bazaar.launchpad.net/~ubuntu-desktop/libindicate/ubuntu |
165 | 18 | 18 | ||
167 | 19 | Package: libindicate2 | 19 | Package: libindicate3 |
168 | 20 | Section: libs | 20 | Section: libs |
169 | 21 | Conflicts: libindicate | 21 | Conflicts: libindicate |
170 | 22 | Replaces: libindicate | 22 | Replaces: libindicate |
171 | @@ -34,7 +34,7 @@ | |||
172 | 34 | Architecture: any | 34 | Architecture: any |
173 | 35 | Depends: ${shlibs:Depends}, | 35 | Depends: ${shlibs:Depends}, |
174 | 36 | ${misc:Depends}, | 36 | ${misc:Depends}, |
176 | 37 | libindicate2 (= ${binary:Version}), | 37 | libindicate3 (= ${binary:Version}), |
177 | 38 | libdbus-glib-1-dev (>= 0.76) | 38 | libdbus-glib-1-dev (>= 0.76) |
178 | 39 | Description: GNOME panel indicator applet - shared library | 39 | Description: GNOME panel indicator applet - shared library |
179 | 40 | indicator-applet is an applet to display information from | 40 | indicator-applet is an applet to display information from |
180 | @@ -42,7 +42,7 @@ | |||
181 | 42 | . | 42 | . |
182 | 43 | This package contains files that are needed to build applications. | 43 | This package contains files that are needed to build applications. |
183 | 44 | 44 | ||
185 | 45 | Package: libindicate-gtk0 | 45 | Package: libindicate-gtk1 |
186 | 46 | Section: libs | 46 | Section: libs |
187 | 47 | Architecture: any | 47 | Architecture: any |
188 | 48 | Depends: ${shlibs:Depends}, | 48 | Depends: ${shlibs:Depends}, |
189 | @@ -58,7 +58,7 @@ | |||
190 | 58 | Architecture: any | 58 | Architecture: any |
191 | 59 | Depends: ${shlibs:Depends}, | 59 | Depends: ${shlibs:Depends}, |
192 | 60 | ${misc:Depends}, | 60 | ${misc:Depends}, |
194 | 61 | libindicate-gtk0 (= ${binary:Version}), | 61 | libindicate-gtk1 (= ${binary:Version}), |
195 | 62 | libindicate-dev (= ${binary:Version}), | 62 | libindicate-dev (= ${binary:Version}), |
196 | 63 | libdbus-glib-1-dev (>= 0.76), | 63 | libdbus-glib-1-dev (>= 0.76), |
197 | 64 | libgtk2.0-dev (>= 2.12.0) | 64 | libgtk2.0-dev (>= 2.12.0) |
198 | @@ -73,8 +73,8 @@ | |||
199 | 73 | Architecture: any | 73 | Architecture: any |
200 | 74 | Depends: ${shlibs:Depends}, | 74 | Depends: ${shlibs:Depends}, |
201 | 75 | ${misc:Depends}, | 75 | ${misc:Depends}, |
204 | 76 | libindicate2 (= ${binary:Version}), | 76 | libindicate3 (= ${binary:Version}), |
205 | 77 | libindicate-gtk0 (= ${binary:Version}), | 77 | libindicate-gtk1 (= ${binary:Version}), |
206 | 78 | libdbus-glib-1-dev (>= 0.76), | 78 | libdbus-glib-1-dev (>= 0.76), |
207 | 79 | libgtk2.0-dev (>= 2.12.0) | 79 | libgtk2.0-dev (>= 2.12.0) |
208 | 80 | Description: GNOME panel indicator applet - shared library | 80 | Description: GNOME panel indicator applet - shared library |
209 | 81 | 81 | ||
210 | === modified file 'debian/libindicate-dev.install' | |||
211 | --- debian/libindicate-dev.install 2009-08-03 23:32:09 +0000 | |||
212 | +++ debian/libindicate-dev.install 2009-09-03 22:27:49 +0000 | |||
213 | @@ -1,4 +1,4 @@ | |||
215 | 1 | debian/tmp/usr/include/libindicate-0.1/libindicate/* | 1 | debian/tmp/usr/include/libindicate-0.2/libindicate/* |
216 | 2 | debian/tmp/usr/lib/pkgconfig/indicate.pc | 2 | debian/tmp/usr/lib/pkgconfig/indicate.pc |
217 | 3 | debian/tmp/usr/lib/libindicate.a | 3 | debian/tmp/usr/lib/libindicate.a |
218 | 4 | debian/tmp/usr/lib/libindicate.so | 4 | debian/tmp/usr/lib/libindicate.so |
219 | 5 | 5 | ||
220 | === modified file 'debian/libindicate-gtk-dev.install' | |||
221 | --- debian/libindicate-gtk-dev.install 2009-08-03 23:32:09 +0000 | |||
222 | +++ debian/libindicate-gtk-dev.install 2009-09-03 22:27:49 +0000 | |||
223 | @@ -1,4 +1,4 @@ | |||
225 | 1 | debian/tmp/usr/include/libindicate-0.1/libindicate-gtk/* | 1 | debian/tmp/usr/include/libindicate-0.2/libindicate-gtk/* |
226 | 2 | debian/tmp/usr/lib/pkgconfig/indicate-gtk.pc | 2 | debian/tmp/usr/lib/pkgconfig/indicate-gtk.pc |
227 | 3 | debian/tmp/usr/lib/libindicate-gtk.a | 3 | debian/tmp/usr/lib/libindicate-gtk.a |
228 | 4 | debian/tmp/usr/lib/libindicate-gtk.so | 4 | debian/tmp/usr/lib/libindicate-gtk.so |
229 | 5 | 5 | ||
230 | === renamed file 'debian/libindicate-gtk0.install' => 'debian/libindicate-gtk1.install' | |||
231 | === renamed file 'debian/libindicate2.install' => 'debian/libindicate3.install' | |||
232 | === modified file 'docs/reference/libindicate-sections.txt' | |||
233 | --- docs/reference/libindicate-sections.txt 2009-05-01 03:30:04 +0000 | |||
234 | +++ docs/reference/libindicate-sections.txt 2009-08-31 20:06:58 +0000 | |||
235 | @@ -6,38 +6,24 @@ | |||
236 | 6 | IndicateIndicator | 6 | IndicateIndicator |
237 | 7 | IndicateIndicatorClass | 7 | IndicateIndicatorClass |
238 | 8 | indicate_indicator_get_id | 8 | indicate_indicator_get_id |
239 | 9 | indicate_indicator_get_indicator_type | ||
240 | 10 | indicate_indicator_get_property | 9 | indicate_indicator_get_property |
241 | 11 | indicate_indicator_hide | 10 | indicate_indicator_hide |
242 | 12 | indicate_indicator_is_visible | 11 | indicate_indicator_is_visible |
243 | 13 | indicate_indicator_list_properties | 12 | indicate_indicator_list_properties |
244 | 14 | indicate_indicator_new | 13 | indicate_indicator_new |
245 | 15 | indicate_indicator_set_property | 14 | indicate_indicator_set_property |
246 | 16 | indicate_indicator_set_property_icon | ||
247 | 17 | indicate_indicator_set_property_time | 15 | indicate_indicator_set_property_time |
248 | 18 | indicate_indicator_show | 16 | indicate_indicator_show |
249 | 19 | indicate_indicator_user_display | 17 | indicate_indicator_user_display |
250 | 20 | </SECTION> | 18 | </SECTION> |
251 | 21 | 19 | ||
252 | 22 | <SECTION> | 20 | <SECTION> |
253 | 23 | <FILE>indicator-message</FILE> | ||
254 | 24 | <TITLE>IndicateIndicatorMessage</TITLE> | ||
255 | 25 | IndicateIndicatorMessage | ||
256 | 26 | IndicateIndicatorMessageClass | ||
257 | 27 | indicate_indicator_message_new | ||
258 | 28 | </SECTION> | ||
259 | 29 | |||
260 | 30 | <SECTION> | ||
261 | 31 | <FILE>server</FILE> | 21 | <FILE>server</FILE> |
262 | 32 | <TITLE>IndicateServer</TITLE> | 22 | <TITLE>IndicateServer</TITLE> |
263 | 33 | IndicateServer | 23 | IndicateServer |
264 | 34 | IndicateServerClass | 24 | IndicateServerClass |
265 | 35 | indicate_server_add_indicator | 25 | indicate_server_add_indicator |
266 | 36 | indicate_server_check_interest | 26 | indicate_server_check_interest |
267 | 37 | indicate_server_emit_indicator_added | ||
268 | 38 | indicate_server_emit_indicator_modified | ||
269 | 39 | indicate_server_emit_indicator_removed | ||
270 | 40 | indicate_server_emit_server_display | ||
271 | 41 | indicate_server_get_next_id | 27 | indicate_server_get_next_id |
272 | 42 | indicate_server_hide | 28 | indicate_server_hide |
273 | 43 | indicate_server_ref_default | 29 | indicate_server_ref_default |
274 | 44 | 30 | ||
275 | === modified file 'docs/reference/libindicate.types' | |||
276 | --- docs/reference/libindicate.types 2009-02-03 13:56:35 +0000 | |||
277 | +++ docs/reference/libindicate.types 2009-08-28 20:58:09 +0000 | |||
278 | @@ -1,9 +1,7 @@ | |||
279 | 1 | #include <libindicate/indicator.h> | 1 | #include <libindicate/indicator.h> |
280 | 2 | #include <libindicate/indicator-message.h> | ||
281 | 3 | #include <libindicate/server.h> | 2 | #include <libindicate/server.h> |
282 | 4 | #include <libindicate/listener.h> | 3 | #include <libindicate/listener.h> |
283 | 5 | 4 | ||
284 | 6 | indicate_indicator_get_type | 5 | indicate_indicator_get_type |
285 | 7 | indicate_indicator_message_get_type | ||
286 | 8 | indicate_server_get_type | 6 | indicate_server_get_type |
287 | 9 | indicate_listener_get_type | 7 | indicate_listener_get_type |
288 | 10 | 8 | ||
289 | === modified file 'docs/reference/tmpl/libindicate-unused.sgml' | |||
290 | --- docs/reference/tmpl/libindicate-unused.sgml 2009-08-04 11:30:59 +0000 | |||
291 | +++ docs/reference/tmpl/libindicate-unused.sgml 2009-09-08 22:03:55 +0000 | |||
292 | @@ -1,377 +1,73 @@ | |||
437 | 1 | <!-- ##### MACRO INDICATE_INDICATOR ##### --> | 1 | <!-- ##### SECTION ./tmpl/indicator-message.sgml:Long_Description ##### --> |
438 | 2 | <para> | 2 | <para> |
439 | 3 | 3 | ||
440 | 4 | </para> | 4 | </para> |
441 | 5 | 5 | ||
442 | 6 | @object: | 6 | |
443 | 7 | 7 | <!-- ##### SECTION ./tmpl/indicator-message.sgml:See_Also ##### --> | |
444 | 8 | <!-- ##### MACRO INDICATE_INDICATOR_CLASS ##### --> | 8 | <para> |
445 | 9 | <para> | 9 | |
446 | 10 | 10 | </para> | |
447 | 11 | </para> | 11 | |
448 | 12 | 12 | ||
449 | 13 | @klass: | 13 | <!-- ##### SECTION ./tmpl/indicator-message.sgml:Short_Description ##### --> |
450 | 14 | 14 | ||
451 | 15 | <!-- ##### MACRO INDICATE_INDICATOR_GET_CLASS ##### --> | 15 | |
452 | 16 | <para> | 16 | |
453 | 17 | 17 | <!-- ##### SECTION ./tmpl/indicator-message.sgml:Stability_Level ##### --> | |
454 | 18 | </para> | 18 | |
455 | 19 | 19 | ||
456 | 20 | @object: | 20 | |
457 | 21 | 21 | <!-- ##### SECTION ./tmpl/indicator-message.sgml:Title ##### --> | |
458 | 22 | <!-- ##### MACRO INDICATE_INDICATOR_MESSAGE ##### --> | 22 | IndicateIndicatorMessage |
459 | 23 | <para> | 23 | |
460 | 24 | 24 | ||
461 | 25 | </para> | 25 | <!-- ##### STRUCT IndicateIndicatorMessage ##### --> |
462 | 26 | 26 | <para> | |
463 | 27 | @obj: | 27 | |
464 | 28 | 28 | </para> | |
465 | 29 | <!-- ##### MACRO INDICATE_INDICATOR_MESSAGE_CLASS ##### --> | 29 | |
466 | 30 | <para> | 30 | |
467 | 31 | 31 | <!-- ##### STRUCT IndicateIndicatorMessageClass ##### --> | |
468 | 32 | </para> | 32 | <para> |
469 | 33 | 33 | ||
470 | 34 | @klass: | 34 | </para> |
471 | 35 | 35 | ||
472 | 36 | <!-- ##### MACRO INDICATE_INDICATOR_MESSAGE_GET_CLASS ##### --> | 36 | @parent_class: |
473 | 37 | <para> | 37 | |
474 | 38 | 38 | <!-- ##### SIGNAL IndicateServer::indicator-added ##### --> | |
475 | 39 | </para> | 39 | <para> |
476 | 40 | 40 | ||
477 | 41 | @obj: | 41 | </para> |
478 | 42 | 42 | ||
479 | 43 | <!-- ##### MACRO INDICATE_INDICATOR_SIGNAL_DISPLAY ##### --> | 43 | @indicateserver: the object which received the signal. |
480 | 44 | <para> | 44 | @arg1: |
481 | 45 | 45 | ||
482 | 46 | </para> | 46 | <!-- ##### SIGNAL IndicateServer::indicator-not-shown ##### --> |
483 | 47 | 47 | <para> | |
484 | 48 | 48 | ||
485 | 49 | <!-- ##### MACRO INDICATE_INDICATOR_SIGNAL_HIDE ##### --> | 49 | </para> |
486 | 50 | <para> | 50 | |
487 | 51 | 51 | @indicateserver: the object which received the signal. | |
488 | 52 | </para> | 52 | @arg1: |
489 | 53 | 53 | ||
490 | 54 | 54 | <!-- ##### SIGNAL IndicateServer::indicator-removed ##### --> | |
491 | 55 | <!-- ##### MACRO INDICATE_INDICATOR_SIGNAL_MODIFIED ##### --> | 55 | <para> |
492 | 56 | <para> | 56 | |
493 | 57 | 57 | </para> | |
494 | 58 | </para> | 58 | |
495 | 59 | 59 | @indicateserver: the object which received the signal. | |
496 | 60 | 60 | @arg1: | |
497 | 61 | <!-- ##### MACRO INDICATE_INDICATOR_SIGNAL_SHOW ##### --> | 61 | |
498 | 62 | <para> | 62 | <!-- ##### FUNCTION indicate_indicator_get_indicator_type ##### --> |
355 | 63 | |||
356 | 64 | </para> | ||
357 | 65 | |||
358 | 66 | |||
359 | 67 | <!-- ##### MACRO INDICATE_IS_INDICATOR ##### --> | ||
360 | 68 | <para> | ||
361 | 69 | |||
362 | 70 | </para> | ||
363 | 71 | |||
364 | 72 | @object: | ||
365 | 73 | |||
366 | 74 | <!-- ##### MACRO INDICATE_IS_INDICATOR_CLASS ##### --> | ||
367 | 75 | <para> | ||
368 | 76 | |||
369 | 77 | </para> | ||
370 | 78 | |||
371 | 79 | @klass: | ||
372 | 80 | |||
373 | 81 | <!-- ##### MACRO INDICATE_IS_INDICATOR_MESSAGE ##### --> | ||
374 | 82 | <para> | ||
375 | 83 | |||
376 | 84 | </para> | ||
377 | 85 | |||
378 | 86 | @obj: | ||
379 | 87 | |||
380 | 88 | <!-- ##### MACRO INDICATE_IS_INDICATOR_MESSAGE_CLASS ##### --> | ||
381 | 89 | <para> | ||
382 | 90 | |||
383 | 91 | </para> | ||
384 | 92 | |||
385 | 93 | @klass: | ||
386 | 94 | |||
387 | 95 | <!-- ##### MACRO INDICATE_IS_LISTENER ##### --> | ||
388 | 96 | <para> | ||
389 | 97 | |||
390 | 98 | </para> | ||
391 | 99 | |||
392 | 100 | @object: | ||
393 | 101 | |||
394 | 102 | <!-- ##### MACRO INDICATE_IS_LISTENER_CLASS ##### --> | ||
395 | 103 | <para> | ||
396 | 104 | |||
397 | 105 | </para> | ||
398 | 106 | |||
399 | 107 | @klass: | ||
400 | 108 | |||
401 | 109 | <!-- ##### MACRO INDICATE_IS_SERVER ##### --> | ||
402 | 110 | <para> | ||
403 | 111 | |||
404 | 112 | </para> | ||
405 | 113 | |||
406 | 114 | @object: | ||
407 | 115 | |||
408 | 116 | <!-- ##### MACRO INDICATE_IS_SERVER_CLASS ##### --> | ||
409 | 117 | <para> | ||
410 | 118 | |||
411 | 119 | </para> | ||
412 | 120 | |||
413 | 121 | @klass: | ||
414 | 122 | |||
415 | 123 | <!-- ##### MACRO INDICATE_LISTENER ##### --> | ||
416 | 124 | <para> | ||
417 | 125 | |||
418 | 126 | </para> | ||
419 | 127 | |||
420 | 128 | @object: | ||
421 | 129 | |||
422 | 130 | <!-- ##### MACRO INDICATE_LISTENER_CLASS ##### --> | ||
423 | 131 | <para> | ||
424 | 132 | |||
425 | 133 | </para> | ||
426 | 134 | |||
427 | 135 | @klass: | ||
428 | 136 | |||
429 | 137 | <!-- ##### MACRO INDICATE_LISTENER_GET_CLASS ##### --> | ||
430 | 138 | <para> | ||
431 | 139 | |||
432 | 140 | </para> | ||
433 | 141 | |||
434 | 142 | @object: | ||
435 | 143 | |||
436 | 144 | <!-- ##### MACRO INDICATE_LISTENER_INDICATOR_ID ##### --> | ||
499 | 145 | <para> | 63 | <para> |
500 | 146 | 64 | ||
501 | 147 | </para> | 65 | </para> |
502 | 148 | 66 | ||
503 | 149 | @indicator: | 67 | @indicator: |
729 | 150 | 68 | @Returns: | |
730 | 151 | <!-- ##### MACRO INDICATE_LISTENER_SERVER_DBUS_NAME ##### --> | 69 | |
731 | 152 | <para> | 70 | <!-- ##### FUNCTION indicate_indicator_message_new ##### --> |
507 | 153 | |||
508 | 154 | </para> | ||
509 | 155 | |||
510 | 156 | @server: | ||
511 | 157 | |||
512 | 158 | <!-- ##### MACRO INDICATE_LISTENER_SIGNAL_INDICATOR_ADDED ##### --> | ||
513 | 159 | <para> | ||
514 | 160 | |||
515 | 161 | </para> | ||
516 | 162 | |||
517 | 163 | |||
518 | 164 | <!-- ##### MACRO INDICATE_LISTENER_SIGNAL_INDICATOR_MODIFIED ##### --> | ||
519 | 165 | <para> | ||
520 | 166 | |||
521 | 167 | </para> | ||
522 | 168 | |||
523 | 169 | |||
524 | 170 | <!-- ##### MACRO INDICATE_LISTENER_SIGNAL_INDICATOR_REMOVED ##### --> | ||
525 | 171 | <para> | ||
526 | 172 | |||
527 | 173 | </para> | ||
528 | 174 | |||
529 | 175 | |||
530 | 176 | <!-- ##### MACRO INDICATE_LISTENER_SIGNAL_SERVER_ADDED ##### --> | ||
531 | 177 | <para> | ||
532 | 178 | |||
533 | 179 | </para> | ||
534 | 180 | |||
535 | 181 | |||
536 | 182 | <!-- ##### MACRO INDICATE_LISTENER_SIGNAL_SERVER_REMOVED ##### --> | ||
537 | 183 | <para> | ||
538 | 184 | |||
539 | 185 | </para> | ||
540 | 186 | |||
541 | 187 | |||
542 | 188 | <!-- ##### MACRO INDICATE_SERVER ##### --> | ||
543 | 189 | <para> | ||
544 | 190 | |||
545 | 191 | </para> | ||
546 | 192 | |||
547 | 193 | @object: | ||
548 | 194 | |||
549 | 195 | <!-- ##### MACRO INDICATE_SERVER_CLASS ##### --> | ||
550 | 196 | <para> | ||
551 | 197 | |||
552 | 198 | </para> | ||
553 | 199 | |||
554 | 200 | @klass: | ||
555 | 201 | |||
556 | 202 | <!-- ##### MACRO INDICATE_SERVER_GET_CLASS ##### --> | ||
557 | 203 | <para> | ||
558 | 204 | |||
559 | 205 | </para> | ||
560 | 206 | |||
561 | 207 | @object: | ||
562 | 208 | |||
563 | 209 | <!-- ##### MACRO INDICATE_TYPE_INDICATOR ##### --> | ||
564 | 210 | <para> | ||
565 | 211 | |||
566 | 212 | </para> | ||
567 | 213 | |||
568 | 214 | |||
569 | 215 | <!-- ##### MACRO INDICATE_TYPE_INDICATOR_MESSAGE ##### --> | ||
570 | 216 | <para> | ||
571 | 217 | |||
572 | 218 | </para> | ||
573 | 219 | |||
574 | 220 | |||
575 | 221 | <!-- ##### MACRO INDICATE_TYPE_LISTENER ##### --> | ||
576 | 222 | <para> | ||
577 | 223 | |||
578 | 224 | </para> | ||
579 | 225 | |||
580 | 226 | |||
581 | 227 | <!-- ##### MACRO INDICATE_TYPE_SERVER ##### --> | ||
582 | 228 | <para> | ||
583 | 229 | |||
584 | 230 | </para> | ||
585 | 231 | |||
586 | 232 | |||
587 | 233 | <!-- ##### FUNCTION dbus_g_proxy_begin_call ##### --> | ||
588 | 234 | <para> | ||
589 | 235 | |||
590 | 236 | </para> | ||
591 | 237 | |||
592 | 238 | @Param1: | ||
593 | 239 | @Returns: | ||
594 | 240 | |||
595 | 241 | <!-- ##### MACRO g_marshal_value_peek_boolean ##### --> | ||
596 | 242 | <para> | ||
597 | 243 | |||
598 | 244 | </para> | ||
599 | 245 | |||
600 | 246 | @v: | ||
601 | 247 | |||
602 | 248 | <!-- ##### MACRO g_marshal_value_peek_boxed ##### --> | ||
603 | 249 | <para> | ||
604 | 250 | |||
605 | 251 | </para> | ||
606 | 252 | |||
607 | 253 | @v: | ||
608 | 254 | |||
609 | 255 | <!-- ##### MACRO g_marshal_value_peek_char ##### --> | ||
610 | 256 | <para> | ||
611 | 257 | |||
612 | 258 | </para> | ||
613 | 259 | |||
614 | 260 | @v: | ||
615 | 261 | |||
616 | 262 | <!-- ##### MACRO g_marshal_value_peek_double ##### --> | ||
617 | 263 | <para> | ||
618 | 264 | |||
619 | 265 | </para> | ||
620 | 266 | |||
621 | 267 | @v: | ||
622 | 268 | |||
623 | 269 | <!-- ##### MACRO g_marshal_value_peek_enum ##### --> | ||
624 | 270 | <para> | ||
625 | 271 | |||
626 | 272 | </para> | ||
627 | 273 | |||
628 | 274 | @v: | ||
629 | 275 | |||
630 | 276 | <!-- ##### MACRO g_marshal_value_peek_flags ##### --> | ||
631 | 277 | <para> | ||
632 | 278 | |||
633 | 279 | </para> | ||
634 | 280 | |||
635 | 281 | @v: | ||
636 | 282 | |||
637 | 283 | <!-- ##### MACRO g_marshal_value_peek_float ##### --> | ||
638 | 284 | <para> | ||
639 | 285 | |||
640 | 286 | </para> | ||
641 | 287 | |||
642 | 288 | @v: | ||
643 | 289 | |||
644 | 290 | <!-- ##### MACRO g_marshal_value_peek_int ##### --> | ||
645 | 291 | <para> | ||
646 | 292 | |||
647 | 293 | </para> | ||
648 | 294 | |||
649 | 295 | @v: | ||
650 | 296 | |||
651 | 297 | <!-- ##### MACRO g_marshal_value_peek_int64 ##### --> | ||
652 | 298 | <para> | ||
653 | 299 | |||
654 | 300 | </para> | ||
655 | 301 | |||
656 | 302 | @v: | ||
657 | 303 | |||
658 | 304 | <!-- ##### MACRO g_marshal_value_peek_long ##### --> | ||
659 | 305 | <para> | ||
660 | 306 | |||
661 | 307 | </para> | ||
662 | 308 | |||
663 | 309 | @v: | ||
664 | 310 | |||
665 | 311 | <!-- ##### MACRO g_marshal_value_peek_object ##### --> | ||
666 | 312 | <para> | ||
667 | 313 | |||
668 | 314 | </para> | ||
669 | 315 | |||
670 | 316 | @v: | ||
671 | 317 | |||
672 | 318 | <!-- ##### MACRO g_marshal_value_peek_param ##### --> | ||
673 | 319 | <para> | ||
674 | 320 | |||
675 | 321 | </para> | ||
676 | 322 | |||
677 | 323 | @v: | ||
678 | 324 | |||
679 | 325 | <!-- ##### MACRO g_marshal_value_peek_pointer ##### --> | ||
680 | 326 | <para> | ||
681 | 327 | |||
682 | 328 | </para> | ||
683 | 329 | |||
684 | 330 | @v: | ||
685 | 331 | |||
686 | 332 | <!-- ##### MACRO g_marshal_value_peek_string ##### --> | ||
687 | 333 | <para> | ||
688 | 334 | |||
689 | 335 | </para> | ||
690 | 336 | |||
691 | 337 | @v: | ||
692 | 338 | |||
693 | 339 | <!-- ##### MACRO g_marshal_value_peek_uchar ##### --> | ||
694 | 340 | <para> | ||
695 | 341 | |||
696 | 342 | </para> | ||
697 | 343 | |||
698 | 344 | @v: | ||
699 | 345 | |||
700 | 346 | <!-- ##### MACRO g_marshal_value_peek_uint ##### --> | ||
701 | 347 | <para> | ||
702 | 348 | |||
703 | 349 | </para> | ||
704 | 350 | |||
705 | 351 | @v: | ||
706 | 352 | |||
707 | 353 | <!-- ##### MACRO g_marshal_value_peek_uint64 ##### --> | ||
708 | 354 | <para> | ||
709 | 355 | |||
710 | 356 | </para> | ||
711 | 357 | |||
712 | 358 | @v: | ||
713 | 359 | |||
714 | 360 | <!-- ##### MACRO g_marshal_value_peek_ulong ##### --> | ||
715 | 361 | <para> | ||
716 | 362 | |||
717 | 363 | </para> | ||
718 | 364 | |||
719 | 365 | @v: | ||
720 | 366 | |||
721 | 367 | <!-- ##### FUNCTION indicate_indicator_get_type ##### --> | ||
722 | 368 | <para> | ||
723 | 369 | |||
724 | 370 | </para> | ||
725 | 371 | |||
726 | 372 | @Returns: | ||
727 | 373 | |||
728 | 374 | <!-- ##### FUNCTION indicate_indicator_message_get_type ##### --> | ||
732 | 375 | <para> | 71 | <para> |
733 | 376 | 72 | ||
734 | 377 | </para> | 73 | </para> |
735 | @@ -387,19 +83,39 @@ | |||
736 | 387 | @key: | 83 | @key: |
737 | 388 | @data: | 84 | @data: |
738 | 389 | 85 | ||
752 | 390 | <!-- ##### FUNCTION indicate_listener_get_type ##### --> | 86 | <!-- ##### FUNCTION indicate_server_emit_indicator_added ##### --> |
753 | 391 | <para> | 87 | <para> |
754 | 392 | 88 | ||
755 | 393 | </para> | 89 | </para> |
756 | 394 | 90 | ||
757 | 395 | @Returns: | 91 | @server: |
758 | 396 | 92 | @id: | |
759 | 397 | <!-- ##### FUNCTION indicate_server_get_type ##### --> | 93 | @type: |
760 | 398 | <para> | 94 | |
761 | 399 | 95 | <!-- ##### FUNCTION indicate_server_emit_indicator_modified ##### --> | |
762 | 400 | </para> | 96 | <para> |
763 | 401 | 97 | ||
764 | 402 | @Returns: | 98 | </para> |
765 | 99 | |||
766 | 100 | @server: | ||
767 | 101 | @id: | ||
768 | 102 | @property: | ||
769 | 103 | |||
770 | 104 | <!-- ##### FUNCTION indicate_server_emit_indicator_removed ##### --> | ||
771 | 105 | <para> | ||
772 | 106 | |||
773 | 107 | </para> | ||
774 | 108 | |||
775 | 109 | @server: | ||
776 | 110 | @id: | ||
777 | 111 | @type: | ||
778 | 112 | |||
779 | 113 | <!-- ##### FUNCTION indicate_server_emit_server_display ##### --> | ||
780 | 114 | <para> | ||
781 | 115 | |||
782 | 116 | </para> | ||
783 | 117 | |||
784 | 118 | @server: | ||
785 | 403 | 119 | ||
786 | 404 | <!-- ##### FUNCTION indicate_server_new ##### --> | 120 | <!-- ##### FUNCTION indicate_server_new ##### --> |
787 | 405 | <para> | 121 | <para> |
788 | @@ -415,241 +131,3 @@ | |||
789 | 415 | 131 | ||
790 | 416 | @obj: | 132 | @obj: |
791 | 417 | 133 | ||
792 | 418 | <!-- ##### FUNCTION org_freedesktop_indicator_get_indicator_count ##### --> | ||
793 | 419 | <para> | ||
794 | 420 | |||
795 | 421 | </para> | ||
796 | 422 | |||
797 | 423 | @proxy: | ||
798 | 424 | @OUT_indicator_count: | ||
799 | 425 | @Returns: | ||
800 | 426 | |||
801 | 427 | <!-- ##### FUNCTION org_freedesktop_indicator_get_indicator_count_async ##### --> | ||
802 | 428 | <para> | ||
803 | 429 | |||
804 | 430 | </para> | ||
805 | 431 | |||
806 | 432 | @proxy: | ||
807 | 433 | @callback: | ||
808 | 434 | @Returns: | ||
809 | 435 | |||
810 | 436 | <!-- ##### FUNCTION org_freedesktop_indicator_get_indicator_count_by_type ##### --> | ||
811 | 437 | <para> | ||
812 | 438 | |||
813 | 439 | </para> | ||
814 | 440 | |||
815 | 441 | @proxy: | ||
816 | 442 | @IN_type: | ||
817 | 443 | @OUT_indicator_count: | ||
818 | 444 | @Returns: | ||
819 | 445 | |||
820 | 446 | <!-- ##### FUNCTION org_freedesktop_indicator_get_indicator_count_by_type_async ##### --> | ||
821 | 447 | <para> | ||
822 | 448 | |||
823 | 449 | </para> | ||
824 | 450 | |||
825 | 451 | @proxy: | ||
826 | 452 | @IN_type: | ||
827 | 453 | @callback: | ||
828 | 454 | @Returns: | ||
829 | 455 | |||
830 | 456 | <!-- ##### USER_FUNCTION org_freedesktop_indicator_get_indicator_count_by_type_reply ##### --> | ||
831 | 457 | <para> | ||
832 | 458 | |||
833 | 459 | </para> | ||
834 | 460 | |||
835 | 461 | @proxy: | ||
836 | 462 | @OUT_indicator_count: | ||
837 | 463 | @error: | ||
838 | 464 | @userdata: | ||
839 | 465 | |||
840 | 466 | <!-- ##### USER_FUNCTION org_freedesktop_indicator_get_indicator_count_reply ##### --> | ||
841 | 467 | <para> | ||
842 | 468 | |||
843 | 469 | </para> | ||
844 | 470 | |||
845 | 471 | @proxy: | ||
846 | 472 | @OUT_indicator_count: | ||
847 | 473 | @error: | ||
848 | 474 | @userdata: | ||
849 | 475 | |||
850 | 476 | <!-- ##### FUNCTION org_freedesktop_indicator_get_indicator_list ##### --> | ||
851 | 477 | <para> | ||
852 | 478 | |||
853 | 479 | </para> | ||
854 | 480 | |||
855 | 481 | @proxy: | ||
856 | 482 | @OUT_indicators: | ||
857 | 483 | @Returns: | ||
858 | 484 | |||
859 | 485 | <!-- ##### FUNCTION org_freedesktop_indicator_get_indicator_list_async ##### --> | ||
860 | 486 | <para> | ||
861 | 487 | |||
862 | 488 | </para> | ||
863 | 489 | |||
864 | 490 | @proxy: | ||
865 | 491 | @callback: | ||
866 | 492 | @Returns: | ||
867 | 493 | |||
868 | 494 | <!-- ##### FUNCTION org_freedesktop_indicator_get_indicator_list_by_type ##### --> | ||
869 | 495 | <para> | ||
870 | 496 | |||
871 | 497 | </para> | ||
872 | 498 | |||
873 | 499 | @proxy: | ||
874 | 500 | @IN_type: | ||
875 | 501 | @OUT_indicators: | ||
876 | 502 | @Returns: | ||
877 | 503 | |||
878 | 504 | <!-- ##### FUNCTION org_freedesktop_indicator_get_indicator_list_by_type_async ##### --> | ||
879 | 505 | <para> | ||
880 | 506 | |||
881 | 507 | </para> | ||
882 | 508 | |||
883 | 509 | @proxy: | ||
884 | 510 | @IN_type: | ||
885 | 511 | @callback: | ||
886 | 512 | @Returns: | ||
887 | 513 | |||
888 | 514 | <!-- ##### USER_FUNCTION org_freedesktop_indicator_get_indicator_list_by_type_reply ##### --> | ||
889 | 515 | <para> | ||
890 | 516 | |||
891 | 517 | </para> | ||
892 | 518 | |||
893 | 519 | @proxy: | ||
894 | 520 | @OUT_indicators: | ||
895 | 521 | @error: | ||
896 | 522 | @userdata: | ||
897 | 523 | |||
898 | 524 | <!-- ##### USER_FUNCTION org_freedesktop_indicator_get_indicator_list_reply ##### --> | ||
899 | 525 | <para> | ||
900 | 526 | |||
901 | 527 | </para> | ||
902 | 528 | |||
903 | 529 | @proxy: | ||
904 | 530 | @OUT_indicators: | ||
905 | 531 | @error: | ||
906 | 532 | @userdata: | ||
907 | 533 | |||
908 | 534 | <!-- ##### FUNCTION org_freedesktop_indicator_get_indicator_properties ##### --> | ||
909 | 535 | <para> | ||
910 | 536 | |||
911 | 537 | </para> | ||
912 | 538 | |||
913 | 539 | @proxy: | ||
914 | 540 | @IN_id: | ||
915 | 541 | @OUT_properties: | ||
916 | 542 | @Returns: | ||
917 | 543 | |||
918 | 544 | <!-- ##### FUNCTION org_freedesktop_indicator_get_indicator_properties_async ##### --> | ||
919 | 545 | <para> | ||
920 | 546 | |||
921 | 547 | </para> | ||
922 | 548 | |||
923 | 549 | @proxy: | ||
924 | 550 | @IN_id: | ||
925 | 551 | @callback: | ||
926 | 552 | @Returns: | ||
927 | 553 | |||
928 | 554 | <!-- ##### USER_FUNCTION org_freedesktop_indicator_get_indicator_properties_reply ##### --> | ||
929 | 555 | <para> | ||
930 | 556 | |||
931 | 557 | </para> | ||
932 | 558 | |||
933 | 559 | @proxy: | ||
934 | 560 | @OUT_properties: | ||
935 | 561 | @error: | ||
936 | 562 | @userdata: | ||
937 | 563 | |||
938 | 564 | <!-- ##### FUNCTION org_freedesktop_indicator_get_indicator_property ##### --> | ||
939 | 565 | <para> | ||
940 | 566 | |||
941 | 567 | </para> | ||
942 | 568 | |||
943 | 569 | @proxy: | ||
944 | 570 | @IN_id: | ||
945 | 571 | @IN_property: | ||
946 | 572 | @OUT_value: | ||
947 | 573 | @Returns: | ||
948 | 574 | |||
949 | 575 | <!-- ##### FUNCTION org_freedesktop_indicator_get_indicator_property_async ##### --> | ||
950 | 576 | <para> | ||
951 | 577 | |||
952 | 578 | </para> | ||
953 | 579 | |||
954 | 580 | @proxy: | ||
955 | 581 | @IN_id: | ||
956 | 582 | @IN_property: | ||
957 | 583 | @callback: | ||
958 | 584 | @Returns: | ||
959 | 585 | |||
960 | 586 | <!-- ##### FUNCTION org_freedesktop_indicator_get_indicator_property_group ##### --> | ||
961 | 587 | <para> | ||
962 | 588 | |||
963 | 589 | </para> | ||
964 | 590 | |||
965 | 591 | @proxy: | ||
966 | 592 | @IN_id: | ||
967 | 593 | @IN_properties: | ||
968 | 594 | @OUT_values: | ||
969 | 595 | @Returns: | ||
970 | 596 | |||
971 | 597 | <!-- ##### FUNCTION org_freedesktop_indicator_get_indicator_property_group_async ##### --> | ||
972 | 598 | <para> | ||
973 | 599 | |||
974 | 600 | </para> | ||
975 | 601 | |||
976 | 602 | @proxy: | ||
977 | 603 | @IN_id: | ||
978 | 604 | @IN_properties: | ||
979 | 605 | @callback: | ||
980 | 606 | @Returns: | ||
981 | 607 | |||
982 | 608 | <!-- ##### USER_FUNCTION org_freedesktop_indicator_get_indicator_property_group_reply ##### --> | ||
983 | 609 | <para> | ||
984 | 610 | |||
985 | 611 | </para> | ||
986 | 612 | |||
987 | 613 | @proxy: | ||
988 | 614 | @OUT_values: | ||
989 | 615 | @error: | ||
990 | 616 | @userdata: | ||
991 | 617 | |||
992 | 618 | <!-- ##### USER_FUNCTION org_freedesktop_indicator_get_indicator_property_reply ##### --> | ||
993 | 619 | <para> | ||
994 | 620 | |||
995 | 621 | </para> | ||
996 | 622 | |||
997 | 623 | @proxy: | ||
998 | 624 | @OUT_value: | ||
999 | 625 | @error: | ||
1000 | 626 | @userdata: | ||
1001 | 627 | |||
1002 | 628 | <!-- ##### FUNCTION org_freedesktop_indicator_show_indicator_to_user ##### --> | ||
1003 | 629 | <para> | ||
1004 | 630 | |||
1005 | 631 | </para> | ||
1006 | 632 | |||
1007 | 633 | @proxy: | ||
1008 | 634 | @IN_id: | ||
1009 | 635 | @Returns: | ||
1010 | 636 | |||
1011 | 637 | <!-- ##### FUNCTION org_freedesktop_indicator_show_indicator_to_user_async ##### --> | ||
1012 | 638 | <para> | ||
1013 | 639 | |||
1014 | 640 | </para> | ||
1015 | 641 | |||
1016 | 642 | @proxy: | ||
1017 | 643 | @IN_id: | ||
1018 | 644 | @callback: | ||
1019 | 645 | @Returns: | ||
1020 | 646 | |||
1021 | 647 | <!-- ##### USER_FUNCTION org_freedesktop_indicator_show_indicator_to_user_reply ##### --> | ||
1022 | 648 | <para> | ||
1023 | 649 | |||
1024 | 650 | </para> | ||
1025 | 651 | |||
1026 | 652 | @proxy: | ||
1027 | 653 | @error: | ||
1028 | 654 | @userdata: | ||
1029 | 655 | |||
1030 | 656 | 134 | ||
1031 | === modified file 'examples/im-client.c' | |||
1032 | --- examples/im-client.c 2009-08-03 22:49:42 +0000 | |||
1033 | +++ examples/im-client.c 2009-08-28 19:40:56 +0000 | |||
1034 | @@ -21,7 +21,7 @@ | |||
1035 | 21 | 21 | ||
1036 | 22 | #include <glib.h> | 22 | #include <glib.h> |
1037 | 23 | #include "libindicate/server.h" | 23 | #include "libindicate/server.h" |
1039 | 24 | #include "libindicate/indicator-message.h" | 24 | #include "libindicate/indicator.h" |
1040 | 25 | #include "libindicate-gtk/indicator.h" | 25 | #include "libindicate-gtk/indicator.h" |
1041 | 26 | 26 | ||
1042 | 27 | gchar * patha = "/usr/share/icons/hicolor/16x16/apps/empathy.png"; | 27 | gchar * patha = "/usr/share/icons/hicolor/16x16/apps/empathy.png"; |
1043 | @@ -69,7 +69,7 @@ | |||
1044 | 69 | static void | 69 | static void |
1045 | 70 | interest_added (IndicateServer * server, IndicateInterests interest) | 70 | interest_added (IndicateServer * server, IndicateInterests interest) |
1046 | 71 | { | 71 | { |
1048 | 72 | g_debug("Oh, someone is interested in my for: %d", interest); | 72 | g_debug("Oh, someone is interested in me for: %d", interest); |
1049 | 73 | } | 73 | } |
1050 | 74 | 74 | ||
1051 | 75 | void | 75 | void |
1052 | @@ -90,9 +90,9 @@ | |||
1053 | 90 | g_signal_connect(G_OBJECT(server), INDICATE_SERVER_SIGNAL_INTEREST_ADDED, G_CALLBACK(interest_added), NULL); | 90 | g_signal_connect(G_OBJECT(server), INDICATE_SERVER_SIGNAL_INTEREST_ADDED, G_CALLBACK(interest_added), NULL); |
1054 | 91 | g_signal_connect(G_OBJECT(server), INDICATE_SERVER_SIGNAL_INTEREST_REMOVED, G_CALLBACK(interest_removed), NULL); | 91 | g_signal_connect(G_OBJECT(server), INDICATE_SERVER_SIGNAL_INTEREST_REMOVED, G_CALLBACK(interest_removed), NULL); |
1055 | 92 | 92 | ||
1057 | 93 | IndicateIndicatorMessage * indicator; | 93 | IndicateIndicator * indicator; |
1058 | 94 | 94 | ||
1060 | 95 | indicator = indicate_indicator_message_new(); | 95 | indicator = indicate_indicator_new(); |
1061 | 96 | indicate_indicator_set_property(INDICATE_INDICATOR(indicator), "subtype", "im"); | 96 | indicate_indicator_set_property(INDICATE_INDICATOR(indicator), "subtype", "im"); |
1062 | 97 | indicate_indicator_set_property(INDICATE_INDICATOR(indicator), "sender", "IM Client Test"); | 97 | indicate_indicator_set_property(INDICATE_INDICATOR(indicator), "sender", "IM Client Test"); |
1063 | 98 | GTimeVal time; g_get_current_time(&time); | 98 | GTimeVal time; g_get_current_time(&time); |
1064 | 99 | 99 | ||
1065 | === modified file 'examples/show-hide-server.c' | |||
1066 | --- examples/show-hide-server.c 2009-04-07 22:34:45 +0000 | |||
1067 | +++ examples/show-hide-server.c 2009-08-28 19:40:56 +0000 | |||
1068 | @@ -2,7 +2,6 @@ | |||
1069 | 2 | 2 | ||
1070 | 3 | #include <glib.h> | 3 | #include <glib.h> |
1071 | 4 | #include "libindicate/server.h" | 4 | #include "libindicate/server.h" |
1072 | 5 | #include "libindicate/indicator-message.h" | ||
1073 | 6 | 5 | ||
1074 | 7 | gboolean hidden = TRUE; | 6 | gboolean hidden = TRUE; |
1075 | 8 | 7 | ||
1076 | @@ -12,14 +11,14 @@ | |||
1077 | 12 | IndicateServer * server = INDICATE_SERVER(data); | 11 | IndicateServer * server = INDICATE_SERVER(data); |
1078 | 13 | 12 | ||
1079 | 14 | if (hidden) { | 13 | if (hidden) { |
1081 | 15 | printf("showing... "); | 14 | g_debug("showing... "); |
1082 | 16 | indicate_server_show(server); | 15 | indicate_server_show(server); |
1084 | 17 | printf("ok\n"); | 16 | g_debug("ok\n"); |
1085 | 18 | hidden = FALSE; | 17 | hidden = FALSE; |
1086 | 19 | } else { | 18 | } else { |
1088 | 20 | printf("hiding... "); | 19 | g_debug("hiding... "); |
1089 | 21 | indicate_server_hide(server); | 20 | indicate_server_hide(server); |
1091 | 22 | printf("ok\n"); | 21 | g_debug("ok\n"); |
1092 | 23 | hidden = TRUE; | 22 | hidden = TRUE; |
1093 | 24 | } | 23 | } |
1094 | 25 | 24 | ||
1095 | 26 | 25 | ||
1096 | === modified file 'libindicate-gtk/Makefile.am' | |||
1097 | --- libindicate-gtk/Makefile.am 2009-08-04 00:26:10 +0000 | |||
1098 | +++ libindicate-gtk/Makefile.am 2009-09-03 22:32:17 +0000 | |||
1099 | @@ -8,7 +8,7 @@ | |||
1100 | 8 | lib_LTLIBRARIES = \ | 8 | lib_LTLIBRARIES = \ |
1101 | 9 | libindicate-gtk.la | 9 | libindicate-gtk.la |
1102 | 10 | 10 | ||
1104 | 11 | libindicate_gtkincludedir=$(includedir)/libindicate-0.1/libindicate-gtk | 11 | libindicate_gtkincludedir=$(includedir)/libindicate-0.2/libindicate-gtk |
1105 | 12 | 12 | ||
1106 | 13 | indicate_gtk_headers = \ | 13 | indicate_gtk_headers = \ |
1107 | 14 | indicator.h \ | 14 | indicator.h \ |
1108 | 15 | 15 | ||
1109 | === modified file 'libindicate-gtk/indicate-gtk.pc.in' | |||
1110 | --- libindicate-gtk/indicate-gtk.pc.in 2009-08-03 18:10:34 +0000 | |||
1111 | +++ libindicate-gtk/indicate-gtk.pc.in 2009-09-03 22:32:17 +0000 | |||
1112 | @@ -4,7 +4,7 @@ | |||
1113 | 4 | bindir=@bindir@ | 4 | bindir=@bindir@ |
1114 | 5 | includedir=@includedir@ | 5 | includedir=@includedir@ |
1115 | 6 | 6 | ||
1117 | 7 | Cflags: -I${includedir}/libindicate-0.1 | 7 | Cflags: -I${includedir}/libindicate-0.2 |
1118 | 8 | Requires: gtk+-2.0 indicate | 8 | Requires: gtk+-2.0 indicate |
1119 | 9 | Libs: -L${libdir} -lindicate-gtk | 9 | Libs: -L${libdir} -lindicate-gtk |
1120 | 10 | 10 | ||
1121 | 11 | 11 | ||
1122 | === modified file 'libindicate-gtk/indicator.c' | |||
1123 | --- libindicate-gtk/indicator.c 2009-08-03 18:25:05 +0000 | |||
1124 | +++ libindicate-gtk/indicator.c 2009-09-04 03:00:22 +0000 | |||
1125 | @@ -54,7 +54,7 @@ | |||
1126 | 54 | 54 | ||
1127 | 55 | if (!gdk_pixbuf_save_to_buffer((GdkPixbuf *)data, &png_data, &png_data_len, "png", &error, NULL)) { | 55 | if (!gdk_pixbuf_save_to_buffer((GdkPixbuf *)data, &png_data, &png_data_len, "png", &error, NULL)) { |
1128 | 56 | if (error == NULL) { | 56 | if (error == NULL) { |
1130 | 57 | g_warning("Unable to create pixbuf data stream: %d", png_data_len); | 57 | g_warning("Unable to create pixbuf data stream: %d", (gint)png_data_len); |
1131 | 58 | } else { | 58 | } else { |
1132 | 59 | g_warning("Unable to create pixbuf data stream: %s", error->message); | 59 | g_warning("Unable to create pixbuf data stream: %s", error->message); |
1133 | 60 | g_error_free(error); | 60 | g_error_free(error); |
1134 | 61 | 61 | ||
1135 | === modified file 'libindicate-gtk/listener.c' | |||
1136 | --- libindicate-gtk/listener.c 2009-08-03 22:43:37 +0000 | |||
1137 | +++ libindicate-gtk/listener.c 2009-09-08 20:59:59 +0000 | |||
1138 | @@ -127,7 +127,7 @@ | |||
1139 | 127 | { | 127 | { |
1140 | 128 | /* g_debug("get_property_helper: %s %d", property, prop_type); */ | 128 | /* g_debug("get_property_helper: %s %d", property, prop_type); */ |
1141 | 129 | /* TODO: Do we need to somehow refcount the server/indicator while we're waiting on this? */ | 129 | /* TODO: Do we need to somehow refcount the server/indicator while we're waiting on this? */ |
1143 | 130 | get_property_t * get_property_data = g_new(get_property_t, 1); | 130 | get_property_t * get_property_data = g_new0(get_property_t, 1); |
1144 | 131 | get_property_data->cb = callback; | 131 | get_property_data->cb = callback; |
1145 | 132 | get_property_data->data = data; | 132 | get_property_data->data = data; |
1146 | 133 | get_property_data->listener = listener; | 133 | get_property_data->listener = listener; |
1147 | 134 | 134 | ||
1148 | === modified file 'libindicate/Makefile.am' | |||
1149 | --- libindicate/Makefile.am 2009-08-03 22:31:00 +0000 | |||
1150 | +++ libindicate/Makefile.am 2009-09-04 17:44:23 +0000 | |||
1151 | @@ -27,11 +27,11 @@ | |||
1152 | 27 | lib_LTLIBRARIES = \ | 27 | lib_LTLIBRARIES = \ |
1153 | 28 | libindicate.la | 28 | libindicate.la |
1154 | 29 | 29 | ||
1156 | 30 | libindicateincludedir=$(includedir)/libindicate-0.1/libindicate | 30 | libindicateincludedir=$(includedir)/libindicate-0.2/libindicate |
1157 | 31 | 31 | ||
1158 | 32 | indicate_headers = \ | 32 | indicate_headers = \ |
1159 | 33 | indicator.h \ | 33 | indicator.h \ |
1161 | 34 | indicator-message.h \ | 34 | indicator-messages.h \ |
1162 | 35 | listener.h \ | 35 | listener.h \ |
1163 | 36 | server.h \ | 36 | server.h \ |
1164 | 37 | interests.h \ | 37 | interests.h \ |
1165 | @@ -55,7 +55,6 @@ | |||
1166 | 55 | listener-marshal.h \ | 55 | listener-marshal.h \ |
1167 | 56 | listener-private.h \ | 56 | listener-private.h \ |
1168 | 57 | indicator.c \ | 57 | indicator.c \ |
1169 | 58 | indicator-message.c \ | ||
1170 | 59 | interests-priv.h | 58 | interests-priv.h |
1171 | 60 | 59 | ||
1172 | 61 | libindicate_la_LDFLAGS = \ | 60 | libindicate_la_LDFLAGS = \ |
1173 | @@ -64,7 +63,8 @@ | |||
1174 | 64 | -export-symbols-regex "^[^_d].*" | 63 | -export-symbols-regex "^[^_d].*" |
1175 | 65 | 64 | ||
1176 | 66 | libindicate_la_CFLAGS = \ | 65 | libindicate_la_CFLAGS = \ |
1178 | 67 | $(LIBINDICATE_CFLAGS) | 66 | $(LIBINDICATE_CFLAGS) \ |
1179 | 67 | -Wall -Werror | ||
1180 | 68 | 68 | ||
1181 | 69 | libindicate_la_LIBADD = \ | 69 | libindicate_la_LIBADD = \ |
1182 | 70 | $(LIBINDICATE_LIBS) | 70 | $(LIBINDICATE_LIBS) |
1183 | @@ -148,40 +148,39 @@ | |||
1184 | 148 | && echo timestamp > $(@F) | 148 | && echo timestamp > $(@F) |
1185 | 149 | 149 | ||
1186 | 150 | CLEANFILES = \ | 150 | CLEANFILES = \ |
1189 | 151 | $(ENUM_FILE).c \ | 151 | $(BUILT_SOURCES) \ |
1188 | 152 | $(ENUM_FILE).h \ | ||
1190 | 153 | s-enum-types-c \ | 152 | s-enum-types-c \ |
1191 | 154 | s-enum-types-h | 153 | s-enum-types-h |
1192 | 155 | 154 | ||
1193 | 156 | if USE_GIR | 155 | if USE_GIR |
1194 | 157 | 156 | ||
1195 | 158 | gobjectintrospection_gir_DATA = \ | 157 | gobjectintrospection_gir_DATA = \ |
1197 | 159 | Indicate-0.1.gir | 158 | Indicate-0.2.gir |
1198 | 160 | gobjectintrospection_girdir = $(datadir)/gir | 159 | gobjectintrospection_girdir = $(datadir)/gir |
1199 | 161 | 160 | ||
1200 | 162 | gobjectintrospection_type_DATA = \ | 161 | gobjectintrospection_type_DATA = \ |
1202 | 163 | Indicate-0.1.typelib | 162 | Indicate-0.2.typelib |
1203 | 164 | gobjectintrospection_typedir = $(libdir)/girepository | 163 | gobjectintrospection_typedir = $(libdir)/girepository |
1204 | 165 | 164 | ||
1205 | 166 | irscanner_headers = $(patsubst %,$(srcdir)/%,$(indicate_headers)) | 165 | irscanner_headers = $(patsubst %,$(srcdir)/%,$(indicate_headers)) |
1207 | 167 | Indicate-0.1.gir: $(irscanner_headers) | 166 | Indicate-0.2.gir: $(irscanner_headers) Makefile |
1208 | 168 | $(G_IR_SCANNER) \ | 167 | $(G_IR_SCANNER) \ |
1209 | 169 | -v --namespace Indicate \ | 168 | -v --namespace Indicate \ |
1211 | 170 | --nsversion=0.1 \ | 169 | --nsversion=0.2 \ |
1212 | 171 | --add-include-path=$(srcdir) \ | 170 | --add-include-path=$(srcdir) \ |
1213 | 172 | --include=GObject-2.0 \ | 171 | --include=GObject-2.0 \ |
1214 | 173 | --include=GLib-2.0 \ | 172 | --include=GLib-2.0 \ |
1215 | 174 | --include=GdkPixbuf-2.0 \ | 173 | --include=GdkPixbuf-2.0 \ |
1216 | 175 | --library=indicate --pkg indicate \ | 174 | --library=indicate --pkg indicate \ |
1218 | 176 | --output Indicate-0.1.gir $(irscanner_headers) | 175 | --output Indicate-0.2.gir $(irscanner_headers) |
1219 | 177 | 176 | ||
1221 | 178 | Indicate-0.1.typelib: Indicate-0.1.gir | 177 | Indicate-0.2.typelib: Indicate-0.2.gir |
1222 | 179 | $(G_IR_COMPILER) \ | 178 | $(G_IR_COMPILER) \ |
1225 | 180 | --includedir=$(srcdir) Indicate-0.1.gir \ | 179 | --includedir=$(srcdir) Indicate-0.2.gir \ |
1226 | 181 | -o Indicate-0.1.typelib | 180 | -o Indicate-0.2.typelib |
1227 | 182 | 181 | ||
1228 | 183 | DISTCLEANFILES = \ | 182 | DISTCLEANFILES = \ |
1231 | 184 | Indicate-0.1.gir \ | 183 | Indicate-0.2.gir \ |
1232 | 185 | Indicate-0.1.typelib | 184 | Indicate-0.2.typelib |
1233 | 186 | 185 | ||
1234 | 187 | endif | 186 | endif |
1235 | 188 | 187 | ||
1236 | === modified file 'libindicate/indicate-interface.xml' | |||
1237 | --- libindicate/indicate-interface.xml 2009-04-02 15:49:35 +0000 | |||
1238 | +++ libindicate/indicate-interface.xml 2009-09-08 21:56:49 +0000 | |||
1239 | @@ -31,24 +31,17 @@ | |||
1240 | 31 | <interface name="org.freedesktop.indicator"> | 31 | <interface name="org.freedesktop.indicator"> |
1241 | 32 | 32 | ||
1242 | 33 | <!-- Properties --> | 33 | <!-- Properties --> |
1245 | 34 | <property name="desktop" type="s" access="read"/> | 34 | <property name="desktop" type="s" access="read" /> |
1246 | 35 | <property name="type" type="s" access="read"/> | 35 | <property name="type" type="s" access="read" /> |
1247 | 36 | <property name="count" type="u" access="read" /> | ||
1248 | 36 | 37 | ||
1249 | 37 | <!-- Functions --> | 38 | <!-- Functions --> |
1250 | 38 | <method name="GetIndicatorCount"> | 39 | <method name="GetIndicatorCount"> |
1251 | 39 | <arg type="u" name="indicator_count" direction="out" /> | 40 | <arg type="u" name="indicator_count" direction="out" /> |
1252 | 40 | </method> | 41 | </method> |
1253 | 41 | <method name="GetIndicatorCountByType"> | ||
1254 | 42 | <arg type="s" name="type" direction="in" /> | ||
1255 | 43 | <arg type="u" name="indicator_count" direction="out" /> | ||
1256 | 44 | </method> | ||
1257 | 45 | <method name="GetIndicatorList"> | 42 | <method name="GetIndicatorList"> |
1258 | 46 | <arg type="ai" name="indicators" direction="out" /> | 43 | <arg type="ai" name="indicators" direction="out" /> |
1259 | 47 | </method> | 44 | </method> |
1260 | 48 | <method name="GetIndicatorListByType"> | ||
1261 | 49 | <arg type="s" name="type" direction="in" /> | ||
1262 | 50 | <arg type="ai" name="indicators" direction="out" /> | ||
1263 | 51 | </method> | ||
1264 | 52 | <method name="GetIndicatorProperty"> | 45 | <method name="GetIndicatorProperty"> |
1265 | 53 | <arg type="u" name="id" direction="in" /> | 46 | <arg type="u" name="id" direction="in" /> |
1266 | 54 | <arg type="s" name="property" direction="in" /> | 47 | <arg type="s" name="property" direction="in" /> |
1267 | @@ -66,6 +59,11 @@ | |||
1268 | 66 | <method name="ShowIndicatorToUser"> | 59 | <method name="ShowIndicatorToUser"> |
1269 | 67 | <arg type="u" name="id" direction="in" /> | 60 | <arg type="u" name="id" direction="in" /> |
1270 | 68 | </method> | 61 | </method> |
1271 | 62 | <method name="IndicatorDisplayed"> | ||
1272 | 63 | <annotation name="org.freedesktop.DBus.GLib.Async" value="true" /> | ||
1273 | 64 | <arg type="u" name="id" direction="in" /> | ||
1274 | 65 | <arg type="b" name="displayed" direction="in" /> | ||
1275 | 66 | </method> | ||
1276 | 69 | <method name="ShowInterest"> | 67 | <method name="ShowInterest"> |
1277 | 70 | <annotation name="org.freedesktop.DBus.GLib.Async" value="true" /> | 68 | <annotation name="org.freedesktop.DBus.GLib.Async" value="true" /> |
1278 | 71 | <arg type="s" name="interest" direction="in" /> | 69 | <arg type="s" name="interest" direction="in" /> |
1279 | @@ -74,16 +72,18 @@ | |||
1280 | 74 | <annotation name="org.freedesktop.DBus.GLib.Async" value="true" /> | 72 | <annotation name="org.freedesktop.DBus.GLib.Async" value="true" /> |
1281 | 75 | <arg type="s" name="interest" direction="in" /> | 73 | <arg type="s" name="interest" direction="in" /> |
1282 | 76 | </method> | 74 | </method> |
1283 | 75 | <method name="SetMaxIndicators"> | ||
1284 | 76 | <annotation name="org.freedesktop.DBus.GLib.Async" value="true" /> | ||
1285 | 77 | <arg type="i" name="max" direction="in" /> | ||
1286 | 78 | </method> | ||
1287 | 77 | 79 | ||
1288 | 78 | 80 | ||
1289 | 79 | <!-- Signals --> | 81 | <!-- Signals --> |
1291 | 80 | <signal name="IndicatorAdded"> | 82 | <signal name="IndicatorNew"> |
1292 | 81 | <arg type="u" name="id" direction="out" /> | 83 | <arg type="u" name="id" direction="out" /> |
1293 | 82 | <arg type="s" name="type" direction="out" /> | ||
1294 | 83 | </signal> | 84 | </signal> |
1296 | 84 | <signal name="IndicatorRemoved"> | 85 | <signal name="IndicatorDelete"> |
1297 | 85 | <arg type="u" name="id" direction="out" /> | 86 | <arg type="u" name="id" direction="out" /> |
1298 | 86 | <arg type="s" name="type" direction="out" /> | ||
1299 | 87 | </signal> | 87 | </signal> |
1300 | 88 | <signal name="IndicatorModified"> | 88 | <signal name="IndicatorModified"> |
1301 | 89 | <arg type="u" name="id" direction="out" /> | 89 | <arg type="u" name="id" direction="out" /> |
1302 | @@ -95,6 +95,9 @@ | |||
1303 | 95 | <signal name="ServerHide"> | 95 | <signal name="ServerHide"> |
1304 | 96 | <arg type="s" name="type" direction="out" /> | 96 | <arg type="s" name="type" direction="out" /> |
1305 | 97 | </signal> | 97 | </signal> |
1306 | 98 | <signal name="ServerCountChanged"> | ||
1307 | 99 | <arg type="u" name="count" direction="out" /> | ||
1308 | 100 | </signal> | ||
1309 | 98 | 101 | ||
1310 | 99 | 102 | ||
1311 | 100 | <!-- End of interesting stuff --> | 103 | <!-- End of interesting stuff --> |
1312 | 101 | 104 | ||
1313 | === modified file 'libindicate/indicate.pc.in' | |||
1314 | --- libindicate/indicate.pc.in 2009-08-04 11:25:24 +0000 | |||
1315 | +++ libindicate/indicate.pc.in 2009-09-03 22:32:17 +0000 | |||
1316 | @@ -4,7 +4,7 @@ | |||
1317 | 4 | bindir=@bindir@ | 4 | bindir=@bindir@ |
1318 | 5 | includedir=@includedir@ | 5 | includedir=@includedir@ |
1319 | 6 | 6 | ||
1321 | 7 | Cflags: -I${includedir}/libindicate-0.1 | 7 | Cflags: -I${includedir}/libindicate-0.2 |
1322 | 8 | Requires: gobject-2.0 glib-2.0 dbus-glib-1 | 8 | Requires: gobject-2.0 glib-2.0 dbus-glib-1 |
1323 | 9 | Libs: -L${libdir} -lindicate | 9 | Libs: -L${libdir} -lindicate |
1324 | 10 | 10 | ||
1325 | 11 | 11 | ||
1326 | === removed file 'libindicate/indicator-message.c' | |||
1327 | --- libindicate/indicator-message.c 2009-04-30 21:57:51 +0000 | |||
1328 | +++ libindicate/indicator-message.c 1970-01-01 00:00:00 +0000 | |||
1329 | @@ -1,105 +0,0 @@ | |||
1330 | 1 | /* | ||
1331 | 2 | A library to allow applictions to provide simple indications of | ||
1332 | 3 | information to be displayed to users of the application through the | ||
1333 | 4 | interface shell. | ||
1334 | 5 | |||
1335 | 6 | Copyright 2009 Canonical Ltd. | ||
1336 | 7 | |||
1337 | 8 | Authors: | ||
1338 | 9 | Ted Gould <ted@canonical.com> | ||
1339 | 10 | |||
1340 | 11 | This program is free software: you can redistribute it and/or modify it | ||
1341 | 12 | under the terms of either or both of the following licenses: | ||
1342 | 13 | |||
1343 | 14 | 1) the GNU Lesser General Public License version 3, as published by the | ||
1344 | 15 | Free Software Foundation; and/or | ||
1345 | 16 | 2) the GNU Lesser General Public License version 2.1, as published by | ||
1346 | 17 | the Free Software Foundation. | ||
1347 | 18 | |||
1348 | 19 | This program is distributed in the hope that it will be useful, but | ||
1349 | 20 | WITHOUT ANY WARRANTY; without even the implied warranties of | ||
1350 | 21 | MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR | ||
1351 | 22 | PURPOSE. See the applicable version of the GNU Lesser General Public | ||
1352 | 23 | License for more details. | ||
1353 | 24 | |||
1354 | 25 | You should have received a copy of both the GNU Lesser General Public | ||
1355 | 26 | License version 3 and version 2.1 along with this program. If not, see | ||
1356 | 27 | <http://www.gnu.org/licenses/> | ||
1357 | 28 | */ | ||
1358 | 29 | |||
1359 | 30 | #ifdef HAVE_CONFIG_H | ||
1360 | 31 | #include "config.h" | ||
1361 | 32 | #endif | ||
1362 | 33 | |||
1363 | 34 | #include "indicator-message.h" | ||
1364 | 35 | |||
1365 | 36 | typedef struct _IndicateIndicatorMessagePrivate IndicateIndicatorMessagePrivate; | ||
1366 | 37 | |||
1367 | 38 | struct _IndicateIndicatorMessagePrivate | ||
1368 | 39 | { | ||
1369 | 40 | gchar * subtype; | ||
1370 | 41 | }; | ||
1371 | 42 | |||
1372 | 43 | #define INDICATE_INDICATOR_MESSAGE_GET_PRIVATE(o) \ | ||
1373 | 44 | (G_TYPE_INSTANCE_GET_PRIVATE ((o), INDICATE_INDICATOR_MESSAGE_TYPE, IndicateIndicatorMessagePrivate)) | ||
1374 | 45 | |||
1375 | 46 | static void indicate_indicator_message_class_init (IndicateIndicatorMessageClass *klass); | ||
1376 | 47 | static void indicate_indicator_message_init (IndicateIndicatorMessage *self); | ||
1377 | 48 | static void indicate_indicator_message_dispose (GObject *object); | ||
1378 | 49 | static void indicate_indicator_message_finalize (GObject *object); | ||
1379 | 50 | static const gchar * get_indicator_type (IndicateIndicator * indicator); | ||
1380 | 51 | |||
1381 | 52 | G_DEFINE_TYPE (IndicateIndicatorMessage, indicate_indicator_message, INDICATE_TYPE_INDICATOR); | ||
1382 | 53 | |||
1383 | 54 | static void | ||
1384 | 55 | indicate_indicator_message_class_init (IndicateIndicatorMessageClass *klass) | ||
1385 | 56 | { | ||
1386 | 57 | GObjectClass *object_class = G_OBJECT_CLASS (klass); | ||
1387 | 58 | |||
1388 | 59 | g_type_class_add_private (klass, sizeof (IndicateIndicatorMessagePrivate)); | ||
1389 | 60 | |||
1390 | 61 | object_class->dispose = indicate_indicator_message_dispose; | ||
1391 | 62 | object_class->finalize = indicate_indicator_message_finalize; | ||
1392 | 63 | |||
1393 | 64 | IndicateIndicatorClass * indicator_class = INDICATE_INDICATOR_CLASS(klass); | ||
1394 | 65 | |||
1395 | 66 | indicator_class->get_type = get_indicator_type; | ||
1396 | 67 | |||
1397 | 68 | return; | ||
1398 | 69 | } | ||
1399 | 70 | |||
1400 | 71 | static void | ||
1401 | 72 | indicate_indicator_message_init (IndicateIndicatorMessage *self) | ||
1402 | 73 | { | ||
1403 | 74 | } | ||
1404 | 75 | |||
1405 | 76 | static void | ||
1406 | 77 | indicate_indicator_message_dispose (GObject *object) | ||
1407 | 78 | { | ||
1408 | 79 | G_OBJECT_CLASS (indicate_indicator_message_parent_class)->dispose (object); | ||
1409 | 80 | } | ||
1410 | 81 | |||
1411 | 82 | static void | ||
1412 | 83 | indicate_indicator_message_finalize (GObject *object) | ||
1413 | 84 | { | ||
1414 | 85 | G_OBJECT_CLASS (indicate_indicator_message_parent_class)->finalize (object); | ||
1415 | 86 | } | ||
1416 | 87 | |||
1417 | 88 | /** | ||
1418 | 89 | indicate_indicator_message_new: | ||
1419 | 90 | |||
1420 | 91 | Builds a new indicator message object using #g_object_new. | ||
1421 | 92 | |||
1422 | 93 | Return value: A pointer to a new #IndicateIndicatorMessage object. | ||
1423 | 94 | */ | ||
1424 | 95 | static const gchar * | ||
1425 | 96 | get_indicator_type (IndicateIndicator * indicator) | ||
1426 | 97 | { | ||
1427 | 98 | return "message"; | ||
1428 | 99 | } | ||
1429 | 100 | |||
1430 | 101 | IndicateIndicatorMessage * | ||
1431 | 102 | indicate_indicator_message_new (void) | ||
1432 | 103 | { | ||
1433 | 104 | return g_object_new(INDICATE_TYPE_INDICATOR_MESSAGE, NULL); | ||
1434 | 105 | } | ||
1435 | 106 | 0 | ||
1436 | === removed file 'libindicate/indicator-message.h' | |||
1437 | --- libindicate/indicator-message.h 2009-05-01 02:45:19 +0000 | |||
1438 | +++ libindicate/indicator-message.h 1970-01-01 00:00:00 +0000 | |||
1439 | @@ -1,92 +0,0 @@ | |||
1440 | 1 | /* | ||
1441 | 2 | A library to allow applictions to provide simple indications of | ||
1442 | 3 | information to be displayed to users of the application through the | ||
1443 | 4 | interface shell. | ||
1444 | 5 | |||
1445 | 6 | Copyright 2009 Canonical Ltd. | ||
1446 | 7 | |||
1447 | 8 | Authors: | ||
1448 | 9 | Ted Gould <ted@canonical.com> | ||
1449 | 10 | |||
1450 | 11 | This program is free software: you can redistribute it and/or modify it | ||
1451 | 12 | under the terms of either or both of the following licenses: | ||
1452 | 13 | |||
1453 | 14 | 1) the GNU Lesser General Public License version 3, as published by the | ||
1454 | 15 | Free Software Foundation; and/or | ||
1455 | 16 | 2) the GNU Lesser General Public License version 2.1, as published by | ||
1456 | 17 | the Free Software Foundation. | ||
1457 | 18 | |||
1458 | 19 | This program is distributed in the hope that it will be useful, but | ||
1459 | 20 | WITHOUT ANY WARRANTY; without even the implied warranties of | ||
1460 | 21 | MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR | ||
1461 | 22 | PURPOSE. See the applicable version of the GNU Lesser General Public | ||
1462 | 23 | License for more details. | ||
1463 | 24 | |||
1464 | 25 | You should have received a copy of both the GNU Lesser General Public | ||
1465 | 26 | License version 3 and version 2.1 along with this program. If not, see | ||
1466 | 27 | <http://www.gnu.org/licenses/> | ||
1467 | 28 | */ | ||
1468 | 29 | |||
1469 | 30 | #ifndef __INDICATE_INDICATOR_MESSAGE_H__ | ||
1470 | 31 | #define __INDICATE_INDICATOR_MESSAGE_H__ | ||
1471 | 32 | |||
1472 | 33 | #include <glib.h> | ||
1473 | 34 | #include <glib-object.h> | ||
1474 | 35 | |||
1475 | 36 | #include "indicator.h" | ||
1476 | 37 | |||
1477 | 38 | G_BEGIN_DECLS | ||
1478 | 39 | |||
1479 | 40 | #define INDICATE_TYPE_INDICATOR_MESSAGE (indicate_indicator_message_get_type ()) | ||
1480 | 41 | #define INDICATE_INDICATOR_MESSAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), INDICATE_TYPE_INDICATOR_MESSAGE, IndicateIndicatorMessage)) | ||
1481 | 42 | #define INDICATE_INDICATOR_MESSAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), INDICATE_TYPE_INDICATOR_MESSAGE, IndicateIndicatorMessageClass)) | ||
1482 | 43 | #define INDICATE_IS_INDICATOR_MESSAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), INDICATE_TYPE_INDICATOR_MESSAGE)) | ||
1483 | 44 | #define INDICATE_IS_INDICATOR_MESSAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), INDICATE_TYPE_INDICATOR_MESSAGE)) | ||
1484 | 45 | #define INDICATE_INDICATOR_MESSAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), INDICATE_TYPE_INDICATOR_MESSAGE, IndicateIndicatorMessageClass)) | ||
1485 | 46 | |||
1486 | 47 | typedef struct _IndicateIndicatorMessage IndicateIndicatorMessage; | ||
1487 | 48 | typedef struct _IndicateIndicatorMessageClass IndicateIndicatorMessageClass; | ||
1488 | 49 | |||
1489 | 50 | /** | ||
1490 | 51 | IndicateIndicatorMessageClass: | ||
1491 | 52 | @parent_class: Parent Class | ||
1492 | 53 | |||
1493 | 54 | Subclass of #IndicateIndicator with no new functions or signals. | ||
1494 | 55 | */ | ||
1495 | 56 | struct _IndicateIndicatorMessageClass { | ||
1496 | 57 | IndicateIndicatorClass parent_class; | ||
1497 | 58 | }; | ||
1498 | 59 | |||
1499 | 60 | /** | ||
1500 | 61 | IndicateIndicatorMessage: | ||
1501 | 62 | |||
1502 | 63 | A class to represent indicators who's 'type' is "message". These | ||
1503 | 64 | are basically indicators that represent messages from humans to | ||
1504 | 65 | humans via computers. Things like instance messages, micro blogging | ||
1505 | 66 | entries or e-mails. All of these qualify as messages. | ||
1506 | 67 | |||
1507 | 68 | TODO: This should include a list of properties that are supported. | ||
1508 | 69 | */ | ||
1509 | 70 | struct _IndicateIndicatorMessage { | ||
1510 | 71 | IndicateIndicator parent; | ||
1511 | 72 | }; | ||
1512 | 73 | |||
1513 | 74 | GType indicate_indicator_message_get_type (void); | ||
1514 | 75 | IndicateIndicatorMessage * indicate_indicator_message_new (void); | ||
1515 | 76 | |||
1516 | 77 | /** | ||
1517 | 78 | SECTION:indicator-message | ||
1518 | 79 | @short_description: A representation of human generated messages | ||
1519 | 80 | @stability: Unstable | ||
1520 | 81 | @include: libindicate/indicator-message.h | ||
1521 | 82 | |||
1522 | 83 | The message indicators represent messages that come from humans | ||
1523 | 84 | to humans using computers. They come in all different forms with | ||
1524 | 85 | various different interaction protocols, but they all want the human | ||
1525 | 86 | at the computer to interact back with the human that sent the | ||
1526 | 87 | message. | ||
1527 | 88 | */ | ||
1528 | 89 | |||
1529 | 90 | G_END_DECLS | ||
1530 | 91 | |||
1531 | 92 | #endif | ||
1532 | 93 | 0 | ||
1533 | === added file 'libindicate/indicator-messages.h' | |||
1534 | --- libindicate/indicator-messages.h 1970-01-01 00:00:00 +0000 | |||
1535 | +++ libindicate/indicator-messages.h 2009-09-04 17:44:23 +0000 | |||
1536 | @@ -0,0 +1,40 @@ | |||
1537 | 1 | /* | ||
1538 | 2 | A library to allow applictions to provide simple indications of | ||
1539 | 3 | information to be displayed to users of the application through the | ||
1540 | 4 | interface shell. | ||
1541 | 5 | |||
1542 | 6 | Copyright 2009 Canonical Ltd. | ||
1543 | 7 | |||
1544 | 8 | Authors: | ||
1545 | 9 | Ted Gould <ted@canonical.com> | ||
1546 | 10 | |||
1547 | 11 | This program is free software: you can redistribute it and/or modify it | ||
1548 | 12 | under the terms of either or both of the following licenses: | ||
1549 | 13 | |||
1550 | 14 | 1) the GNU Lesser General Public License version 3, as published by the | ||
1551 | 15 | Free Software Foundation; and/or | ||
1552 | 16 | 2) the GNU Lesser General Public License version 2.1, as published by | ||
1553 | 17 | the Free Software Foundation. | ||
1554 | 18 | |||
1555 | 19 | This program is distributed in the hope that it will be useful, but | ||
1556 | 20 | WITHOUT ANY WARRANTY; without even the implied warranties of | ||
1557 | 21 | MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR | ||
1558 | 22 | PURPOSE. See the applicable version of the GNU Lesser General Public | ||
1559 | 23 | License for more details. | ||
1560 | 24 | |||
1561 | 25 | You should have received a copy of both the GNU Lesser General Public | ||
1562 | 26 | License version 3 and version 2.1 along with this program. If not, see | ||
1563 | 27 | <http://www.gnu.org/licenses/> | ||
1564 | 28 | */ | ||
1565 | 29 | |||
1566 | 30 | #ifndef INDICATE_INDICATOR_MESSAGES_H_INCLUDED__ | ||
1567 | 31 | #define INDICATE_INDICATOR_MESSAGES_H_INCLUDED__ 1 | ||
1568 | 32 | |||
1569 | 33 | #define INDICATE_INDICATOR_MESSAGES_PROP_NAME "name" | ||
1570 | 34 | #define INDICATE_INDICATOR_MESSAGES_PROP_ICON "icon" | ||
1571 | 35 | #define INDICATE_INDICATOR_MESSAGES_PROP_COUNT "count" | ||
1572 | 36 | #define INDICATE_INDICATOR_MESSAGES_PROP_TIME "time" | ||
1573 | 37 | #define INDICATE_INDICATOR_MESSAGES_PROP_ATTENTION "draw-attention" | ||
1574 | 38 | |||
1575 | 39 | |||
1576 | 40 | #endif /* INDICATE_INDICATOR_MESSAGES_H_INCLUDED__ */ | ||
1577 | 0 | 41 | ||
1578 | === modified file 'libindicate/indicator.c' | |||
1579 | --- libindicate/indicator.c 2009-08-06 13:57:57 +0000 | |||
1580 | +++ libindicate/indicator.c 2009-09-01 17:05:33 +0000 | |||
1581 | @@ -38,6 +38,7 @@ | |||
1582 | 38 | SHOW, | 38 | SHOW, |
1583 | 39 | USER_DISPLAY, | 39 | USER_DISPLAY, |
1584 | 40 | MODIFIED, | 40 | MODIFIED, |
1585 | 41 | DISPLAYED, | ||
1586 | 41 | LAST_SIGNAL | 42 | LAST_SIGNAL |
1587 | 42 | }; | 43 | }; |
1588 | 43 | 44 | ||
1589 | @@ -50,6 +51,7 @@ | |||
1590 | 50 | gboolean is_visible; | 51 | gboolean is_visible; |
1591 | 51 | IndicateServer * server; | 52 | IndicateServer * server; |
1592 | 52 | GHashTable * properties; | 53 | GHashTable * properties; |
1593 | 54 | gboolean is_displayed; | ||
1594 | 53 | }; | 55 | }; |
1595 | 54 | 56 | ||
1596 | 55 | #define INDICATE_INDICATOR_GET_PRIVATE(o) \ | 57 | #define INDICATE_INDICATOR_GET_PRIVATE(o) \ |
1597 | @@ -140,8 +142,23 @@ | |||
1598 | 140 | NULL, NULL, | 142 | NULL, NULL, |
1599 | 141 | g_cclosure_marshal_VOID__STRING, | 143 | g_cclosure_marshal_VOID__STRING, |
1600 | 142 | G_TYPE_NONE, 1, G_TYPE_STRING); | 144 | G_TYPE_NONE, 1, G_TYPE_STRING); |
1603 | 143 | 145 | /** | |
1604 | 144 | class->get_type = NULL; | 146 | IndicateIndicator::displayed: |
1605 | 147 | @arg0: The #IndicateIndicator object | ||
1606 | 148 | @arg1: Whether the indicator has been displayed | ||
1607 | 149 | |||
1608 | 150 | This is the signal that the indicator has been displayed, or | ||
1609 | 151 | hidden by a listener. In most cases, the signal will be that it | ||
1610 | 152 | has been displayed as most folks don't go hiding it later. | ||
1611 | 153 | */ | ||
1612 | 154 | signals[DISPLAYED] = g_signal_new(INDICATE_INDICATOR_SIGNAL_DISPLAYED, | ||
1613 | 155 | G_TYPE_FROM_CLASS(class), | ||
1614 | 156 | G_SIGNAL_RUN_LAST, | ||
1615 | 157 | G_STRUCT_OFFSET(IndicateIndicatorClass, displayed), | ||
1616 | 158 | NULL, NULL, | ||
1617 | 159 | g_cclosure_marshal_VOID__BOOLEAN, | ||
1618 | 160 | G_TYPE_NONE, 1, G_TYPE_BOOLEAN); | ||
1619 | 161 | |||
1620 | 145 | class->set_property = set_property; | 162 | class->set_property = set_property; |
1621 | 146 | class->get_property = get_property; | 163 | class->get_property = get_property; |
1622 | 147 | class->list_properties = list_properties; | 164 | class->list_properties = list_properties; |
1623 | @@ -156,6 +173,7 @@ | |||
1624 | 156 | IndicateIndicatorPrivate * priv = INDICATE_INDICATOR_GET_PRIVATE(indicator); | 173 | IndicateIndicatorPrivate * priv = INDICATE_INDICATOR_GET_PRIVATE(indicator); |
1625 | 157 | 174 | ||
1626 | 158 | priv->is_visible = FALSE; | 175 | priv->is_visible = FALSE; |
1627 | 176 | priv->is_displayed = FALSE; | ||
1628 | 159 | 177 | ||
1629 | 160 | priv->properties = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); | 178 | priv->properties = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); |
1630 | 161 | 179 | ||
1631 | @@ -301,6 +319,8 @@ | |||
1632 | 301 | 319 | ||
1633 | 302 | priv->is_visible = FALSE; | 320 | priv->is_visible = FALSE; |
1634 | 303 | g_signal_emit(indicator, signals[HIDE], 0, TRUE); | 321 | g_signal_emit(indicator, signals[HIDE], 0, TRUE); |
1635 | 322 | priv->is_displayed = FALSE; | ||
1636 | 323 | g_signal_emit(G_OBJECT(indicator), signals[DISPLAYED], 0, priv->is_displayed, TRUE); | ||
1637 | 304 | 324 | ||
1638 | 305 | return; | 325 | return; |
1639 | 306 | } | 326 | } |
1640 | @@ -339,28 +359,6 @@ | |||
1641 | 339 | } | 359 | } |
1642 | 340 | 360 | ||
1643 | 341 | /** | 361 | /** |
1644 | 342 | indicate_indicator_get_indicator_type: | ||
1645 | 343 | @indicator: a #IndicateIndicator to act on | ||
1646 | 344 | |||
1647 | 345 | Returns the type of @indicator. This is largely set by the subclass | ||
1648 | 346 | that the indicator was built with and should not be free'd. | ||
1649 | 347 | |||
1650 | 348 | Return value: A string defining the type or NULL for no type. | ||
1651 | 349 | */ | ||
1652 | 350 | const gchar * | ||
1653 | 351 | indicate_indicator_get_indicator_type (IndicateIndicator * indicator) | ||
1654 | 352 | { | ||
1655 | 353 | g_return_val_if_fail(INDICATE_IS_INDICATOR(indicator), NULL); | ||
1656 | 354 | IndicateIndicatorClass * class = INDICATE_INDICATOR_GET_CLASS(indicator); | ||
1657 | 355 | |||
1658 | 356 | if (class->get_type != NULL) { | ||
1659 | 357 | return INDICATE_INDICATOR_GET_CLASS(indicator)->get_type(indicator); | ||
1660 | 358 | } | ||
1661 | 359 | |||
1662 | 360 | return NULL; | ||
1663 | 361 | } | ||
1664 | 362 | |||
1665 | 363 | /** | ||
1666 | 364 | indicate_indicator_user_display: | 362 | indicate_indicator_user_display: |
1667 | 365 | @indicator: a #IndicateIndicator to act on | 363 | @indicator: a #IndicateIndicator to act on |
1668 | 366 | 364 | ||
1669 | @@ -451,8 +449,7 @@ | |||
1670 | 451 | @indicator: a #IndicateIndicator to act on | 449 | @indicator: a #IndicateIndicator to act on |
1671 | 452 | 450 | ||
1672 | 453 | This function gets a list of all the properties that exist | 451 | This function gets a list of all the properties that exist |
1675 | 454 | on a @indicator. The array may have zero entries but almost | 452 | on a @indicator. The array may have zero entries. |
1674 | 455 | always at least has 'type' in it. | ||
1676 | 456 | 453 | ||
1677 | 457 | Return value: An array of strings that is the keys of all | 454 | Return value: An array of strings that is the keys of all |
1678 | 458 | the properties on this indicator. | 455 | the properties on this indicator. |
1679 | @@ -473,11 +470,6 @@ | |||
1680 | 473 | { | 470 | { |
1681 | 474 | g_return_if_fail(INDICATE_IS_INDICATOR(indicator)); | 471 | g_return_if_fail(INDICATE_IS_INDICATOR(indicator)); |
1682 | 475 | 472 | ||
1683 | 476 | if (key != NULL && !g_strcmp0(key, "type")) { | ||
1684 | 477 | g_warning("Trying to set the 'type' of an indicator which should be done through subclassing."); | ||
1685 | 478 | return; | ||
1686 | 479 | } | ||
1687 | 480 | |||
1688 | 481 | IndicateIndicatorPrivate * priv = INDICATE_INDICATOR_GET_PRIVATE(indicator); | 473 | IndicateIndicatorPrivate * priv = INDICATE_INDICATOR_GET_PRIVATE(indicator); |
1689 | 482 | 474 | ||
1690 | 483 | gchar * current = g_hash_table_lookup(priv->properties, key); | 475 | gchar * current = g_hash_table_lookup(priv->properties, key); |
1691 | @@ -500,10 +492,6 @@ | |||
1692 | 500 | { | 492 | { |
1693 | 501 | g_return_val_if_fail(INDICATE_IS_INDICATOR(indicator), NULL); | 493 | g_return_val_if_fail(INDICATE_IS_INDICATOR(indicator), NULL); |
1694 | 502 | 494 | ||
1695 | 503 | if (key != NULL && !g_strcmp0(key, "type")) { | ||
1696 | 504 | return indicate_indicator_get_indicator_type(indicator); | ||
1697 | 505 | } | ||
1698 | 506 | |||
1699 | 507 | IndicateIndicatorPrivate * priv = INDICATE_INDICATOR_GET_PRIVATE(indicator); | 495 | IndicateIndicatorPrivate * priv = INDICATE_INDICATOR_GET_PRIVATE(indicator); |
1700 | 508 | 496 | ||
1701 | 509 | // TODO: Think about whether we should be strdup'ing this. Seems like overkill, but might not be. | 497 | // TODO: Think about whether we should be strdup'ing this. Seems like overkill, but might not be. |
1702 | @@ -519,10 +507,50 @@ | |||
1703 | 519 | GList * keys = g_hash_table_get_keys(priv->properties); | 507 | GList * keys = g_hash_table_get_keys(priv->properties); |
1704 | 520 | GPtrArray * properties = g_ptr_array_sized_new(g_list_length(keys) + 1); | 508 | GPtrArray * properties = g_ptr_array_sized_new(g_list_length(keys) + 1); |
1705 | 521 | 509 | ||
1706 | 522 | g_ptr_array_add(properties, g_strdup("type")); | ||
1707 | 523 | for (; keys != NULL; keys = keys->next) { | 510 | for (; keys != NULL; keys = keys->next) { |
1708 | 524 | g_ptr_array_add(properties, g_strdup(keys->data)); | 511 | g_ptr_array_add(properties, g_strdup(keys->data)); |
1709 | 525 | } | 512 | } |
1710 | 526 | 513 | ||
1711 | 527 | return properties; | 514 | return properties; |
1712 | 528 | } | 515 | } |
1713 | 516 | |||
1714 | 517 | /** | ||
1715 | 518 | indicate_indicator_set_displayed: | ||
1716 | 519 | @indicator: The #IndicateIndicator to configure | ||
1717 | 520 | @displayed: Whether or not the indicator is visible to users | ||
1718 | 521 | |||
1719 | 522 | Sets whether or not the indicator is visible to the user from | ||
1720 | 523 | a listener. This does not include things like whether the menu | ||
1721 | 524 | is open, but more whether it's in the menu to be found. | ||
1722 | 525 | */ | ||
1723 | 526 | void | ||
1724 | 527 | indicate_indicator_set_displayed (IndicateIndicator * indicator, gboolean displayed) | ||
1725 | 528 | { | ||
1726 | 529 | g_return_if_fail(INDICATE_IS_INDICATOR(indicator)); | ||
1727 | 530 | IndicateIndicatorPrivate * priv = INDICATE_INDICATOR_GET_PRIVATE(indicator); | ||
1728 | 531 | |||
1729 | 532 | if (priv->is_displayed != displayed) { | ||
1730 | 533 | priv->is_displayed = displayed; | ||
1731 | 534 | g_signal_emit(G_OBJECT(indicator), signals[DISPLAYED], 0, displayed, TRUE); | ||
1732 | 535 | } | ||
1733 | 536 | |||
1734 | 537 | return; | ||
1735 | 538 | } | ||
1736 | 539 | |||
1737 | 540 | /** | ||
1738 | 541 | indicate_indicator_get_displayed: | ||
1739 | 542 | @indicator: The #IndicateIndicator to query | ||
1740 | 543 | |||
1741 | 544 | Checks to see if the indicator is visible to users in some way. | ||
1742 | 545 | |||
1743 | 546 | Return value: Whether or not this indicator can be seen by a user | ||
1744 | 547 | or not. | ||
1745 | 548 | */ | ||
1746 | 549 | gboolean | ||
1747 | 550 | indicate_indicator_get_displayed (IndicateIndicator * indicator) | ||
1748 | 551 | { | ||
1749 | 552 | g_return_val_if_fail(INDICATE_IS_INDICATOR(indicator), FALSE); | ||
1750 | 553 | IndicateIndicatorPrivate * priv = INDICATE_INDICATOR_GET_PRIVATE(indicator); | ||
1751 | 554 | return priv->is_visible && priv->is_displayed; | ||
1752 | 555 | } | ||
1753 | 556 | |||
1754 | 529 | 557 | ||
1755 | === modified file 'libindicate/indicator.h' | |||
1756 | --- libindicate/indicator.h 2009-08-05 13:51:59 +0000 | |||
1757 | +++ libindicate/indicator.h 2009-08-31 21:26:29 +0000 | |||
1758 | @@ -46,10 +46,11 @@ | |||
1759 | 46 | /* This is a signal that signals to the indicator that the user | 46 | /* This is a signal that signals to the indicator that the user |
1760 | 47 | * has done an action where they'd like this indicator to be | 47 | * has done an action where they'd like this indicator to be |
1761 | 48 | * displayed. */ | 48 | * displayed. */ |
1765 | 49 | #define INDICATE_INDICATOR_SIGNAL_HIDE "hide" | 49 | #define INDICATE_INDICATOR_SIGNAL_HIDE "hide" |
1766 | 50 | #define INDICATE_INDICATOR_SIGNAL_SHOW "show" | 50 | #define INDICATE_INDICATOR_SIGNAL_SHOW "show" |
1767 | 51 | #define INDICATE_INDICATOR_SIGNAL_DISPLAY "user-display" | 51 | #define INDICATE_INDICATOR_SIGNAL_DISPLAY "user-display" |
1768 | 52 | #define INDICATE_INDICATOR_SIGNAL_MODIFIED "modified" | 52 | #define INDICATE_INDICATOR_SIGNAL_MODIFIED "modified" |
1769 | 53 | #define INDICATE_INDICATOR_SIGNAL_DISPLAYED "displayed" | ||
1770 | 53 | 54 | ||
1771 | 54 | typedef struct _IndicateIndicator IndicateIndicator; | 55 | typedef struct _IndicateIndicator IndicateIndicator; |
1772 | 55 | typedef struct _IndicateIndicatorClass IndicateIndicatorClass; | 56 | typedef struct _IndicateIndicatorClass IndicateIndicatorClass; |
1773 | @@ -75,9 +76,7 @@ | |||
1774 | 75 | @show: Slot for #IndicateIndicator::show. | 76 | @show: Slot for #IndicateIndicator::show. |
1775 | 76 | @user_display: Slot for #IndicateIndicator::user-display. | 77 | @user_display: Slot for #IndicateIndicator::user-display. |
1776 | 77 | @modified: Slot for #IndicateIndicator::modified. | 78 | @modified: Slot for #IndicateIndicator::modified. |
1780 | 78 | @get_type: Returns a constant string for the type of this indicator. | 79 | @displayed: Slot for #IndicateIndicator::displayed. |
1778 | 79 | Typically gets overridden by subclasses and defines the type of | ||
1779 | 80 | the indicator. Is called by indicate_indicator_get_indicator_type(). | ||
1781 | 81 | @set_property: Called when indicate_indicator_set_property() is called | 80 | @set_property: Called when indicate_indicator_set_property() is called |
1782 | 82 | and should set the value. While typically it is overridden by | 81 | and should set the value. While typically it is overridden by |
1783 | 83 | subclasses they usually handle special properties themselves and | 82 | subclasses they usually handle special properties themselves and |
1784 | @@ -87,6 +86,10 @@ | |||
1785 | 87 | @list_properties: Called when indicate_indicator_list_properties() is called | 86 | @list_properties: Called when indicate_indicator_list_properties() is called |
1786 | 88 | and returns a list of the properties available. Again this can be | 87 | and returns a list of the properties available. Again this can be |
1787 | 89 | overridden by subclasses to handle special properties. | 88 | overridden by subclasses to handle special properties. |
1788 | 89 | @indicate_indicator_reserved1: Reserved for future use | ||
1789 | 90 | @indicate_indicator_reserved2: Reserved for future use | ||
1790 | 91 | @indicate_indicator_reserved3: Reserved for future use | ||
1791 | 92 | @indicate_indicator_reserved4: Reserved for future use | ||
1792 | 90 | 93 | ||
1793 | 91 | All of the functions that are used to modify or change data that is | 94 | All of the functions that are used to modify or change data that is |
1794 | 92 | in the indicator. Typically gets subclassed by other types of | 95 | in the indicator. Typically gets subclassed by other types of |
1795 | @@ -94,17 +97,26 @@ | |||
1796 | 94 | 97 | ||
1797 | 95 | */ | 98 | */ |
1798 | 96 | struct _IndicateIndicatorClass { | 99 | struct _IndicateIndicatorClass { |
1799 | 100 | /* Parents */ | ||
1800 | 97 | GObjectClass parent_class; | 101 | GObjectClass parent_class; |
1801 | 98 | 102 | ||
1802 | 103 | /* Signals */ | ||
1803 | 99 | void (*hide) (IndicateIndicator * indicator, gpointer data); | 104 | void (*hide) (IndicateIndicator * indicator, gpointer data); |
1804 | 100 | void (*show) (IndicateIndicator * indicator, gpointer data); | 105 | void (*show) (IndicateIndicator * indicator, gpointer data); |
1805 | 101 | void (*user_display) (IndicateIndicator * indicator, gpointer data); | 106 | void (*user_display) (IndicateIndicator * indicator, gpointer data); |
1806 | 102 | void (*modified) (IndicateIndicator * indicator, gchar * property, gpointer data); | 107 | void (*modified) (IndicateIndicator * indicator, gchar * property, gpointer data); |
1807 | 108 | void (*displayed) (IndicateIndicator * indicator, gboolean displayed); | ||
1808 | 103 | 109 | ||
1810 | 104 | const gchar * (*get_type) (IndicateIndicator * indicator); | 110 | /* Subclassable functions */ |
1811 | 105 | void (*set_property) (IndicateIndicator * indicator, const gchar * key, const gchar * data); | 111 | void (*set_property) (IndicateIndicator * indicator, const gchar * key, const gchar * data); |
1812 | 106 | const gchar * (*get_property) (IndicateIndicator * indicator, const gchar * key); | 112 | const gchar * (*get_property) (IndicateIndicator * indicator, const gchar * key); |
1813 | 107 | GPtrArray * (*list_properties) (IndicateIndicator * indicator); | 113 | GPtrArray * (*list_properties) (IndicateIndicator * indicator); |
1814 | 114 | |||
1815 | 115 | /* Reserver for future use */ | ||
1816 | 116 | void (*indicate_indicator_reserved1)(void); | ||
1817 | 117 | void (*indicate_indicator_reserved2)(void); | ||
1818 | 118 | void (*indicate_indicator_reserved3)(void); | ||
1819 | 119 | void (*indicate_indicator_reserved4)(void); | ||
1820 | 108 | }; | 120 | }; |
1821 | 109 | 121 | ||
1822 | 110 | GType indicate_indicator_get_type(void) G_GNUC_CONST; | 122 | GType indicate_indicator_get_type(void) G_GNUC_CONST; |
1823 | @@ -125,10 +137,6 @@ | |||
1824 | 125 | /* Every entry has an ID, here's how to get it */ | 137 | /* Every entry has an ID, here's how to get it */ |
1825 | 126 | guint indicate_indicator_get_id (IndicateIndicator * indicator); | 138 | guint indicate_indicator_get_id (IndicateIndicator * indicator); |
1826 | 127 | 139 | ||
1827 | 128 | /* Every entry has a type. This should be created by the | ||
1828 | 129 | * subclass and exported through this pretty function */ | ||
1829 | 130 | const gchar * indicate_indicator_get_indicator_type (IndicateIndicator * indicator); | ||
1830 | 131 | |||
1831 | 132 | void indicate_indicator_user_display (IndicateIndicator * indicator); | 140 | void indicate_indicator_user_display (IndicateIndicator * indicator); |
1832 | 133 | 141 | ||
1833 | 134 | /* Properties handling */ | 142 | /* Properties handling */ |
1834 | @@ -137,6 +145,10 @@ | |||
1835 | 137 | const gchar * indicate_indicator_get_property (IndicateIndicator * indicator, const gchar * key); | 145 | const gchar * indicate_indicator_get_property (IndicateIndicator * indicator, const gchar * key); |
1836 | 138 | GPtrArray * indicate_indicator_list_properties (IndicateIndicator * indicator); | 146 | GPtrArray * indicate_indicator_list_properties (IndicateIndicator * indicator); |
1837 | 139 | 147 | ||
1838 | 148 | /* Controling whether it's displayed */ | ||
1839 | 149 | void indicate_indicator_set_displayed (IndicateIndicator * indicator, gboolean displayed); | ||
1840 | 150 | gboolean indicate_indicator_get_displayed (IndicateIndicator * indicator); | ||
1841 | 151 | |||
1842 | 140 | /** | 152 | /** |
1843 | 141 | SECTION:indicator | 153 | SECTION:indicator |
1844 | 142 | @short_description: A representation of state for applications | 154 | @short_description: A representation of state for applications |
1845 | @@ -144,7 +156,7 @@ | |||
1846 | 144 | @include: libindicate/indicator.h | 156 | @include: libindicate/indicator.h |
1847 | 145 | 157 | ||
1848 | 146 | An indicator is designed to represent a single instance of something | 158 | An indicator is designed to represent a single instance of something |
1850 | 147 | in your application. So this might be an IM or Email using #IndicateIndicatorMessage | 159 | in your application. So this might be an IM or an e-mail mail box |
1851 | 148 | or any other thing that is a small unit of information to pass on | 160 | or any other thing that is a small unit of information to pass on |
1852 | 149 | to the user. | 161 | to the user. |
1853 | 150 | 162 | ||
1854 | @@ -154,12 +166,7 @@ | |||
1855 | 154 | on the indicator to provide enough information for the listener | 166 | on the indicator to provide enough information for the listener |
1856 | 155 | to do that. | 167 | to do that. |
1857 | 156 | 168 | ||
1864 | 157 | Mostly this is done through properties. The only property that is | 169 | Mostly this is done through properties. |
1859 | 158 | defined for the base indicator is the 'type' property. And this | ||
1860 | 159 | is only available to set by creating a subclass of the | ||
1861 | 160 | #IndicateIndicator object. It is assumed that you can look at the | ||
1862 | 161 | definitions of the various subtypes to determine which properties | ||
1863 | 162 | they support. | ||
1865 | 163 | 170 | ||
1866 | 164 | It may be that some users don't want to create objects for every | 171 | It may be that some users don't want to create objects for every |
1867 | 165 | indicator as it could be a lot of overhead if there are large numbers | 172 | indicator as it could be a lot of overhead if there are large numbers |
1868 | 166 | 173 | ||
1869 | === modified file 'libindicate/listener-marshal.list' | |||
1870 | --- libindicate/listener-marshal.list 2009-04-10 09:51:16 +0000 | |||
1871 | +++ libindicate/listener-marshal.list 2009-09-05 04:24:47 +0000 | |||
1872 | @@ -28,8 +28,10 @@ | |||
1873 | 28 | # IndicatorAdded, IndicatorRemoved, IndicatorModified | 28 | # IndicatorAdded, IndicatorRemoved, IndicatorModified |
1874 | 29 | VOID:UINT,STRING | 29 | VOID:UINT,STRING |
1875 | 30 | # Local indicator_added, indicator_removed | 30 | # Local indicator_added, indicator_removed |
1876 | 31 | VOID:POINTER,POINTER | ||
1877 | 32 | # Local indicator_modified | ||
1878 | 31 | VOID:POINTER,POINTER,STRING | 33 | VOID:POINTER,POINTER,STRING |
1879 | 32 | # Local indicator_modified | ||
1880 | 33 | VOID:POINTER,POINTER,STRING,STRING | ||
1881 | 34 | # Local server_added and server_removed | 34 | # Local server_added and server_removed |
1882 | 35 | VOID:POINTER,STRING | 35 | VOID:POINTER,STRING |
1883 | 36 | # Local server_count_changed | ||
1884 | 37 | VOID:POINTER,UINT | ||
1885 | 36 | 38 | ||
1886 | === modified file 'libindicate/listener-private.h' | |||
1887 | --- libindicate/listener-private.h 2009-08-03 22:31:00 +0000 | |||
1888 | +++ libindicate/listener-private.h 2009-08-28 21:59:26 +0000 | |||
1889 | @@ -35,6 +35,7 @@ | |||
1890 | 35 | DBusGProxy * proxy; | 35 | DBusGProxy * proxy; |
1891 | 36 | DBusGConnection * connection; | 36 | DBusGConnection * connection; |
1892 | 37 | gboolean interests[INDICATE_INTEREST_LAST]; | 37 | gboolean interests[INDICATE_INTEREST_LAST]; |
1893 | 38 | gint max_indicators; | ||
1894 | 38 | }; | 39 | }; |
1895 | 39 | 40 | ||
1896 | 40 | struct _IndicateListenerIndicator { | 41 | struct _IndicateListenerIndicator { |
1897 | @@ -55,6 +56,8 @@ | |||
1898 | 55 | 56 | ||
1899 | 56 | GArray * proxy_todo; | 57 | GArray * proxy_todo; |
1900 | 57 | guint todo_idle; | 58 | guint todo_idle; |
1901 | 59 | |||
1902 | 60 | gint max_indicators; | ||
1903 | 58 | }; | 61 | }; |
1904 | 59 | 62 | ||
1905 | 60 | #define INDICATE_LISTENER_GET_PRIVATE(o) \ | 63 | #define INDICATE_LISTENER_GET_PRIVATE(o) \ |
1906 | 61 | 64 | ||
1907 | === modified file 'libindicate/listener.c' | |||
1908 | --- libindicate/listener.c 2009-08-03 22:31:00 +0000 | |||
1909 | +++ libindicate/listener.c 2009-09-08 22:01:57 +0000 | |||
1910 | @@ -49,6 +49,7 @@ | |||
1911 | 49 | INDICATOR_MODIFIED, | 49 | INDICATOR_MODIFIED, |
1912 | 50 | SERVER_ADDED, | 50 | SERVER_ADDED, |
1913 | 51 | SERVER_REMOVED, | 51 | SERVER_REMOVED, |
1914 | 52 | SERVER_COUNT_CHANGED, | ||
1915 | 52 | LAST_SIGNAL | 53 | LAST_SIGNAL |
1916 | 53 | }; | 54 | }; |
1917 | 54 | 55 | ||
1918 | @@ -98,13 +99,14 @@ | |||
1919 | 98 | static void todo_list_add (const gchar * name, DBusGProxy * proxy, IndicateListener * listener, gboolean startup); | 99 | static void todo_list_add (const gchar * name, DBusGProxy * proxy, IndicateListener * listener, gboolean startup); |
1920 | 99 | static gboolean todo_idle (gpointer data); | 100 | static gboolean todo_idle (gpointer data); |
1921 | 100 | static void get_type_cb (IndicateListener * listener, IndicateListenerServer * server, gchar * type, gpointer data); | 101 | static void get_type_cb (IndicateListener * listener, IndicateListenerServer * server, gchar * type, gpointer data); |
1922 | 102 | static void proxy_indicator_added_legacy (DBusGProxy * proxy, guint id, gchar * type, proxy_t * proxyt); | ||
1923 | 101 | static void proxy_server_added (DBusGProxy * proxy, const gchar * type, proxy_t * proxyt); | 103 | static void proxy_server_added (DBusGProxy * proxy, const gchar * type, proxy_t * proxyt); |
1927 | 102 | static void proxy_indicator_added (DBusGProxy * proxy, guint id, const gchar * type, proxy_t * proxyt); | 104 | static void proxy_indicator_added (DBusGProxy * proxy, guint id, proxy_t * proxyt); |
1928 | 103 | static void proxy_indicator_removed (DBusGProxy * proxy, guint id, const gchar * type, proxy_t * proxyt); | 105 | static void proxy_indicator_removed_legacy (DBusGProxy * proxy, guint id, gchar * type, proxy_t * proxyt); |
1929 | 104 | static void proxy_indicator_modified (DBusGProxy * proxy, guint id, const gchar * type, proxy_t * proxyt); | 106 | static void proxy_indicator_removed (DBusGProxy * proxy, guint id, proxy_t * proxyt); |
1930 | 107 | static void proxy_indicator_modified (DBusGProxy * proxy, guint id, const gchar * property, proxy_t * proxyt); | ||
1931 | 108 | static void proxy_server_count_changed (DBusGProxy * proxy, guint count, proxy_t * proxyt); | ||
1932 | 105 | static void proxy_get_indicator_list (DBusGProxy * proxy, GArray * indicators, GError * error, gpointer data); | 109 | static void proxy_get_indicator_list (DBusGProxy * proxy, GArray * indicators, GError * error, gpointer data); |
1933 | 106 | static void proxy_get_indicator_type (DBusGProxy * proxy, gchar * type, GError * error, gpointer data); | ||
1934 | 107 | static void proxy_indicators_free (gpointer data); | ||
1935 | 108 | static void introspect_this (DBusGProxy * proxy, char * OUT_data, GError * error, gpointer data); | 110 | static void introspect_this (DBusGProxy * proxy, char * OUT_data, GError * error, gpointer data); |
1936 | 109 | 111 | ||
1937 | 110 | /* DBus interface */ | 112 | /* DBus interface */ |
1938 | @@ -130,22 +132,22 @@ | |||
1939 | 130 | G_SIGNAL_RUN_LAST, | 132 | G_SIGNAL_RUN_LAST, |
1940 | 131 | G_STRUCT_OFFSET (IndicateListenerClass, indicator_added), | 133 | G_STRUCT_OFFSET (IndicateListenerClass, indicator_added), |
1941 | 132 | NULL, NULL, | 134 | NULL, NULL, |
1944 | 133 | _indicate_listener_marshal_VOID__POINTER_POINTER_STRING, | 135 | _indicate_listener_marshal_VOID__POINTER_POINTER, |
1945 | 134 | G_TYPE_NONE, 3, INDICATE_TYPE_LISTENER_SERVER, INDICATE_TYPE_LISTENER_INDICATOR, G_TYPE_STRING); | 136 | G_TYPE_NONE, 2, INDICATE_TYPE_LISTENER_SERVER, INDICATE_TYPE_LISTENER_INDICATOR); |
1946 | 135 | signals[INDICATOR_REMOVED] = g_signal_new(INDICATE_LISTENER_SIGNAL_INDICATOR_REMOVED, | 137 | signals[INDICATOR_REMOVED] = g_signal_new(INDICATE_LISTENER_SIGNAL_INDICATOR_REMOVED, |
1947 | 136 | G_TYPE_FROM_CLASS (class), | 138 | G_TYPE_FROM_CLASS (class), |
1948 | 137 | G_SIGNAL_RUN_LAST, | 139 | G_SIGNAL_RUN_LAST, |
1949 | 138 | G_STRUCT_OFFSET (IndicateListenerClass, indicator_removed), | 140 | G_STRUCT_OFFSET (IndicateListenerClass, indicator_removed), |
1950 | 139 | NULL, NULL, | 141 | NULL, NULL, |
1953 | 140 | _indicate_listener_marshal_VOID__POINTER_POINTER_STRING, | 142 | _indicate_listener_marshal_VOID__POINTER_POINTER, |
1954 | 141 | G_TYPE_NONE, 3, INDICATE_TYPE_LISTENER_SERVER, INDICATE_TYPE_LISTENER_INDICATOR, G_TYPE_STRING); | 143 | G_TYPE_NONE, 2, INDICATE_TYPE_LISTENER_SERVER, INDICATE_TYPE_LISTENER_INDICATOR); |
1955 | 142 | signals[INDICATOR_MODIFIED] = g_signal_new(INDICATE_LISTENER_SIGNAL_INDICATOR_MODIFIED, | 144 | signals[INDICATOR_MODIFIED] = g_signal_new(INDICATE_LISTENER_SIGNAL_INDICATOR_MODIFIED, |
1956 | 143 | G_TYPE_FROM_CLASS (class), | 145 | G_TYPE_FROM_CLASS (class), |
1957 | 144 | G_SIGNAL_RUN_LAST, | 146 | G_SIGNAL_RUN_LAST, |
1958 | 145 | G_STRUCT_OFFSET (IndicateListenerClass, indicator_modified), | 147 | G_STRUCT_OFFSET (IndicateListenerClass, indicator_modified), |
1959 | 146 | NULL, NULL, | 148 | NULL, NULL, |
1962 | 147 | _indicate_listener_marshal_VOID__POINTER_POINTER_STRING_STRING, | 149 | _indicate_listener_marshal_VOID__POINTER_POINTER_STRING, |
1963 | 148 | G_TYPE_NONE, 4, INDICATE_TYPE_LISTENER_SERVER, INDICATE_TYPE_LISTENER_INDICATOR, G_TYPE_STRING, G_TYPE_STRING); | 150 | G_TYPE_NONE, 3, INDICATE_TYPE_LISTENER_SERVER, INDICATE_TYPE_LISTENER_INDICATOR, G_TYPE_STRING); |
1964 | 149 | signals[SERVER_ADDED] = g_signal_new(INDICATE_LISTENER_SIGNAL_SERVER_ADDED, | 151 | signals[SERVER_ADDED] = g_signal_new(INDICATE_LISTENER_SIGNAL_SERVER_ADDED, |
1965 | 150 | G_TYPE_FROM_CLASS (class), | 152 | G_TYPE_FROM_CLASS (class), |
1966 | 151 | G_SIGNAL_RUN_LAST, | 153 | G_SIGNAL_RUN_LAST, |
1967 | @@ -160,6 +162,13 @@ | |||
1968 | 160 | NULL, NULL, | 162 | NULL, NULL, |
1969 | 161 | _indicate_listener_marshal_VOID__POINTER_STRING, | 163 | _indicate_listener_marshal_VOID__POINTER_STRING, |
1970 | 162 | G_TYPE_NONE, 2, INDICATE_TYPE_LISTENER_SERVER, G_TYPE_STRING); | 164 | G_TYPE_NONE, 2, INDICATE_TYPE_LISTENER_SERVER, G_TYPE_STRING); |
1971 | 165 | signals[SERVER_COUNT_CHANGED] = g_signal_new(INDICATE_LISTENER_SIGNAL_SERVER_COUNT_CHANGED, | ||
1972 | 166 | G_TYPE_FROM_CLASS (class), | ||
1973 | 167 | G_SIGNAL_RUN_LAST, | ||
1974 | 168 | G_STRUCT_OFFSET (IndicateListenerClass, server_count_changed), | ||
1975 | 169 | NULL, NULL, | ||
1976 | 170 | _indicate_listener_marshal_VOID__POINTER_UINT, | ||
1977 | 171 | G_TYPE_NONE, 2, INDICATE_TYPE_LISTENER_SERVER, G_TYPE_UINT); | ||
1978 | 163 | 172 | ||
1979 | 164 | dbus_g_object_register_marshaller(_indicate_listener_marshal_VOID__UINT_STRING, | 173 | dbus_g_object_register_marshaller(_indicate_listener_marshal_VOID__UINT_STRING, |
1980 | 165 | G_TYPE_NONE, | 174 | G_TYPE_NONE, |
1981 | @@ -235,6 +244,8 @@ | |||
1982 | 235 | priv->proxy_todo = g_array_new(FALSE, TRUE, sizeof(proxy_todo_t)); | 244 | priv->proxy_todo = g_array_new(FALSE, TRUE, sizeof(proxy_todo_t)); |
1983 | 236 | priv->todo_idle = 0; | 245 | priv->todo_idle = 0; |
1984 | 237 | 246 | ||
1985 | 247 | priv->max_indicators = -1; | ||
1986 | 248 | |||
1987 | 238 | /* WARNING */ | 249 | /* WARNING */ |
1988 | 239 | /* Starting massive asynchronisity */ | 250 | /* Starting massive asynchronisity */ |
1989 | 240 | /* */ | 251 | /* */ |
1990 | @@ -290,11 +301,15 @@ | |||
1991 | 290 | return default_indicate_listener; | 301 | return default_indicate_listener; |
1992 | 291 | } | 302 | } |
1993 | 292 | 303 | ||
1994 | 304 | /* Function to track when people get on and off the bus. It's the | ||
1995 | 305 | same function for both system and session buses so it needs to | ||
1996 | 306 | figure which one it's on. */ | ||
1997 | 293 | static void | 307 | static void |
1998 | 294 | dbus_owner_change (DBusGProxy * proxy, const gchar * name, const gchar * prev, const gchar * new, IndicateListener * listener) | 308 | dbus_owner_change (DBusGProxy * proxy, const gchar * name, const gchar * prev, const gchar * new, IndicateListener * listener) |
1999 | 295 | { | 309 | { |
2000 | 296 | IndicateListenerPrivate * priv = INDICATE_LISTENER_GET_PRIVATE(listener); | 310 | IndicateListenerPrivate * priv = INDICATE_LISTENER_GET_PRIVATE(listener); |
2001 | 297 | 311 | ||
2002 | 312 | /* Figure out which bus we are. */ | ||
2003 | 298 | DBusGConnection * bus; | 313 | DBusGConnection * bus; |
2004 | 299 | gchar * bus_name; | 314 | gchar * bus_name; |
2005 | 300 | if (proxy == priv->dbus_proxy_system) { | 315 | if (proxy == priv->dbus_proxy_system) { |
2006 | @@ -307,9 +322,15 @@ | |||
2007 | 307 | 322 | ||
2008 | 308 | /* g_debug("Name change on %s bus: '%s' from '%s' to '%s'", bus_name, name, prev, new); */ | 323 | /* g_debug("Name change on %s bus: '%s' from '%s' to '%s'", bus_name, name, prev, new); */ |
2009 | 309 | 324 | ||
2010 | 325 | /* If someone is getting on the bus we add them to the | ||
2011 | 326 | todo list to see if they come up with something interesting */ | ||
2012 | 310 | if (prev != NULL && prev[0] == '\0') { | 327 | if (prev != NULL && prev[0] == '\0') { |
2013 | 311 | todo_list_add(name, proxy, listener, FALSE); | 328 | todo_list_add(name, proxy, listener, FALSE); |
2014 | 312 | } | 329 | } |
2015 | 330 | |||
2016 | 331 | /* If they're leaving the bus we need to figure out if we | ||
2017 | 332 | were tracking them or not, and remove them from the | ||
2018 | 333 | appropriate lists. */ | ||
2019 | 313 | if (new != NULL && new[0] == '\0') { | 334 | if (new != NULL && new[0] == '\0') { |
2020 | 314 | proxy_t searchitem; | 335 | proxy_t searchitem; |
2021 | 315 | searchitem.connection = bus; | 336 | searchitem.connection = bus; |
2022 | @@ -334,19 +355,11 @@ | |||
2023 | 334 | static void | 355 | static void |
2024 | 335 | proxy_struct_destroy_indicators (gpointer key, gpointer value, gpointer data) | 356 | proxy_struct_destroy_indicators (gpointer key, gpointer value, gpointer data) |
2025 | 336 | { | 357 | { |
2029 | 337 | gchar * type = (gchar *)key; | 358 | proxy_t * proxy_data = (proxy_t *)data; |
2027 | 338 | GHashTable * indicators = (GHashTable *)value; | ||
2028 | 339 | proxy_t * proxy_data = data; | ||
2030 | 340 | 359 | ||
2036 | 341 | GList * keys = g_hash_table_get_keys(indicators); | 360 | if (value) { |
2037 | 342 | GList * indicator; | 361 | g_signal_emit(proxy_data->listener, signals[INDICATOR_REMOVED], 0, &proxy_data->server, GUINT_TO_POINTER(key), TRUE); |
2033 | 343 | for (indicator = keys; indicator != NULL; indicator = indicator->next) { | ||
2034 | 344 | guint id = (guint)indicator->data; | ||
2035 | 345 | g_signal_emit(proxy_data->listener, signals[INDICATOR_REMOVED], 0, &proxy_data->server, GUINT_TO_POINTER(id), type, TRUE); | ||
2038 | 346 | } | 362 | } |
2039 | 347 | g_list_free(keys); | ||
2040 | 348 | |||
2041 | 349 | g_hash_table_remove_all(indicators); | ||
2042 | 350 | return; | 363 | return; |
2043 | 351 | } | 364 | } |
2044 | 352 | 365 | ||
2045 | @@ -360,7 +373,7 @@ | |||
2046 | 360 | g_hash_table_foreach(proxy_data->indicators, | 373 | g_hash_table_foreach(proxy_data->indicators, |
2047 | 361 | proxy_struct_destroy_indicators, | 374 | proxy_struct_destroy_indicators, |
2048 | 362 | proxy_data); | 375 | proxy_data); |
2050 | 363 | g_hash_table_remove_all(proxy_data->indicators); | 376 | g_hash_table_destroy(proxy_data->indicators); |
2051 | 364 | 377 | ||
2052 | 365 | g_signal_emit(proxy_data->listener, signals[SERVER_REMOVED], 0, &proxy_data->server, proxy_data->type, TRUE); | 378 | g_signal_emit(proxy_data->listener, signals[SERVER_REMOVED], 0, &proxy_data->server, proxy_data->type, TRUE); |
2053 | 366 | proxy_data->indicators = NULL; | 379 | proxy_data->indicators = NULL; |
2054 | @@ -470,6 +483,7 @@ | |||
2055 | 470 | proxyt->server.name = todo->name; | 483 | proxyt->server.name = todo->name; |
2056 | 471 | proxyt->server.proxy = proxyt->proxy; | 484 | proxyt->server.proxy = proxyt->proxy; |
2057 | 472 | proxyt->server.connection = proxyt->connection; | 485 | proxyt->server.connection = proxyt->connection; |
2058 | 486 | proxyt->server.max_indicators = priv->max_indicators; | ||
2059 | 473 | 487 | ||
2060 | 474 | priv->proxy_todo = g_array_remove_index(priv->proxy_todo, priv->proxy_todo->len - 1); | 488 | priv->proxy_todo = g_array_remove_index(priv->proxy_todo, priv->proxy_todo->len - 1); |
2061 | 475 | 489 | ||
2062 | @@ -509,11 +523,21 @@ | |||
2063 | 509 | return; | 523 | return; |
2064 | 510 | } | 524 | } |
2065 | 511 | 525 | ||
2070 | 512 | typedef struct { | 526 | /* A call back from setting the max indicators. We really can't |
2071 | 513 | guint id; | 527 | do anything about it, so this function is kinda useless. */ |
2072 | 514 | proxy_t * proxyt; | 528 | void |
2073 | 515 | } indicator_type_t; | 529 | set_max_indicators_cb (DBusGProxy * proxy, GError * error, gpointer userdata) |
2074 | 530 | { | ||
2075 | 531 | if (error != NULL) { | ||
2076 | 532 | g_warning("Unable to set the max indicators on '%s': %s", (gchar *)userdata, error->message); | ||
2077 | 533 | g_error_free(error); | ||
2078 | 534 | } | ||
2079 | 535 | return; | ||
2080 | 536 | } | ||
2081 | 516 | 537 | ||
2082 | 538 | /* Callback from the call to get the indicator list on new | ||
2083 | 539 | servers that we've found through introspection. It takes | ||
2084 | 540 | the list and then calls indicator_added on each one. */ | ||
2085 | 517 | static void | 541 | static void |
2086 | 518 | proxy_get_indicator_list (DBusGProxy * proxy, GArray * indicators, GError * error, gpointer data) | 542 | proxy_get_indicator_list (DBusGProxy * proxy, GArray * indicators, GError * error, gpointer data) |
2087 | 519 | { | 543 | { |
2088 | @@ -525,42 +549,31 @@ | |||
2089 | 525 | 549 | ||
2090 | 526 | int i; | 550 | int i; |
2091 | 527 | for (i = 0; i < indicators->len; i++) { | 551 | for (i = 0; i < indicators->len; i++) { |
2097 | 528 | indicator_type_t * itt = g_new(indicator_type_t, 1); | 552 | guint id = g_array_index(indicators, guint, i); |
2098 | 529 | itt->id = g_array_index(indicators, guint, i); | 553 | proxy_indicator_added(proxy, id, proxyt); |
2094 | 530 | itt->proxyt = proxyt; | ||
2095 | 531 | |||
2096 | 532 | org_freedesktop_indicator_get_indicator_property_async(proxyt->proxy, itt->id, "type", proxy_get_indicator_type, itt); | ||
2099 | 533 | } | 554 | } |
2100 | 534 | 555 | ||
2101 | 535 | return; | 556 | return; |
2102 | 536 | } | 557 | } |
2103 | 537 | 558 | ||
2121 | 538 | static void | 559 | /* Function called on the ServerShow signal from the bus, which is |
2122 | 539 | proxy_get_indicator_type (DBusGProxy * proxy, gchar * type, GError * error, gpointer data) | 560 | usually when a DBus client says that they have some indicators |
2123 | 540 | { | 561 | that we could be interested in. Also, this function is called |
2124 | 541 | if (error != NULL) { | 562 | in the discovery phase of starting up a new listener if we find |
2125 | 542 | g_warning("Get Indicator Type returned error: %s", error->message); | 563 | some indicators on the client. */ |
2109 | 543 | return; | ||
2110 | 544 | } | ||
2111 | 545 | |||
2112 | 546 | indicator_type_t * itt = (indicator_type_t *)data; | ||
2113 | 547 | guint id = itt->id; | ||
2114 | 548 | proxy_t * proxyt = itt->proxyt; | ||
2115 | 549 | |||
2116 | 550 | g_free(itt); | ||
2117 | 551 | |||
2118 | 552 | return proxy_indicator_added(proxy, id, type, proxyt); | ||
2119 | 553 | } | ||
2120 | 554 | |||
2126 | 555 | static void | 564 | static void |
2127 | 556 | proxy_server_added (DBusGProxy * proxy, const gchar * type, proxy_t * proxyt) | 565 | proxy_server_added (DBusGProxy * proxy, const gchar * type, proxy_t * proxyt) |
2128 | 557 | { | 566 | { |
2129 | 567 | g_debug("Proxy Server Added"); | ||
2130 | 568 | /* Check to see if we have an indicators table. If we | ||
2131 | 569 | do this function's probably already been run. If not | ||
2132 | 570 | we need to trick this server out. */ | ||
2133 | 558 | if (proxyt->indicators == NULL) { | 571 | if (proxyt->indicators == NULL) { |
2137 | 559 | proxyt->indicators = g_hash_table_new_full(g_str_hash, g_str_equal, | 572 | proxyt->indicators = g_hash_table_new(g_direct_hash, g_direct_equal); |
2138 | 560 | g_free, proxy_indicators_free); | 573 | |
2136 | 561 | /* Elevate to working */ | ||
2139 | 562 | IndicateListenerPrivate * priv = INDICATE_LISTENER_GET_PRIVATE(proxyt->listener); | 574 | IndicateListenerPrivate * priv = INDICATE_LISTENER_GET_PRIVATE(proxyt->listener); |
2140 | 563 | 575 | ||
2141 | 576 | /* Move the proxy from 'possible' to 'working'. */ | ||
2142 | 564 | GList * proxyt_item; | 577 | GList * proxyt_item; |
2143 | 565 | proxyt_item = g_list_find_custom(priv->proxies_possible, proxyt, proxy_t_equal); | 578 | proxyt_item = g_list_find_custom(priv->proxies_possible, proxyt, proxy_t_equal); |
2144 | 566 | if (proxyt_item != NULL) { | 579 | if (proxyt_item != NULL) { |
2145 | @@ -568,19 +581,35 @@ | |||
2146 | 568 | } | 581 | } |
2147 | 569 | priv->proxies_working = g_list_prepend(priv->proxies_working, proxyt); | 582 | priv->proxies_working = g_list_prepend(priv->proxies_working, proxyt); |
2148 | 570 | 583 | ||
2149 | 584 | /* Connect to all the indicator based signals | ||
2150 | 585 | that are coming from this server */ | ||
2151 | 571 | dbus_g_proxy_add_signal(proxyt->proxy, "IndicatorAdded", | 586 | dbus_g_proxy_add_signal(proxyt->proxy, "IndicatorAdded", |
2152 | 572 | G_TYPE_UINT, G_TYPE_STRING, G_TYPE_INVALID); | 587 | G_TYPE_UINT, G_TYPE_STRING, G_TYPE_INVALID); |
2153 | 573 | dbus_g_proxy_connect_signal(proxyt->proxy, "IndicatorAdded", | 588 | dbus_g_proxy_connect_signal(proxyt->proxy, "IndicatorAdded", |
2154 | 589 | G_CALLBACK(proxy_indicator_added_legacy), proxyt, NULL); | ||
2155 | 590 | dbus_g_proxy_add_signal(proxyt->proxy, "IndicatorNew", | ||
2156 | 591 | G_TYPE_UINT, G_TYPE_INVALID); | ||
2157 | 592 | dbus_g_proxy_connect_signal(proxyt->proxy, "IndicatorNew", | ||
2158 | 574 | G_CALLBACK(proxy_indicator_added), proxyt, NULL); | 593 | G_CALLBACK(proxy_indicator_added), proxyt, NULL); |
2159 | 575 | dbus_g_proxy_add_signal(proxyt->proxy, "IndicatorRemoved", | 594 | dbus_g_proxy_add_signal(proxyt->proxy, "IndicatorRemoved", |
2160 | 576 | G_TYPE_UINT, G_TYPE_STRING, G_TYPE_INVALID); | 595 | G_TYPE_UINT, G_TYPE_STRING, G_TYPE_INVALID); |
2161 | 577 | dbus_g_proxy_connect_signal(proxyt->proxy, "IndicatorRemoved", | 596 | dbus_g_proxy_connect_signal(proxyt->proxy, "IndicatorRemoved", |
2162 | 597 | G_CALLBACK(proxy_indicator_removed_legacy), proxyt, NULL); | ||
2163 | 598 | dbus_g_proxy_add_signal(proxyt->proxy, "IndicatorDelete", | ||
2164 | 599 | G_TYPE_UINT, G_TYPE_INVALID); | ||
2165 | 600 | dbus_g_proxy_connect_signal(proxyt->proxy, "IndicatorDelete", | ||
2166 | 578 | G_CALLBACK(proxy_indicator_removed), proxyt, NULL); | 601 | G_CALLBACK(proxy_indicator_removed), proxyt, NULL); |
2167 | 579 | dbus_g_proxy_add_signal(proxyt->proxy, "IndicatorModified", | 602 | dbus_g_proxy_add_signal(proxyt->proxy, "IndicatorModified", |
2168 | 580 | G_TYPE_UINT, G_TYPE_STRING, G_TYPE_INVALID); | 603 | G_TYPE_UINT, G_TYPE_STRING, G_TYPE_INVALID); |
2169 | 581 | dbus_g_proxy_connect_signal(proxyt->proxy, "IndicatorModified", | 604 | dbus_g_proxy_connect_signal(proxyt->proxy, "IndicatorModified", |
2170 | 582 | G_CALLBACK(proxy_indicator_modified), proxyt, NULL); | 605 | G_CALLBACK(proxy_indicator_modified), proxyt, NULL); |
2171 | 606 | dbus_g_proxy_add_signal(proxyt->proxy, "ServerCountChanged", | ||
2172 | 607 | G_TYPE_UINT, G_TYPE_INVALID); | ||
2173 | 608 | dbus_g_proxy_connect_signal(proxyt->proxy, "ServerCountChanged", | ||
2174 | 609 | G_CALLBACK(proxy_server_count_changed), proxyt, NULL); | ||
2175 | 583 | 610 | ||
2176 | 611 | /* If we've got a type let it override the type | ||
2177 | 612 | we had here before */ | ||
2178 | 584 | if (type != NULL) { | 613 | if (type != NULL) { |
2179 | 585 | if (proxyt->type != NULL) { | 614 | if (proxyt->type != NULL) { |
2180 | 586 | g_free(proxyt->type); | 615 | g_free(proxyt->type); |
2181 | @@ -588,102 +617,125 @@ | |||
2182 | 588 | proxyt->type = g_strdup(type); | 617 | proxyt->type = g_strdup(type); |
2183 | 589 | } | 618 | } |
2184 | 590 | 619 | ||
2185 | 620 | /* We're setting the max number of indicators from the default | ||
2186 | 621 | when we detect it. This should give a reasonable amount of | ||
2187 | 622 | time for listeners to set the default if they want something | ||
2188 | 623 | different from infinite. Otherwise it'd be easy to miss the | ||
2189 | 624 | first couple. */ | ||
2190 | 625 | proxyt->server.max_indicators = priv->max_indicators; | ||
2191 | 626 | if (proxyt->server.max_indicators != -1) { | ||
2192 | 627 | org_freedesktop_indicator_set_max_indicators_async(proxyt->proxy, proxyt->server.max_indicators, set_max_indicators_cb, proxyt->name); | ||
2193 | 628 | } | ||
2194 | 629 | |||
2195 | 630 | /* Signal to clients of the listener that there's a new | ||
2196 | 631 | server. Note the server parameter here is the pointer | ||
2197 | 632 | to the server struct in the proxy data structure. */ | ||
2198 | 591 | g_signal_emit(proxyt->listener, signals[SERVER_ADDED], 0, &proxyt->server, proxyt->type, TRUE); | 633 | g_signal_emit(proxyt->listener, signals[SERVER_ADDED], 0, &proxyt->server, proxyt->type, TRUE); |
2199 | 592 | } | 634 | } |
2200 | 593 | 635 | ||
2201 | 594 | return; | 636 | return; |
2202 | 595 | } | 637 | } |
2203 | 596 | 638 | ||
2207 | 597 | static void | 639 | /* A fun little wrapper so that we can support the |
2208 | 598 | proxy_indicator_added (DBusGProxy * proxy, guint id, const gchar * type, proxy_t * proxyt) | 640 | signals on the indicator v1 interface. It just drops |
2209 | 599 | { | 641 | the type and calls the new function. */ |
2210 | 642 | static void | ||
2211 | 643 | proxy_indicator_added_legacy (DBusGProxy * proxy, guint id, gchar * type, proxy_t * proxyt) | ||
2212 | 644 | { | ||
2213 | 645 | return proxy_indicator_added(proxy, id, proxyt); | ||
2214 | 646 | } | ||
2215 | 647 | |||
2216 | 648 | /* Gets called when we get a signal from the server that | ||
2217 | 649 | there is a new indicator. We put it into our list of | ||
2218 | 650 | indicators and pass the signal up. If the server hasn't | ||
2219 | 651 | been known about before, we create the appropriate | ||
2220 | 652 | structures for it. */ | ||
2221 | 653 | static void | ||
2222 | 654 | proxy_indicator_added (DBusGProxy * proxy, guint id, proxy_t * proxyt) | ||
2223 | 655 | { | ||
2224 | 656 | g_debug("Proxy Indicator Added"); | ||
2225 | 657 | g_return_if_fail(proxyt != NULL); | ||
2226 | 658 | |||
2227 | 600 | if (proxyt->indicators == NULL) { | 659 | if (proxyt->indicators == NULL) { |
2228 | 601 | proxy_server_added (proxy, NULL, proxyt); | 660 | proxy_server_added (proxy, NULL, proxyt); |
2229 | 602 | } | 661 | } |
2230 | 603 | 662 | ||
2241 | 604 | GHashTable * indicators = g_hash_table_lookup(proxyt->indicators, type); | 663 | if (!g_hash_table_lookup(proxyt->indicators, GUINT_TO_POINTER(id))) { |
2242 | 605 | 664 | g_hash_table_insert(proxyt->indicators, GUINT_TO_POINTER(id), GUINT_TO_POINTER(TRUE)); | |
2243 | 606 | if (indicators == NULL) { | 665 | g_signal_emit(proxyt->listener, signals[INDICATOR_ADDED], 0, &proxyt->server, GUINT_TO_POINTER(id), TRUE); |
2234 | 607 | indicators = g_hash_table_new(g_direct_hash, g_direct_equal); | ||
2235 | 608 | g_hash_table_insert(proxyt->indicators, g_strdup(type), indicators); | ||
2236 | 609 | } | ||
2237 | 610 | |||
2238 | 611 | if (!g_hash_table_lookup(indicators, (gpointer)id)) { | ||
2239 | 612 | g_hash_table_insert(indicators, (gpointer)id, (gpointer)TRUE); | ||
2240 | 613 | g_signal_emit(proxyt->listener, signals[INDICATOR_ADDED], 0, &proxyt->server, GUINT_TO_POINTER(id), type, TRUE); | ||
2244 | 614 | } | 666 | } |
2245 | 615 | 667 | ||
2246 | 616 | return; | 668 | return; |
2247 | 617 | } | 669 | } |
2248 | 618 | 670 | ||
2252 | 619 | static void | 671 | /* A fun little wrapper so that we can support the |
2253 | 620 | proxy_indicator_removed (DBusGProxy * proxy, guint id, const gchar * type, proxy_t * proxyt) | 672 | signals on the indicator v1 interface. It just drops |
2254 | 621 | { | 673 | the type and calls the new function. */ |
2255 | 674 | static void | ||
2256 | 675 | proxy_indicator_removed_legacy (DBusGProxy * proxy, guint id, gchar * type, proxy_t * proxyt) | ||
2257 | 676 | { | ||
2258 | 677 | return proxy_indicator_removed(proxy, id, proxyt); | ||
2259 | 678 | } | ||
2260 | 679 | |||
2261 | 680 | /* A server removed an indicator. This function removes all the | ||
2262 | 681 | local data structures and then passes the signal up the stack. | ||
2263 | 682 | */ | ||
2264 | 683 | static void | ||
2265 | 684 | proxy_indicator_removed (DBusGProxy * proxy, guint id, proxy_t * proxyt) | ||
2266 | 685 | { | ||
2267 | 686 | g_debug("Proxy Indicator Removed"); | ||
2268 | 687 | g_return_if_fail(proxyt != NULL); | ||
2269 | 688 | |||
2270 | 622 | if (proxyt->indicators == NULL) { | 689 | if (proxyt->indicators == NULL) { |
2271 | 623 | g_warning("Oddly we had an indicator removed from an interface that we didn't think had indicators."); | 690 | g_warning("Oddly we had an indicator removed from an interface that we didn't think had indicators."); |
2272 | 624 | return; | 691 | return; |
2273 | 625 | } | 692 | } |
2274 | 626 | 693 | ||
2288 | 627 | GHashTable * indicators = g_hash_table_lookup(proxyt->indicators, type); | 694 | if (!g_hash_table_lookup(proxyt->indicators, GUINT_TO_POINTER(id))) { |
2289 | 628 | if (indicators == NULL) { | 695 | g_warning("No indicator %d on '%s'.", id, proxyt->name); |
2290 | 629 | g_warning("Can not remove indicator %d of type '%s' as there are no indicators of that type on %s.", id, type, proxyt->name); | 696 | return; |
2291 | 630 | return; | 697 | } |
2292 | 631 | } | 698 | |
2293 | 632 | 699 | g_hash_table_remove(proxyt->indicators, GUINT_TO_POINTER(id)); | |
2294 | 633 | if (!g_hash_table_lookup(indicators, (gpointer)id)) { | 700 | g_signal_emit(proxyt->listener, signals[INDICATOR_REMOVED], 0, &proxyt->server, GUINT_TO_POINTER(id), TRUE); |
2282 | 634 | g_warning("No indicator %d of type '%s' on '%s'.", id, type, proxyt->name); | ||
2283 | 635 | return; | ||
2284 | 636 | } | ||
2285 | 637 | |||
2286 | 638 | g_hash_table_remove(indicators, (gpointer)id); | ||
2287 | 639 | g_signal_emit(proxyt->listener, signals[INDICATOR_REMOVED], 0, &proxyt->server, GUINT_TO_POINTER(id), type, TRUE); | ||
2295 | 640 | 701 | ||
2296 | 641 | return; | 702 | return; |
2297 | 642 | } | 703 | } |
2298 | 643 | 704 | ||
2299 | 705 | /* This is a signal from the server that a property on an indicator | ||
2300 | 706 | has been modified. We try and find the indicator, convert all | ||
2301 | 707 | the parameters to the local ones, and then pass up the signal. */ | ||
2302 | 644 | static void | 708 | static void |
2303 | 645 | proxy_indicator_modified (DBusGProxy * proxy, guint id, const gchar * property, proxy_t * proxyt) | 709 | proxy_indicator_modified (DBusGProxy * proxy, guint id, const gchar * property, proxy_t * proxyt) |
2304 | 646 | { | 710 | { |
2305 | 711 | g_debug("Proxy Indicator Modified"); | ||
2306 | 712 | g_return_if_fail(proxyt != NULL); | ||
2307 | 713 | |||
2308 | 647 | if (proxyt->indicators == NULL) { | 714 | if (proxyt->indicators == NULL) { |
2309 | 648 | g_warning("Oddly we had an indicator modified from an interface that we didn't think had indicators."); | 715 | g_warning("Oddly we had an indicator modified from an interface that we didn't think had indicators."); |
2310 | 649 | return; | 716 | return; |
2311 | 650 | } | 717 | } |
2312 | 651 | 718 | ||
2329 | 652 | GList * keys = g_hash_table_get_keys(proxyt->indicators); | 719 | if (!g_hash_table_lookup(proxyt->indicators, GUINT_TO_POINTER(id))) { |
2314 | 653 | GList * inc = NULL; | ||
2315 | 654 | gchar * type; | ||
2316 | 655 | |||
2317 | 656 | for (inc = g_list_first(keys); inc != NULL; inc = g_list_next(inc)) { | ||
2318 | 657 | type = (gchar *)inc->data; | ||
2319 | 658 | |||
2320 | 659 | GHashTable * indicators = g_hash_table_lookup(proxyt->indicators, type); | ||
2321 | 660 | if (indicators == NULL) continue; /* no indicators for this type? Odd, but not an error */ | ||
2322 | 661 | |||
2323 | 662 | if (g_hash_table_lookup(indicators, (gpointer)id)) { | ||
2324 | 663 | break; | ||
2325 | 664 | } | ||
2326 | 665 | } | ||
2327 | 666 | |||
2328 | 667 | if (inc == NULL) { | ||
2330 | 668 | g_warning("Can not modify indicator %d with property '%s' as there are no indicators with that id on %s.", id, property, proxyt->name); | 720 | g_warning("Can not modify indicator %d with property '%s' as there are no indicators with that id on %s.", id, property, proxyt->name); |
2331 | 669 | return; | 721 | return; |
2332 | 670 | } | 722 | } |
2333 | 671 | 723 | ||
2335 | 672 | g_signal_emit(proxyt->listener, signals[INDICATOR_MODIFIED], 0, &proxyt->server, GUINT_TO_POINTER(id), type, property, TRUE); | 724 | g_signal_emit(proxyt->listener, signals[INDICATOR_MODIFIED], 0, &proxyt->server, GUINT_TO_POINTER(id), property, TRUE); |
2336 | 673 | 725 | ||
2337 | 674 | return; | 726 | return; |
2338 | 675 | } | 727 | } |
2339 | 676 | 728 | ||
2340 | 729 | /* This function gets called when the dbus count | ||
2341 | 730 | signal comes it. Basically we're just translating | ||
2342 | 731 | it into a local signal with the appropraite parameters | ||
2343 | 732 | and structures. */ | ||
2344 | 677 | static void | 733 | static void |
2346 | 678 | proxy_indicators_free (gpointer data) | 734 | proxy_server_count_changed (DBusGProxy * proxy, guint count, proxy_t * proxyt) |
2347 | 679 | { | 735 | { |
2355 | 680 | GHashTable * table = (GHashTable *)data; | 736 | g_debug("Proxy Server Count Changed"); |
2356 | 681 | 737 | g_return_if_fail(proxyt != NULL); | |
2357 | 682 | if (g_hash_table_size(table) != 0) { | 738 | g_signal_emit(proxyt->listener, signals[SERVER_COUNT_CHANGED], 0, &proxyt->server, count, TRUE); |
2351 | 683 | g_warning("Clearning a set of indicators that wasn't signaled!"); | ||
2352 | 684 | } | ||
2353 | 685 | |||
2354 | 686 | g_hash_table_unref(table); | ||
2358 | 687 | return; | 739 | return; |
2359 | 688 | } | 740 | } |
2360 | 689 | 741 | ||
2361 | @@ -742,7 +794,7 @@ | |||
2362 | 742 | { | 794 | { |
2363 | 743 | /* g_debug("get_property_helper: %s %d", property, prop_type); */ | 795 | /* g_debug("get_property_helper: %s %d", property, prop_type); */ |
2364 | 744 | /* TODO: Do we need to somehow refcount the server/indicator while we're waiting on this? */ | 796 | /* TODO: Do we need to somehow refcount the server/indicator while we're waiting on this? */ |
2366 | 745 | get_property_t * get_property_data = g_new(get_property_t, 1); | 797 | get_property_t * get_property_data = g_new0(get_property_t, 1); |
2367 | 746 | get_property_data->cb = callback; | 798 | get_property_data->cb = callback; |
2368 | 747 | get_property_data->data = data; | 799 | get_property_data->data = data; |
2369 | 748 | get_property_data->listener = listener; | 800 | get_property_data->listener = listener; |
2370 | @@ -774,6 +826,8 @@ | |||
2371 | 774 | return TRUE; | 826 | return TRUE; |
2372 | 775 | } | 827 | } |
2373 | 776 | 828 | ||
2374 | 829 | /* A callback for asking an indicator to be displayed, | ||
2375 | 830 | which is unlikely to fail. So we're throwing a warning. */ | ||
2376 | 777 | static void | 831 | static void |
2377 | 778 | listener_display_cb (DBusGProxy *proxy, GError *error, gpointer userdata) | 832 | listener_display_cb (DBusGProxy *proxy, GError *error, gpointer userdata) |
2378 | 779 | { | 833 | { |
2379 | @@ -791,13 +845,57 @@ | |||
2380 | 791 | return; | 845 | return; |
2381 | 792 | } | 846 | } |
2382 | 793 | 847 | ||
2383 | 848 | /* A callback for saying an indicator is displayed, | ||
2384 | 849 | which is unlikely to fail. So we're throwing a warning. */ | ||
2385 | 850 | static void | ||
2386 | 851 | listener_displayed_cb (DBusGProxy *proxy, GError *error, gpointer userdata) | ||
2387 | 852 | { | ||
2388 | 853 | if (error != NULL) { | ||
2389 | 854 | g_warning("Listener displayed caused an error: %s", error->message); | ||
2390 | 855 | } | ||
2391 | 856 | return; | ||
2392 | 857 | } | ||
2393 | 858 | |||
2394 | 859 | /** | ||
2395 | 860 | indicate_listener_displayed: | ||
2396 | 861 | @listener: The #IndicateListener representing the connection | ||
2397 | 862 | @server: The server that the indicator is on | ||
2398 | 863 | @indicator: Which indicator is being displayed | ||
2399 | 864 | @displayed: Whether it's being displayed or hidden | ||
2400 | 865 | |||
2401 | 866 | This function tells the client whether we're showing this indicator | ||
2402 | 867 | to the user. This doesn't mean that it's necissarilly visible right | ||
2403 | 868 | now, but more that there is a way for the user to get to this item | ||
2404 | 869 | individually. | ||
2405 | 870 | */ | ||
2406 | 871 | void | ||
2407 | 872 | indicate_listener_displayed (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gboolean displayed) | ||
2408 | 873 | { | ||
2409 | 874 | org_freedesktop_indicator_indicator_displayed_async (server->proxy, | ||
2410 | 875 | INDICATE_LISTENER_INDICATOR_ID(indicator), | ||
2411 | 876 | displayed, | ||
2412 | 877 | listener_displayed_cb, | ||
2413 | 878 | NULL); | ||
2414 | 879 | |||
2415 | 880 | if (!server->interests[INDICATE_INTEREST_INDICATOR_DISPLAY] && displayed) { | ||
2416 | 881 | g_warning("It's awful odd that you said in the interest survey you weren't displaying indicators and then you displayed one. I'm just saying, you've probably confused someone besides me."); | ||
2417 | 882 | } | ||
2418 | 883 | |||
2419 | 884 | return; | ||
2420 | 885 | } | ||
2421 | 886 | |||
2422 | 794 | typedef struct { | 887 | typedef struct { |
2423 | 795 | IndicateListener * listener; | 888 | IndicateListener * listener; |
2424 | 796 | IndicateListenerServer * server; | 889 | IndicateListenerServer * server; |
2425 | 797 | indicate_listener_get_server_property_cb cb; | 890 | indicate_listener_get_server_property_cb cb; |
2426 | 891 | indicate_listener_get_server_uint_property_cb cb_uint; | ||
2427 | 798 | gpointer data; | 892 | gpointer data; |
2428 | 799 | } property_cb_t; | 893 | } property_cb_t; |
2429 | 800 | 894 | ||
2430 | 895 | /* A callback from getting the property off of the server | ||
2431 | 896 | which unravels the property_cb_t structure that was passed | ||
2432 | 897 | as data and calls back the call back that was in it with | ||
2433 | 898 | the appropriate data, also unrolled. */ | ||
2434 | 801 | static void | 899 | static void |
2435 | 802 | property_cb (DBusGProxy * proxy, DBusGProxyCall * call, void * data) | 900 | property_cb (DBusGProxy * proxy, DBusGProxyCall * call, void * data) |
2436 | 803 | { | 901 | { |
2437 | @@ -807,6 +905,9 @@ | |||
2438 | 807 | 905 | ||
2439 | 808 | GValue property = {0}; | 906 | GValue property = {0}; |
2440 | 809 | 907 | ||
2441 | 908 | /* Finish the call and get our value. There might | ||
2442 | 909 | be an error as if someone was using v1 API and | ||
2443 | 910 | not v2. Let's handle that early. */ | ||
2444 | 810 | dbus_g_proxy_end_call(proxy, call, &error, G_TYPE_VALUE, &property, G_TYPE_INVALID); | 911 | dbus_g_proxy_end_call(proxy, call, &error, G_TYPE_VALUE, &property, G_TYPE_INVALID); |
2445 | 811 | if (error != NULL) { | 912 | if (error != NULL) { |
2446 | 812 | /* g_warning("Unable to get property: %s", error->message); */ | 913 | /* g_warning("Unable to get property: %s", error->message); */ |
2447 | @@ -815,28 +916,42 @@ | |||
2448 | 815 | return; | 916 | return; |
2449 | 816 | } | 917 | } |
2450 | 817 | 918 | ||
2457 | 818 | if (!G_VALUE_HOLDS_STRING(&property)) { | 919 | /* Dup all the values and make them local so that |
2458 | 819 | g_warning("Property returned is not a string!"); | 920 | we can free up the data structure to make the |
2459 | 820 | g_free(propertyt); | 921 | rest of the code easier to read. */ |
2454 | 821 | return; | ||
2455 | 822 | } | ||
2456 | 823 | |||
2460 | 824 | IndicateListener * listener = propertyt->listener; | 922 | IndicateListener * listener = propertyt->listener; |
2461 | 825 | IndicateListenerServer * server = propertyt->server; | 923 | IndicateListenerServer * server = propertyt->server; |
2462 | 826 | indicate_listener_get_server_property_cb cb = propertyt->cb; | 924 | indicate_listener_get_server_property_cb cb = propertyt->cb; |
2463 | 925 | indicate_listener_get_server_uint_property_cb cb_uint = propertyt->cb_uint; | ||
2464 | 827 | gpointer cb_data = propertyt->data; | 926 | gpointer cb_data = propertyt->data; |
2465 | 828 | 927 | ||
2466 | 829 | g_free(propertyt); | 928 | g_free(propertyt); |
2467 | 830 | 929 | ||
2473 | 831 | gchar * propstr = g_value_dup_string(&property); | 930 | if (G_VALUE_HOLDS_STRING(&property) && cb != NULL) { |
2474 | 832 | 931 | /* If it's got a string, and we have a value for that | |
2475 | 833 | /* g_debug("\tProperty value: %s", propstr); */ | 932 | we'll get the string out and call the call back */ |
2476 | 834 | 933 | gchar * propstr = g_value_dup_string(&property); | |
2477 | 835 | return cb(listener, server, propstr, cb_data); | 934 | return cb(listener, server, propstr, cb_data); |
2478 | 935 | } else if (G_VALUE_HOLDS_UINT(&property) && cb_uint != NULL) { | ||
2479 | 936 | /* If it's got a UINT and we have a callback for that | ||
2480 | 937 | let's grab the value and call the callback. */ | ||
2481 | 938 | guint val = g_value_get_uint(&property); | ||
2482 | 939 | return cb_uint(listener, server, val, cb_data); | ||
2483 | 940 | } else { | ||
2484 | 941 | /* WTF!?!?!?! */ | ||
2485 | 942 | g_warning("Property back from server that we didn't understand."); | ||
2486 | 943 | } | ||
2487 | 944 | |||
2488 | 945 | return; | ||
2489 | 836 | } | 946 | } |
2490 | 837 | 947 | ||
2491 | 948 | /* This is a helper function for all the functions that | ||
2492 | 949 | get properties from the server. They all need to have | ||
2493 | 950 | a callback setup with an intermediary data structure | ||
2494 | 951 | and this function builds and populates that, then uses | ||
2495 | 952 | a custom callback to call their callback */ | ||
2496 | 838 | static void | 953 | static void |
2498 | 839 | get_server_property (IndicateListener * listener, IndicateListenerServer * server, indicate_listener_get_server_property_cb callback, const gchar * property_name, gpointer data) | 954 | get_server_property (IndicateListener * listener, IndicateListenerServer * server, indicate_listener_get_server_property_cb callback, indicate_listener_get_server_uint_property_cb callback_uint, const gchar * property_name, gpointer data) |
2499 | 840 | { | 955 | { |
2500 | 841 | /* g_debug("Setting up callback for property %s on %s", property_name, INDICATE_LISTENER_SERVER_DBUS_NAME(server)); */ | 956 | /* g_debug("Setting up callback for property %s on %s", property_name, INDICATE_LISTENER_SERVER_DBUS_NAME(server)); */ |
2501 | 842 | IndicateListenerPrivate * priv = INDICATE_LISTENER_GET_PRIVATE(listener); | 957 | IndicateListenerPrivate * priv = INDICATE_LISTENER_GET_PRIVATE(listener); |
2502 | @@ -864,10 +979,11 @@ | |||
2503 | 864 | DBUS_INTERFACE_PROPERTIES); | 979 | DBUS_INTERFACE_PROPERTIES); |
2504 | 865 | } | 980 | } |
2505 | 866 | 981 | ||
2507 | 867 | property_cb_t * localdata = g_new(property_cb_t, 1); | 982 | property_cb_t * localdata = g_new0(property_cb_t, 1); |
2508 | 868 | localdata->listener = listener; | 983 | localdata->listener = listener; |
2509 | 869 | localdata->server = server; | 984 | localdata->server = server; |
2510 | 870 | localdata->cb = callback; | 985 | localdata->cb = callback; |
2511 | 986 | localdata->cb_uint = callback_uint; | ||
2512 | 871 | localdata->data = data; | 987 | localdata->data = data; |
2513 | 872 | 988 | ||
2514 | 873 | dbus_g_proxy_begin_call (proxyt->property_proxy, | 989 | dbus_g_proxy_begin_call (proxyt->property_proxy, |
2515 | @@ -885,13 +1001,19 @@ | |||
2516 | 885 | void | 1001 | void |
2517 | 886 | indicate_listener_server_get_type (IndicateListener * listener, IndicateListenerServer * server, indicate_listener_get_server_property_cb callback, gpointer data) | 1002 | indicate_listener_server_get_type (IndicateListener * listener, IndicateListenerServer * server, indicate_listener_get_server_property_cb callback, gpointer data) |
2518 | 887 | { | 1003 | { |
2520 | 888 | return get_server_property(listener, server, callback, "type", data); | 1004 | return get_server_property(listener, server, callback, NULL, "type", data); |
2521 | 889 | } | 1005 | } |
2522 | 890 | 1006 | ||
2523 | 891 | void | 1007 | void |
2524 | 892 | indicate_listener_server_get_desktop (IndicateListener * listener, IndicateListenerServer * server, indicate_listener_get_server_property_cb callback, gpointer data) | 1008 | indicate_listener_server_get_desktop (IndicateListener * listener, IndicateListenerServer * server, indicate_listener_get_server_property_cb callback, gpointer data) |
2525 | 893 | { | 1009 | { |
2527 | 894 | return get_server_property(listener, server, callback, "desktop", data); | 1010 | return get_server_property(listener, server, callback, NULL, "desktop", data); |
2528 | 1011 | } | ||
2529 | 1012 | |||
2530 | 1013 | void | ||
2531 | 1014 | indicate_listener_server_get_count (IndicateListener * listener, IndicateListenerServer * server, indicate_listener_get_server_uint_property_cb callback, gpointer data) | ||
2532 | 1015 | { | ||
2533 | 1016 | return get_server_property(listener, server, NULL, callback, "count", data); | ||
2534 | 895 | } | 1017 | } |
2535 | 896 | 1018 | ||
2536 | 897 | const gchar * | 1019 | const gchar * |
2537 | @@ -1015,7 +1137,7 @@ | |||
2538 | 1015 | 1137 | ||
2539 | 1016 | /* Check for root being "node" */ | 1138 | /* Check for root being "node" */ |
2540 | 1017 | xmlNodePtr root = xmlDocGetRootElement(xmldoc); | 1139 | xmlNodePtr root = xmlDocGetRootElement(xmldoc); |
2542 | 1018 | if (g_strcmp0(root->name, "node") != 0) { | 1140 | if (g_strcmp0((gchar *)root->name, "node") != 0) { |
2543 | 1019 | xmlFreeDoc(xmldoc); | 1141 | xmlFreeDoc(xmldoc); |
2544 | 1020 | g_warning("Introspection data from %s is not valid: %s", server->name, OUT_data); | 1142 | g_warning("Introspection data from %s is not valid: %s", server->name, OUT_data); |
2545 | 1021 | return; | 1143 | return; |
2546 | @@ -1038,12 +1160,12 @@ | |||
2547 | 1038 | xmlNodePtr children; | 1160 | xmlNodePtr children; |
2548 | 1039 | for (children = root->children; children != NULL; children = children->next) { | 1161 | for (children = root->children; children != NULL; children = children->next) { |
2549 | 1040 | gchar * xmlnameval = NULL; | 1162 | gchar * xmlnameval = NULL; |
2551 | 1041 | if (g_strcmp0(children->name, nodename) == 0) { | 1163 | if (g_strcmp0((gchar *)children->name, nodename) == 0) { |
2552 | 1042 | xmlAttrPtr attrib; | 1164 | xmlAttrPtr attrib; |
2553 | 1043 | for (attrib = children->properties; attrib != NULL; attrib = attrib->next) { | 1165 | for (attrib = children->properties; attrib != NULL; attrib = attrib->next) { |
2555 | 1044 | if (g_strcmp0(attrib->name, "name") == 0) { | 1166 | if (g_strcmp0((gchar *)attrib->name, "name") == 0) { |
2556 | 1045 | if (attrib->children != NULL) { | 1167 | if (attrib->children != NULL) { |
2558 | 1046 | xmlnameval = attrib->children->content; | 1168 | xmlnameval = (gchar *)attrib->children->content; |
2559 | 1047 | } | 1169 | } |
2560 | 1048 | break; | 1170 | break; |
2561 | 1049 | } | 1171 | } |
2562 | @@ -1082,3 +1204,50 @@ | |||
2563 | 1082 | 1204 | ||
2564 | 1083 | return; | 1205 | return; |
2565 | 1084 | } | 1206 | } |
2566 | 1207 | |||
2567 | 1208 | /** | ||
2568 | 1209 | indicate_listener_set_default_max_indicators: | ||
2569 | 1210 | @listener: Instance of #IndicateListener to set on. | ||
2570 | 1211 | @max: The new default number of max indicators. | ||
2571 | 1212 | |||
2572 | 1213 | This function sets the number that is given to new servers | ||
2573 | 1214 | when they start for the max number of indicators that you want | ||
2574 | 1215 | to see. The client should enforce this number. | ||
2575 | 1216 | |||
2576 | 1217 | Note: This function WILL NOT reconfigure already recognized | ||
2577 | 1218 | servers. It only affects new servers. | ||
2578 | 1219 | */ | ||
2579 | 1220 | void | ||
2580 | 1221 | indicate_listener_set_default_max_indicators (IndicateListener * listener, gint max) | ||
2581 | 1222 | { | ||
2582 | 1223 | g_return_if_fail(INDICATE_IS_LISTENER(listener)); | ||
2583 | 1224 | IndicateListenerPrivate * priv = INDICATE_LISTENER_GET_PRIVATE(listener); | ||
2584 | 1225 | priv->max_indicators = max; | ||
2585 | 1226 | return; | ||
2586 | 1227 | } | ||
2587 | 1228 | |||
2588 | 1229 | /** | ||
2589 | 1230 | indicate_listener_set_server_max_indicators: | ||
2590 | 1231 | @listener: Instance of #IndicateListener to set on. | ||
2591 | 1232 | @server: Server that the new max should be set on. | ||
2592 | 1233 | @max: The new number of max indicators. | ||
2593 | 1234 | |||
2594 | 1235 | This function changes the max number of indicators that | ||
2595 | 1236 | a server should send. If the number is different than the | ||
2596 | 1237 | previous number a signal will be sent to the application to | ||
2597 | 1238 | adjust then number of indicators that they have. This is | ||
2598 | 1239 | sent asynchronously. | ||
2599 | 1240 | */ | ||
2600 | 1241 | void | ||
2601 | 1242 | indicate_listener_set_server_max_indicators (IndicateListener * listener, IndicateListenerServer * server, gint max) | ||
2602 | 1243 | { | ||
2603 | 1244 | g_return_if_fail(INDICATE_IS_LISTENER(listener)); | ||
2604 | 1245 | g_return_if_fail(server != NULL); /* All we can really check :-/ */ | ||
2605 | 1246 | |||
2606 | 1247 | if (server->max_indicators != max) { | ||
2607 | 1248 | server->max_indicators = max; | ||
2608 | 1249 | org_freedesktop_indicator_set_max_indicators_async(server->proxy, server->max_indicators, set_max_indicators_cb, server->name); | ||
2609 | 1250 | } | ||
2610 | 1251 | |||
2611 | 1252 | return; | ||
2612 | 1253 | } | ||
2613 | 1085 | 1254 | ||
2614 | === modified file 'libindicate/listener.h' | |||
2615 | --- libindicate/listener.h 2009-08-03 22:53:17 +0000 | |||
2616 | +++ libindicate/listener.h 2009-09-05 16:38:55 +0000 | |||
2617 | @@ -52,6 +52,7 @@ | |||
2618 | 52 | #define INDICATE_LISTENER_SIGNAL_INDICATOR_MODIFIED "indicator-modified" | 52 | #define INDICATE_LISTENER_SIGNAL_INDICATOR_MODIFIED "indicator-modified" |
2619 | 53 | #define INDICATE_LISTENER_SIGNAL_SERVER_ADDED "server-added" | 53 | #define INDICATE_LISTENER_SIGNAL_SERVER_ADDED "server-added" |
2620 | 54 | #define INDICATE_LISTENER_SIGNAL_SERVER_REMOVED "server-removed" | 54 | #define INDICATE_LISTENER_SIGNAL_SERVER_REMOVED "server-removed" |
2621 | 55 | #define INDICATE_LISTENER_SIGNAL_SERVER_COUNT_CHANGED "server-count-changed" | ||
2622 | 55 | 56 | ||
2623 | 56 | #define INDICATE_LISTENER_SERVER_DBUS_NAME(server) (indicate_listener_server_get_dbusname(server)) | 57 | #define INDICATE_LISTENER_SERVER_DBUS_NAME(server) (indicate_listener_server_get_dbusname(server)) |
2624 | 57 | #define INDICATE_LISTENER_INDICATOR_ID(indicator) (indicate_listener_indicator_get_id(indicator)) | 58 | #define INDICATE_LISTENER_INDICATOR_ID(indicator) (indicate_listener_indicator_get_id(indicator)) |
2625 | @@ -69,17 +70,42 @@ | |||
2626 | 69 | GObject parent; | 70 | GObject parent; |
2627 | 70 | }; | 71 | }; |
2628 | 71 | 72 | ||
2629 | 73 | /** | ||
2630 | 74 | IndicateListenerClass: | ||
2631 | 75 | @parent: Parent class #GObjectClass. | ||
2632 | 76 | @indicator_added: Slot for IndicateListener::indicator-added. | ||
2633 | 77 | @indicator_removed: Slot for IndicateListener::indicator-removed. | ||
2634 | 78 | @indicator_modified: Slot for IndicateListener::indicator-modified. | ||
2635 | 79 | @server_added: Slot for IndicateListener::server-added. | ||
2636 | 80 | @server_removed: Slot for IndicateListener::server-removed. | ||
2637 | 81 | @server_count_changed: Slot for IndicateListener::server-count-changed. | ||
2638 | 82 | @indicate_listener_reserved1: Reserved for future use | ||
2639 | 83 | @indicate_listener_reserved2: Reserved for future use | ||
2640 | 84 | @indicate_listener_reserved3: Reserved for future use | ||
2641 | 85 | @indicate_listener_reserved4: Reserved for future use | ||
2642 | 86 | |||
2643 | 87 | The class has all of the signals that are supplied by | ||
2644 | 88 | the listener about what is happening on the server. | ||
2645 | 89 | */ | ||
2646 | 72 | typedef struct _IndicateListenerClass IndicateListenerClass; | 90 | typedef struct _IndicateListenerClass IndicateListenerClass; |
2647 | 73 | struct _IndicateListenerClass { | 91 | struct _IndicateListenerClass { |
2648 | 92 | /* Parent */ | ||
2649 | 74 | GObjectClass parent; | 93 | GObjectClass parent; |
2650 | 75 | 94 | ||
2651 | 76 | /* Signals */ | 95 | /* Signals */ |
2655 | 77 | void (* indicator_added) (IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * type); | 96 | void (* indicator_added) (IndicateListenerServer * server, IndicateListenerIndicator * indicator); |
2656 | 78 | void (* indicator_removed) (IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * type); | 97 | void (* indicator_removed) (IndicateListenerServer * server, IndicateListenerIndicator * indicator); |
2657 | 79 | void (* indicator_modified) (IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * type, gchar * property); | 98 | void (* indicator_modified) (IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property); |
2658 | 80 | 99 | ||
2659 | 81 | void (* server_added) (IndicateListenerServer * server, gchar * type); | 100 | void (* server_added) (IndicateListenerServer * server, gchar * type); |
2660 | 82 | void (* server_removed) (IndicateListenerServer * server, gchar * type); | 101 | void (* server_removed) (IndicateListenerServer * server, gchar * type); |
2661 | 102 | void (* server_count_changed) (IndicateListenerServer * server, guint count); | ||
2662 | 103 | |||
2663 | 104 | /* Future Use */ | ||
2664 | 105 | void (*indicate_listener_reserved1)(void); | ||
2665 | 106 | void (*indicate_listener_reserved2)(void); | ||
2666 | 107 | void (*indicate_listener_reserved3)(void); | ||
2667 | 108 | void (*indicate_listener_reserved4)(void); | ||
2668 | 83 | }; | 109 | }; |
2669 | 84 | 110 | ||
2670 | 85 | GType indicate_listener_get_type (void) G_GNUC_CONST; | 111 | GType indicate_listener_get_type (void) G_GNUC_CONST; |
2671 | @@ -87,6 +113,7 @@ | |||
2672 | 87 | typedef void (*indicate_listener_get_property_cb) (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, gchar * propertydata, gpointer data); | 113 | typedef void (*indicate_listener_get_property_cb) (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, gchar * propertydata, gpointer data); |
2673 | 88 | typedef void (*indicate_listener_get_property_time_cb) (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, GTimeVal * propertydata, gpointer data); | 114 | typedef void (*indicate_listener_get_property_time_cb) (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * property, GTimeVal * propertydata, gpointer data); |
2674 | 89 | typedef void (*indicate_listener_get_server_property_cb) (IndicateListener * listener, IndicateListenerServer * server, gchar * value, gpointer data); | 115 | typedef void (*indicate_listener_get_server_property_cb) (IndicateListener * listener, IndicateListenerServer * server, gchar * value, gpointer data); |
2675 | 116 | typedef void (*indicate_listener_get_server_uint_property_cb) (IndicateListener * listener, IndicateListenerServer * server, guint value, gpointer data); | ||
2676 | 90 | 117 | ||
2677 | 91 | /* Create a new listener */ | 118 | /* Create a new listener */ |
2678 | 92 | IndicateListener * indicate_listener_new (void); | 119 | IndicateListener * indicate_listener_new (void); |
2679 | @@ -106,6 +133,10 @@ | |||
2680 | 106 | void indicate_listener_display (IndicateListener * listener, | 133 | void indicate_listener_display (IndicateListener * listener, |
2681 | 107 | IndicateListenerServer * server, | 134 | IndicateListenerServer * server, |
2682 | 108 | IndicateListenerIndicator * indicator); | 135 | IndicateListenerIndicator * indicator); |
2683 | 136 | void indicate_listener_displayed (IndicateListener * listener, | ||
2684 | 137 | IndicateListenerServer * server, | ||
2685 | 138 | IndicateListenerIndicator * indicator, | ||
2686 | 139 | gboolean displayed); | ||
2687 | 109 | void indicate_listener_server_get_type (IndicateListener * listener, | 140 | void indicate_listener_server_get_type (IndicateListener * listener, |
2688 | 110 | IndicateListenerServer * server, | 141 | IndicateListenerServer * server, |
2689 | 111 | indicate_listener_get_server_property_cb callback, | 142 | indicate_listener_get_server_property_cb callback, |
2690 | @@ -114,6 +145,10 @@ | |||
2691 | 114 | IndicateListenerServer * server, | 145 | IndicateListenerServer * server, |
2692 | 115 | indicate_listener_get_server_property_cb callback, | 146 | indicate_listener_get_server_property_cb callback, |
2693 | 116 | gpointer data); | 147 | gpointer data); |
2694 | 148 | void indicate_listener_server_get_count (IndicateListener * listener, | ||
2695 | 149 | IndicateListenerServer * server, | ||
2696 | 150 | indicate_listener_get_server_uint_property_cb callback, | ||
2697 | 151 | gpointer data); | ||
2698 | 117 | const gchar * indicate_listener_server_get_dbusname (IndicateListenerServer * server); | 152 | const gchar * indicate_listener_server_get_dbusname (IndicateListenerServer * server); |
2699 | 118 | guint indicate_listener_indicator_get_id (IndicateListenerIndicator * indicator); | 153 | guint indicate_listener_indicator_get_id (IndicateListenerIndicator * indicator); |
2700 | 119 | void indicate_listener_server_show_interest (IndicateListener * listener, | 154 | void indicate_listener_server_show_interest (IndicateListener * listener, |
2701 | @@ -125,6 +160,11 @@ | |||
2702 | 125 | gboolean indicate_listener_server_check_interest (IndicateListener * listener, | 160 | gboolean indicate_listener_server_check_interest (IndicateListener * listener, |
2703 | 126 | IndicateListenerServer * server, | 161 | IndicateListenerServer * server, |
2704 | 127 | IndicateInterests interest); | 162 | IndicateInterests interest); |
2705 | 163 | void indicate_listener_set_default_max_indicators (IndicateListener * listener, | ||
2706 | 164 | gint max); | ||
2707 | 165 | void indicate_listener_set_server_max_indicators (IndicateListener * listener, | ||
2708 | 166 | IndicateListenerServer * server, | ||
2709 | 167 | gint max); | ||
2710 | 128 | 168 | ||
2711 | 129 | G_END_DECLS | 169 | G_END_DECLS |
2712 | 130 | 170 | ||
2713 | 131 | 171 | ||
2714 | === modified file 'libindicate/server-marshal.list' | |||
2715 | --- libindicate/server-marshal.list 2009-07-21 16:37:51 +0000 | |||
2716 | +++ libindicate/server-marshal.list 2009-08-28 19:55:12 +0000 | |||
2717 | @@ -26,4 +26,5 @@ | |||
2718 | 26 | # <http://www.gnu.org/licenses/> | 26 | # <http://www.gnu.org/licenses/> |
2719 | 27 | # | 27 | # |
2720 | 28 | # IndicatorAdded | 28 | # IndicatorAdded |
2721 | 29 | VOID:UINT | ||
2722 | 29 | VOID:UINT,STRING | 30 | VOID:UINT,STRING |
2723 | 30 | 31 | ||
2724 | === modified file 'libindicate/server.c' | |||
2725 | --- libindicate/server.c 2009-08-05 00:25:55 +0000 | |||
2726 | +++ libindicate/server.c 2009-09-08 20:58:26 +0000 | |||
2727 | @@ -37,18 +37,19 @@ | |||
2728 | 37 | enum { | 37 | enum { |
2729 | 38 | NO_GET_DESKTOP, | 38 | NO_GET_DESKTOP, |
2730 | 39 | NO_GET_INDICATOR_COUNT, | 39 | NO_GET_INDICATOR_COUNT, |
2731 | 40 | NO_GET_INDICATOR_COUNT_BY_TYPE, | ||
2732 | 41 | NO_GET_INDICATOR_LIST, | 40 | NO_GET_INDICATOR_LIST, |
2733 | 42 | NO_GET_INDICATOR_LIST_BY_TYPE, | ||
2734 | 43 | NO_GET_INDICATOR_PROPERTY, | 41 | NO_GET_INDICATOR_PROPERTY, |
2735 | 44 | NO_GET_INDICATOR_PROPERTY_GROUP, | 42 | NO_GET_INDICATOR_PROPERTY_GROUP, |
2736 | 45 | NO_GET_INDICATOR_PROPERTIES, | 43 | NO_GET_INDICATOR_PROPERTIES, |
2737 | 46 | NO_SHOW_INDICATOR_TO_USER, | 44 | NO_SHOW_INDICATOR_TO_USER, |
2738 | 45 | NO_INDICATOR_DISPLAYED, | ||
2739 | 47 | INVALID_INDICATOR_ID, | 46 | INVALID_INDICATOR_ID, |
2740 | 48 | NO_SHOW_INTEREST, | 47 | NO_SHOW_INTEREST, |
2741 | 49 | NO_REMOVE_INTEREST, | 48 | NO_REMOVE_INTEREST, |
2742 | 50 | SHOW_INTEREST_FAILED, | 49 | SHOW_INTEREST_FAILED, |
2743 | 51 | REMOVE_INTEREST_FAILED, | 50 | REMOVE_INTEREST_FAILED, |
2744 | 51 | NO_MAX_INDICATORS_SET, | ||
2745 | 52 | MAX_INDICATORS_SET_FAILED, | ||
2746 | 52 | LAST_ERROR | 53 | LAST_ERROR |
2747 | 53 | }; | 54 | }; |
2748 | 54 | 55 | ||
2749 | @@ -62,6 +63,9 @@ | |||
2750 | 62 | SERVER_DISPLAY, | 63 | SERVER_DISPLAY, |
2751 | 63 | INTEREST_ADDED, | 64 | INTEREST_ADDED, |
2752 | 64 | INTEREST_REMOVED, | 65 | INTEREST_REMOVED, |
2753 | 66 | MAX_INDICATORS_CHANGED, | ||
2754 | 67 | INDICATOR_NOT_SHOWN, | ||
2755 | 68 | SERVER_COUNT_CHANGED, | ||
2756 | 65 | LAST_SIGNAL | 69 | LAST_SIGNAL |
2757 | 66 | }; | 70 | }; |
2758 | 67 | 71 | ||
2759 | @@ -69,7 +73,8 @@ | |||
2760 | 69 | enum { | 73 | enum { |
2761 | 70 | PROP_0, | 74 | PROP_0, |
2762 | 71 | PROP_DESKTOP, | 75 | PROP_DESKTOP, |
2764 | 72 | PROP_TYPE | 76 | PROP_TYPE, |
2765 | 77 | PROP_COUNT | ||
2766 | 73 | }; | 78 | }; |
2767 | 74 | 79 | ||
2768 | 75 | static guint signals[LAST_SIGNAL] = { 0 }; | 80 | static guint signals[LAST_SIGNAL] = { 0 }; |
2769 | @@ -89,12 +94,17 @@ | |||
2770 | 89 | 94 | ||
2771 | 90 | gchar * desktop; | 95 | gchar * desktop; |
2772 | 91 | gchar * type; | 96 | gchar * type; |
2773 | 97 | guint count; | ||
2774 | 92 | 98 | ||
2775 | 93 | // TODO: Should have a more robust way to track this, but this'll work for now | 99 | // TODO: Should have a more robust way to track this, but this'll work for now |
2776 | 94 | guint num_hidden; | 100 | guint num_hidden; |
2777 | 95 | 101 | ||
2779 | 96 | gboolean interests[INDICATE_INTEREST_LAST]; | 102 | /* Folks storage */ |
2780 | 97 | GList * interestedfolks; | 103 | GList * interestedfolks; |
2781 | 104 | |||
2782 | 105 | /* Folks caches */ | ||
2783 | 106 | gint max_indicators; | ||
2784 | 107 | gboolean interests[INDICATE_INTEREST_LAST]; | ||
2785 | 98 | }; | 108 | }; |
2786 | 99 | 109 | ||
2787 | 100 | #define INDICATE_SERVER_GET_PRIVATE(o) \ | 110 | #define INDICATE_SERVER_GET_PRIVATE(o) \ |
2788 | @@ -104,8 +114,12 @@ | |||
2789 | 104 | struct _IndicateServerInterestedFolk { | 114 | struct _IndicateServerInterestedFolk { |
2790 | 105 | gchar * sender; | 115 | gchar * sender; |
2791 | 106 | gboolean interests[INDICATE_INTEREST_LAST]; | 116 | gboolean interests[INDICATE_INTEREST_LAST]; |
2792 | 117 | gint max_indicators; | ||
2793 | 118 | GHashTable * indicators_displayed; | ||
2794 | 107 | }; | 119 | }; |
2795 | 108 | 120 | ||
2796 | 121 | static const gint MAX_INDICATORS_INFINITE = -1; | ||
2797 | 122 | static const gint MAX_INDICATORS_UNSET = -2; | ||
2798 | 109 | 123 | ||
2799 | 110 | /* Define Type */ | 124 | /* Define Type */ |
2800 | 111 | G_DEFINE_TYPE (IndicateServer, indicate_server, G_TYPE_OBJECT); | 125 | G_DEFINE_TYPE (IndicateServer, indicate_server, G_TYPE_OBJECT); |
2801 | @@ -113,20 +127,25 @@ | |||
2802 | 113 | /* Prototypes */ | 127 | /* Prototypes */ |
2803 | 114 | static void indicate_server_finalize (GObject * obj); | 128 | static void indicate_server_finalize (GObject * obj); |
2804 | 115 | static gboolean get_indicator_count (IndicateServer * server, guint * count, GError **error); | 129 | static gboolean get_indicator_count (IndicateServer * server, guint * count, GError **error); |
2805 | 116 | static gboolean get_indicator_count_by_type (IndicateServer * server, gchar * type, guint * count, GError **error); | ||
2806 | 117 | static gboolean get_indicator_list (IndicateServer * server, GArray ** indicators, GError ** error); | 130 | static gboolean get_indicator_list (IndicateServer * server, GArray ** indicators, GError ** error); |
2808 | 118 | static gboolean get_indicator_list_by_type (IndicateServer * server, gchar * type, GArray ** indicators, GError ** error); | 131 | static IndicateIndicator * get_indicator (IndicateServer * server, guint id, GError **error); |
2809 | 119 | static gboolean get_indicator_property (IndicateServer * server, guint id, gchar * property, gchar ** value, GError **error); | 132 | static gboolean get_indicator_property (IndicateServer * server, guint id, gchar * property, gchar ** value, GError **error); |
2810 | 120 | static gboolean get_indicator_property_group (IndicateServer * server, guint id, GPtrArray * properties, gchar *** value, GError **error); | 133 | static gboolean get_indicator_property_group (IndicateServer * server, guint id, GPtrArray * properties, gchar *** value, GError **error); |
2811 | 121 | static gboolean get_indicator_properties (IndicateServer * server, guint id, gchar *** properties, GError **error); | 134 | static gboolean get_indicator_properties (IndicateServer * server, guint id, gchar *** properties, GError **error); |
2812 | 122 | static gboolean show_indicator_to_user (IndicateServer * server, guint id, GError ** error); | 135 | static gboolean show_indicator_to_user (IndicateServer * server, guint id, GError ** error); |
2813 | 136 | static gboolean indicator_displayed (IndicateServer * server, gchar * sender, guint id, gboolean displayed, GError ** error); | ||
2814 | 123 | static void dbus_owner_change (DBusGProxy * proxy, const gchar * name, const gchar * prev, const gchar * new, IndicateServer * server); | 137 | static void dbus_owner_change (DBusGProxy * proxy, const gchar * name, const gchar * prev, const gchar * new, IndicateServer * server); |
2815 | 138 | static void indicator_display_check_recalc (gpointer key, gpointer value, gpointer userdata); | ||
2816 | 139 | static void recalculate_indicator_displayed (IndicateServer * server, guint id); | ||
2817 | 124 | static guint get_next_id (IndicateServer * server); | 140 | static guint get_next_id (IndicateServer * server); |
2818 | 125 | static void set_property (GObject * obj, guint id, const GValue * value, GParamSpec * pspec); | 141 | static void set_property (GObject * obj, guint id, const GValue * value, GParamSpec * pspec); |
2819 | 126 | static void get_property (GObject * obj, guint id, GValue * value, GParamSpec * pspec); | 142 | static void get_property (GObject * obj, guint id, GValue * value, GParamSpec * pspec); |
2820 | 127 | static gboolean show_interest (IndicateServer * server, gchar * sender, IndicateInterests interest); | 143 | static gboolean show_interest (IndicateServer * server, gchar * sender, IndicateInterests interest); |
2821 | 128 | static gboolean remove_interest (IndicateServer * server, gchar * sender, IndicateInterests interest); | 144 | static gboolean remove_interest (IndicateServer * server, gchar * sender, IndicateInterests interest); |
2822 | 129 | static gboolean check_interest (IndicateServer * server, IndicateInterests intrest); | 145 | static gboolean check_interest (IndicateServer * server, IndicateInterests intrest); |
2823 | 146 | static gint max_indicators_get (IndicateServer * server); | ||
2824 | 147 | static gboolean max_indicators_set (IndicateServer * server, gchar * sender, gint max); | ||
2825 | 148 | static void recalculate_max_indicators (IndicateServer * server); | ||
2826 | 130 | static gint indicate_server_interested_folks_equal (gconstpointer a, gconstpointer b); | 149 | static gint indicate_server_interested_folks_equal (gconstpointer a, gconstpointer b); |
2827 | 131 | static void indicate_server_interested_folks_init (IndicateServerInterestedFolk * folk, gchar * sender); | 150 | static void indicate_server_interested_folks_init (IndicateServerInterestedFolk * folk, gchar * sender); |
2828 | 132 | static void indicate_server_interested_folks_set (IndicateServerInterestedFolk * folk, IndicateInterests interest, gboolean value); | 151 | static void indicate_server_interested_folks_set (IndicateServerInterestedFolk * folk, IndicateInterests interest, gboolean value); |
2829 | @@ -135,15 +154,15 @@ | |||
2830 | 135 | 154 | ||
2831 | 136 | /* DBus API */ | 155 | /* DBus API */ |
2832 | 137 | gboolean _indicate_server_get_indicator_count (IndicateServer * server, guint * count, GError **error); | 156 | gboolean _indicate_server_get_indicator_count (IndicateServer * server, guint * count, GError **error); |
2833 | 138 | gboolean _indicate_server_get_indicator_count_by_type (IndicateServer * server, gchar * type, guint * count, GError **error); | ||
2834 | 139 | gboolean _indicate_server_get_indicator_list (IndicateServer * server, GArray ** indicators, GError ** error); | 157 | gboolean _indicate_server_get_indicator_list (IndicateServer * server, GArray ** indicators, GError ** error); |
2835 | 140 | gboolean _indicate_server_get_indicator_list_by_type (IndicateServer * server, gchar * type, GArray ** indicators, GError ** error); | ||
2836 | 141 | gboolean _indicate_server_get_indicator_property (IndicateServer * server, guint id, gchar * property, gchar ** value, GError **error); | 158 | gboolean _indicate_server_get_indicator_property (IndicateServer * server, guint id, gchar * property, gchar ** value, GError **error); |
2837 | 142 | gboolean _indicate_server_get_indicator_property_group (IndicateServer * server, guint id, GPtrArray * properties, gchar *** value, GError **error); | 159 | gboolean _indicate_server_get_indicator_property_group (IndicateServer * server, guint id, GPtrArray * properties, gchar *** value, GError **error); |
2838 | 143 | gboolean _indicate_server_get_indicator_properties (IndicateServer * server, guint id, gchar *** properties, GError **error); | 160 | gboolean _indicate_server_get_indicator_properties (IndicateServer * server, guint id, gchar *** properties, GError **error); |
2839 | 144 | gboolean _indicate_server_show_indicator_to_user (IndicateServer * server, guint id, GError ** error); | 161 | gboolean _indicate_server_show_indicator_to_user (IndicateServer * server, guint id, GError ** error); |
2840 | 162 | gboolean _indicate_server_indicator_displayed (IndicateServer * server, guint id, gboolean displayed, DBusGMethodInvocation * method); | ||
2841 | 145 | gboolean _indicate_server_show_interest (IndicateServer * server, gchar * interest, DBusGMethodInvocation * method); | 163 | gboolean _indicate_server_show_interest (IndicateServer * server, gchar * interest, DBusGMethodInvocation * method); |
2842 | 146 | gboolean _indicate_server_remove_interest (IndicateServer * server, gchar * interest, DBusGMethodInvocation * method); | 164 | gboolean _indicate_server_remove_interest (IndicateServer * server, gchar * interest, DBusGMethodInvocation * method); |
2843 | 165 | gboolean _indicate_server_set_max_indicators (IndicateServer * server, gint max, DBusGMethodInvocation * method); | ||
2844 | 147 | 166 | ||
2845 | 148 | /* Has to be after the dbus prototypes */ | 167 | /* Has to be after the dbus prototypes */ |
2846 | 149 | #include "dbus-indicate-server.h" | 168 | #include "dbus-indicate-server.h" |
2847 | @@ -168,38 +187,32 @@ | |||
2848 | 168 | IndicateServer::indicator-added: | 187 | IndicateServer::indicator-added: |
2849 | 169 | @arg0: The #IndicateServer object | 188 | @arg0: The #IndicateServer object |
2850 | 170 | @arg1: The #IndicateIndicator ID number | 189 | @arg1: The #IndicateIndicator ID number |
2851 | 171 | @arg2: The type of the indicator | ||
2852 | 172 | 190 | ||
2853 | 173 | Emitted every time that a new indicator is made visible to | 191 | Emitted every time that a new indicator is made visible to |
2854 | 174 | the world. This results in a signal on DBus. | 192 | the world. This results in a signal on DBus. |
2855 | 175 | |||
2856 | 176 | Can be emitted by subclasses using indicate_server_emit_indicator_added() | ||
2857 | 177 | */ | 193 | */ |
2858 | 178 | signals[INDICATOR_ADDED] = g_signal_new(INDICATE_SERVER_SIGNAL_INDICATOR_ADDED, | 194 | signals[INDICATOR_ADDED] = g_signal_new(INDICATE_SERVER_SIGNAL_INDICATOR_ADDED, |
2859 | 179 | G_TYPE_FROM_CLASS (class), | 195 | G_TYPE_FROM_CLASS (class), |
2860 | 180 | G_SIGNAL_RUN_LAST, | 196 | G_SIGNAL_RUN_LAST, |
2861 | 181 | G_STRUCT_OFFSET (IndicateServerClass, indicator_added), | 197 | G_STRUCT_OFFSET (IndicateServerClass, indicator_added), |
2862 | 182 | NULL, NULL, | 198 | NULL, NULL, |
2865 | 183 | _indicate_server_marshal_VOID__UINT_STRING, | 199 | _indicate_server_marshal_VOID__UINT, |
2866 | 184 | G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_STRING); | 200 | G_TYPE_NONE, 1, G_TYPE_UINT); |
2867 | 185 | /** | 201 | /** |
2868 | 186 | IndicateServer::indicator-removed: | 202 | IndicateServer::indicator-removed: |
2869 | 187 | @arg0: The #IndicateServer object | 203 | @arg0: The #IndicateServer object |
2870 | 188 | @arg1: The #IndicateIndicator ID number | 204 | @arg1: The #IndicateIndicator ID number |
2871 | 189 | @arg2: The type of the indicator | ||
2872 | 190 | 205 | ||
2873 | 191 | Emitted every time that a new indicator is made invisible to | 206 | Emitted every time that a new indicator is made invisible to |
2874 | 192 | the world. This results in a signal on DBus. | 207 | the world. This results in a signal on DBus. |
2875 | 193 | |||
2876 | 194 | Can be emitted by subclasses using indicate_server_emit_indicator_removed() | ||
2877 | 195 | */ | 208 | */ |
2878 | 196 | signals[INDICATOR_REMOVED] = g_signal_new(INDICATE_SERVER_SIGNAL_INDICATOR_REMOVED, | 209 | signals[INDICATOR_REMOVED] = g_signal_new(INDICATE_SERVER_SIGNAL_INDICATOR_REMOVED, |
2879 | 197 | G_TYPE_FROM_CLASS (class), | 210 | G_TYPE_FROM_CLASS (class), |
2880 | 198 | G_SIGNAL_RUN_LAST, | 211 | G_SIGNAL_RUN_LAST, |
2881 | 199 | G_STRUCT_OFFSET (IndicateServerClass, indicator_removed), | 212 | G_STRUCT_OFFSET (IndicateServerClass, indicator_removed), |
2882 | 200 | NULL, NULL, | 213 | NULL, NULL, |
2885 | 201 | _indicate_server_marshal_VOID__UINT_STRING, | 214 | _indicate_server_marshal_VOID__UINT, |
2886 | 202 | G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_STRING); | 215 | G_TYPE_NONE, 1, G_TYPE_UINT); |
2887 | 203 | /** | 216 | /** |
2888 | 204 | IndicateServer::indicator-modified: | 217 | IndicateServer::indicator-modified: |
2889 | 205 | @arg0: The #IndicateServer object | 218 | @arg0: The #IndicateServer object |
2890 | @@ -208,8 +221,6 @@ | |||
2891 | 208 | 221 | ||
2892 | 209 | Emitted every time that a property on an indicator changes | 222 | Emitted every time that a property on an indicator changes |
2893 | 210 | and it is visible to the world. This results in a signal on DBus. | 223 | and it is visible to the world. This results in a signal on DBus. |
2894 | 211 | |||
2895 | 212 | Can be emitted by subclasses using indicate_server_emit_indicator_modified() | ||
2896 | 213 | */ | 224 | */ |
2897 | 214 | signals[INDICATOR_MODIFIED] = g_signal_new(INDICATE_SERVER_SIGNAL_INDICATOR_MODIFIED, | 225 | signals[INDICATOR_MODIFIED] = g_signal_new(INDICATE_SERVER_SIGNAL_INDICATOR_MODIFIED, |
2898 | 215 | G_TYPE_FROM_CLASS (class), | 226 | G_TYPE_FROM_CLASS (class), |
2899 | @@ -256,8 +267,6 @@ | |||
2900 | 256 | Emitted when a listener signals that the server itself should be | 267 | Emitted when a listener signals that the server itself should be |
2901 | 257 | displayed. This signal is caused by a user clicking on the application | 268 | displayed. This signal is caused by a user clicking on the application |
2902 | 258 | item in the Messaging Menu. This signal is emitted by DBus. | 269 | item in the Messaging Menu. This signal is emitted by DBus. |
2903 | 259 | |||
2904 | 260 | Can be emitted by subclasses using indicate_server_emit_server_display() | ||
2905 | 261 | */ | 270 | */ |
2906 | 262 | signals[SERVER_DISPLAY] = g_signal_new(INDICATE_SERVER_SIGNAL_SERVER_DISPLAY, | 271 | signals[SERVER_DISPLAY] = g_signal_new(INDICATE_SERVER_SIGNAL_SERVER_DISPLAY, |
2907 | 263 | G_TYPE_FROM_CLASS (class), | 272 | G_TYPE_FROM_CLASS (class), |
2908 | @@ -296,6 +305,36 @@ | |||
2909 | 296 | NULL, NULL, | 305 | NULL, NULL, |
2910 | 297 | g_cclosure_marshal_VOID__UINT, | 306 | g_cclosure_marshal_VOID__UINT, |
2911 | 298 | G_TYPE_NONE, 1, G_TYPE_UINT); | 307 | G_TYPE_NONE, 1, G_TYPE_UINT); |
2912 | 308 | /** | ||
2913 | 309 | IndicateServer::max-indicators-changed: | ||
2914 | 310 | @arg0: The #IndicateServer object | ||
2915 | 311 | @arg1: The new max number of indicators | ||
2916 | 312 | |||
2917 | 313 | Emitted when a listener either specifies their max number | ||
2918 | 314 | to be higher, or at all. The default is -1 or infinite. | ||
2919 | 315 | */ | ||
2920 | 316 | signals[MAX_INDICATORS_CHANGED] = g_signal_new(INDICATE_SERVER_SIGNAL_MAX_INDICATORS_CHANGED, | ||
2921 | 317 | G_TYPE_FROM_CLASS (class), | ||
2922 | 318 | G_SIGNAL_RUN_LAST, | ||
2923 | 319 | G_STRUCT_OFFSET (IndicateServerClass, max_indicators_changed), | ||
2924 | 320 | NULL, NULL, | ||
2925 | 321 | g_cclosure_marshal_VOID__INT, | ||
2926 | 322 | G_TYPE_NONE, 1, G_TYPE_INT); | ||
2927 | 323 | /** | ||
2928 | 324 | IndicateServer::server-count-changed: | ||
2929 | 325 | @arg0: The #IndicateServer object | ||
2930 | 326 | @arg1: The count variable on the server changed. | ||
2931 | 327 | |||
2932 | 328 | Emitted when the count property of the server changes | ||
2933 | 329 | to a new value. | ||
2934 | 330 | */ | ||
2935 | 331 | signals[SERVER_COUNT_CHANGED] = g_signal_new(INDICATE_SERVER_SIGNAL_SERVER_COUNT_CHANGED, | ||
2936 | 332 | G_TYPE_FROM_CLASS (class), | ||
2937 | 333 | G_SIGNAL_RUN_LAST, | ||
2938 | 334 | G_STRUCT_OFFSET (IndicateServerClass, server_count_changed), | ||
2939 | 335 | NULL, NULL, | ||
2940 | 336 | g_cclosure_marshal_VOID__UINT, | ||
2941 | 337 | G_TYPE_NONE, 1, G_TYPE_UINT); | ||
2942 | 299 | 338 | ||
2943 | 300 | g_object_class_install_property (gobj, PROP_DESKTOP, | 339 | g_object_class_install_property (gobj, PROP_DESKTOP, |
2944 | 301 | g_param_spec_string("desktop", "Desktop File", | 340 | g_param_spec_string("desktop", "Desktop File", |
2945 | @@ -307,22 +346,28 @@ | |||
2946 | 307 | "The type of indicators that this server will provide", | 346 | "The type of indicators that this server will provide", |
2947 | 308 | "", | 347 | "", |
2948 | 309 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); | 348 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); |
2949 | 349 | g_object_class_install_property (gobj, PROP_COUNT, | ||
2950 | 350 | g_param_spec_uint("count", "Server Count", | ||
2951 | 351 | "A number reprsenting the number of items in a server", | ||
2952 | 352 | 0, G_MAXUINT, 0, | ||
2953 | 353 | G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); | ||
2954 | 310 | 354 | ||
2955 | 311 | dbus_g_object_type_install_info(INDICATE_TYPE_SERVER, | 355 | dbus_g_object_type_install_info(INDICATE_TYPE_SERVER, |
2956 | 312 | &dbus_glib__indicate_server_object_info); | 356 | &dbus_glib__indicate_server_object_info); |
2957 | 313 | 357 | ||
2958 | 314 | class->get_indicator_count = get_indicator_count; | 358 | class->get_indicator_count = get_indicator_count; |
2959 | 315 | class->get_indicator_count_by_type = get_indicator_count_by_type; | ||
2960 | 316 | class->get_indicator_list = get_indicator_list; | 359 | class->get_indicator_list = get_indicator_list; |
2961 | 317 | class->get_indicator_list_by_type = get_indicator_list_by_type; | ||
2962 | 318 | class->get_indicator_property = get_indicator_property; | 360 | class->get_indicator_property = get_indicator_property; |
2963 | 319 | class->get_indicator_property_group = get_indicator_property_group; | 361 | class->get_indicator_property_group = get_indicator_property_group; |
2964 | 320 | class->get_indicator_properties = get_indicator_properties; | 362 | class->get_indicator_properties = get_indicator_properties; |
2965 | 321 | class->show_indicator_to_user = show_indicator_to_user; | 363 | class->show_indicator_to_user = show_indicator_to_user; |
2966 | 364 | class->indicator_displayed = indicator_displayed; | ||
2967 | 322 | class->get_next_id = get_next_id; | 365 | class->get_next_id = get_next_id; |
2968 | 323 | class->show_interest = show_interest; | 366 | class->show_interest = show_interest; |
2969 | 324 | class->remove_interest = remove_interest; | 367 | class->remove_interest = remove_interest; |
2970 | 325 | class->check_interest = check_interest; | 368 | class->check_interest = check_interest; |
2971 | 369 | class->max_indicators_get = max_indicators_get; | ||
2972 | 370 | class->max_indicators_set = max_indicators_set; | ||
2973 | 326 | 371 | ||
2974 | 327 | return; | 372 | return; |
2975 | 328 | } | 373 | } |
2976 | @@ -342,13 +387,14 @@ | |||
2977 | 342 | priv->current_id = 0; | 387 | priv->current_id = 0; |
2978 | 343 | priv->type = NULL; | 388 | priv->type = NULL; |
2979 | 344 | priv->desktop = NULL; | 389 | priv->desktop = NULL; |
2980 | 390 | priv->count = 0; | ||
2981 | 345 | 391 | ||
2982 | 346 | guint i; | 392 | guint i; |
2983 | 347 | for (i = INDICATE_INTEREST_NONE; i < INDICATE_INTEREST_LAST; i++) { | 393 | for (i = INDICATE_INTEREST_NONE; i < INDICATE_INTEREST_LAST; i++) { |
2984 | 348 | priv->interests[i] = FALSE; | 394 | priv->interests[i] = FALSE; |
2985 | 349 | } | 395 | } |
2986 | 350 | priv->interestedfolks = NULL; | 396 | priv->interestedfolks = NULL; |
2988 | 351 | 397 | priv->max_indicators = MAX_INDICATORS_UNSET; | |
2989 | 352 | 398 | ||
2990 | 353 | return; | 399 | return; |
2991 | 354 | } | 400 | } |
2992 | @@ -385,54 +431,66 @@ | |||
2993 | 385 | g_return_if_fail(G_VALUE_HOLDS_STRING(value)); | 431 | g_return_if_fail(G_VALUE_HOLDS_STRING(value)); |
2994 | 386 | g_return_if_fail(id == PROP_DESKTOP || id == PROP_TYPE); | 432 | g_return_if_fail(id == PROP_DESKTOP || id == PROP_TYPE); |
2995 | 387 | 433 | ||
2996 | 388 | gchar ** outstr; | ||
2997 | 389 | gchar * tempstr = NULL; | ||
2998 | 390 | outstr = &tempstr; | ||
2999 | 391 | |||
3000 | 392 | IndicateServerPrivate * priv = INDICATE_SERVER_GET_PRIVATE(obj); | 434 | IndicateServerPrivate * priv = INDICATE_SERVER_GET_PRIVATE(obj); |
3001 | 393 | switch (id) { | 435 | switch (id) { |
3002 | 394 | case PROP_DESKTOP: | 436 | case PROP_DESKTOP: |
3004 | 395 | outstr = &(priv->desktop); | 437 | if (priv->desktop != NULL) { |
3005 | 438 | g_free(priv->desktop); | ||
3006 | 439 | } | ||
3007 | 440 | priv->desktop = g_value_dup_string(value); | ||
3008 | 396 | break; | 441 | break; |
3009 | 397 | case PROP_TYPE: | 442 | case PROP_TYPE: |
3019 | 398 | outstr = &(priv->type); | 443 | if (priv->type != NULL) { |
3020 | 399 | break; | 444 | g_free(priv->type); |
3021 | 400 | } | 445 | } |
3022 | 401 | 446 | priv->type = g_value_dup_string(value); | |
3023 | 402 | if (*outstr != NULL) { | 447 | break; |
3024 | 403 | g_free(*outstr); | 448 | case PROP_COUNT: { |
3025 | 404 | } | 449 | guint newval = g_value_get_uint(value); |
3026 | 405 | 450 | if (newval != priv->count) { | |
3027 | 406 | *outstr = g_strdup(g_value_get_string(value)); | 451 | priv->count = newval; |
3028 | 452 | g_signal_emit(obj, signals[SERVER_COUNT_CHANGED], 0, newval, TRUE); | ||
3029 | 453 | } | ||
3030 | 454 | break; | ||
3031 | 455 | } | ||
3032 | 456 | } | ||
3033 | 407 | 457 | ||
3034 | 408 | return; | 458 | return; |
3035 | 409 | } | 459 | } |
3036 | 410 | 460 | ||
3037 | 461 | /* Gets the Gobject properties for the IndicateServer. Mostly | ||
3038 | 462 | just copies strings and a whole uint! */ | ||
3039 | 411 | static void | 463 | static void |
3040 | 412 | get_property (GObject * obj, guint id, GValue * value, GParamSpec * pspec) | 464 | get_property (GObject * obj, guint id, GValue * value, GParamSpec * pspec) |
3041 | 413 | { | 465 | { |
3042 | 414 | g_return_if_fail(id == PROP_DESKTOP || id == PROP_TYPE); | 466 | g_return_if_fail(id == PROP_DESKTOP || id == PROP_TYPE); |
3043 | 415 | 467 | ||
3044 | 416 | gchar * outstr = NULL; | ||
3045 | 417 | IndicateServerPrivate * priv = INDICATE_SERVER_GET_PRIVATE(obj); | 468 | IndicateServerPrivate * priv = INDICATE_SERVER_GET_PRIVATE(obj); |
3046 | 418 | switch (id) { | 469 | switch (id) { |
3047 | 419 | case PROP_DESKTOP: | 470 | case PROP_DESKTOP: |
3049 | 420 | outstr = priv->desktop; | 471 | if (priv->desktop == NULL) { |
3050 | 472 | g_value_set_string(value, ""); | ||
3051 | 473 | } else { | ||
3052 | 474 | g_value_set_string(value, priv->desktop); | ||
3053 | 475 | } | ||
3054 | 421 | break; | 476 | break; |
3055 | 422 | case PROP_TYPE: | 477 | case PROP_TYPE: |
3064 | 423 | outstr = priv->type; | 478 | if (priv->type == NULL) { |
3065 | 424 | break; | 479 | g_value_set_string(value, ""); |
3066 | 425 | } | 480 | } else { |
3067 | 426 | 481 | g_value_set_string(value, priv->type); | |
3068 | 427 | if (outstr != NULL) { | 482 | } |
3069 | 428 | g_value_set_string(value, outstr); | 483 | break; |
3070 | 429 | } else { | 484 | case PROP_COUNT: |
3071 | 430 | g_value_set_static_string(value, ""); | 485 | g_value_set_uint(value, priv->count); |
3072 | 486 | break; | ||
3073 | 431 | } | 487 | } |
3074 | 432 | 488 | ||
3075 | 433 | return; | 489 | return; |
3076 | 434 | } | 490 | } |
3077 | 435 | 491 | ||
3078 | 492 | /* Small little function to get an error quark for usage | ||
3079 | 493 | with the GError errors back across DBus */ | ||
3080 | 436 | static GQuark | 494 | static GQuark |
3081 | 437 | indicate_server_error_quark (void) | 495 | indicate_server_error_quark (void) |
3082 | 438 | { | 496 | { |
3083 | @@ -467,8 +525,8 @@ | |||
3084 | 467 | 525 | ||
3085 | 468 | if (!priv->registered) { | 526 | if (!priv->registered) { |
3086 | 469 | dbus_g_connection_register_g_object(priv->connection, | 527 | dbus_g_connection_register_g_object(priv->connection, |
3089 | 470 | priv->path, | 528 | priv->path, |
3090 | 471 | G_OBJECT(server)); | 529 | G_OBJECT(server)); |
3091 | 472 | priv->registered = TRUE; | 530 | priv->registered = TRUE; |
3092 | 473 | } | 531 | } |
3093 | 474 | 532 | ||
3094 | @@ -525,6 +583,10 @@ | |||
3095 | 525 | priv->interests[i] = FALSE; | 583 | priv->interests[i] = FALSE; |
3096 | 526 | } | 584 | } |
3097 | 527 | 585 | ||
3098 | 586 | /* Signal that we don't have a max */ | ||
3099 | 587 | priv->max_indicators = MAX_INDICATORS_UNSET; | ||
3100 | 588 | g_signal_emit(G_OBJECT(server), signals[MAX_INDICATORS_CHANGED], 0, MAX_INDICATORS_INFINITE, TRUE); | ||
3101 | 589 | |||
3102 | 528 | g_signal_emit(server, signals[SERVER_HIDE], 0, priv->type ? priv->type : "", TRUE); | 590 | g_signal_emit(server, signals[SERVER_HIDE], 0, priv->type ? priv->type : "", TRUE); |
3103 | 529 | 591 | ||
3104 | 530 | if (priv->dbus_proxy != NULL) { | 592 | if (priv->dbus_proxy != NULL) { |
3105 | @@ -540,6 +602,11 @@ | |||
3106 | 540 | return; | 602 | return; |
3107 | 541 | } | 603 | } |
3108 | 542 | 604 | ||
3109 | 605 | /* Watches the DBus owner change signals to see if any | ||
3110 | 606 | of our folk disappear. If one of our folks goes away | ||
3111 | 607 | then it deals with the repercussions of deleting that | ||
3112 | 608 | entry in terms of interest, max indicators and which | ||
3113 | 609 | indicators are being displayed. */ | ||
3114 | 543 | static void | 610 | static void |
3115 | 544 | dbus_owner_change (DBusGProxy * proxy, const gchar * name, const gchar * prev, const gchar * new, IndicateServer * server) | 611 | dbus_owner_change (DBusGProxy * proxy, const gchar * name, const gchar * prev, const gchar * new, IndicateServer * server) |
3116 | 545 | { | 612 | { |
3117 | @@ -586,11 +653,63 @@ | |||
3118 | 586 | } | 653 | } |
3119 | 587 | } | 654 | } |
3120 | 588 | 655 | ||
3126 | 589 | g_free(folk); | 656 | /* If the retired folk has set it's max indicators |
3127 | 590 | 657 | and it's the value we're using, we need to recalculate */ | |
3128 | 591 | return; | 658 | if (folk->max_indicators != MAX_INDICATORS_UNSET && folk->max_indicators == priv->max_indicators) { |
3129 | 592 | } | 659 | recalculate_max_indicators(server); |
3130 | 593 | 660 | } | |
3131 | 661 | |||
3132 | 662 | g_hash_table_foreach(folk->indicators_displayed, indicator_display_check_recalc, server); | ||
3133 | 663 | |||
3134 | 664 | /* Finally destory everything */ | ||
3135 | 665 | indicate_server_interested_folks_destroy(folk); | ||
3136 | 666 | return; | ||
3137 | 667 | } | ||
3138 | 668 | |||
3139 | 669 | /* Checks each value in the hash table to see if it's | ||
3140 | 670 | been set. If it is, then we need to recalculate | ||
3141 | 671 | the value of displayed. */ | ||
3142 | 672 | static void | ||
3143 | 673 | indicator_display_check_recalc (gpointer key, gpointer value, gpointer userdata) | ||
3144 | 674 | { | ||
3145 | 675 | if (!GPOINTER_TO_UINT(value)) { | ||
3146 | 676 | return; | ||
3147 | 677 | } | ||
3148 | 678 | |||
3149 | 679 | recalculate_indicator_displayed(INDICATE_SERVER(userdata), GPOINTER_TO_UINT(key)); | ||
3150 | 680 | return; | ||
3151 | 681 | } | ||
3152 | 682 | |||
3153 | 683 | /* Look to see if a specific indicator ID has anyone watching | ||
3154 | 684 | for it, and if not we need to set it to undisplayed. */ | ||
3155 | 685 | static void | ||
3156 | 686 | recalculate_indicator_displayed (IndicateServer * server, guint id) | ||
3157 | 687 | { | ||
3158 | 688 | IndicateServerPrivate * priv = INDICATE_SERVER_GET_PRIVATE(server); | ||
3159 | 689 | GList * folkpointer; | ||
3160 | 690 | |||
3161 | 691 | for (folkpointer = priv->interestedfolks; folkpointer != NULL; folkpointer = g_list_next(folkpointer)) { | ||
3162 | 692 | IndicateServerInterestedFolk * folk = (IndicateServerInterestedFolk *)folkpointer->data; | ||
3163 | 693 | if (g_hash_table_lookup(folk->indicators_displayed, GUINT_TO_POINTER(id))) { | ||
3164 | 694 | break; | ||
3165 | 695 | } | ||
3166 | 696 | } | ||
3167 | 697 | |||
3168 | 698 | if (folkpointer == NULL) { | ||
3169 | 699 | /* We went through the list and no one cares about | ||
3170 | 700 | this indicator. It's not displayed anymore. */ | ||
3171 | 701 | IndicateIndicator * indicator = get_indicator(server, id, NULL); | ||
3172 | 702 | if (indicator != NULL) { | ||
3173 | 703 | indicate_indicator_set_displayed(indicator, FALSE); | ||
3174 | 704 | } else { | ||
3175 | 705 | g_warning("I'm removing a displayed set from an indicator that doesn't seem to exist."); | ||
3176 | 706 | } | ||
3177 | 707 | } | ||
3178 | 708 | |||
3179 | 709 | return; | ||
3180 | 710 | } | ||
3181 | 711 | |||
3182 | 712 | /* Get the next ID from the server */ | ||
3183 | 594 | static guint | 713 | static guint |
3184 | 595 | get_next_id (IndicateServer * server) | 714 | get_next_id (IndicateServer * server) |
3185 | 596 | { | 715 | { |
3186 | @@ -599,6 +718,10 @@ | |||
3187 | 599 | return priv->current_id; | 718 | return priv->current_id; |
3188 | 600 | } | 719 | } |
3189 | 601 | 720 | ||
3190 | 721 | /* Allows a listener to show interest. First we look to see | ||
3191 | 722 | if we've talked to this listener before and if so we just | ||
3192 | 723 | mark their folk listing. If it changes the overall setting | ||
3193 | 724 | then we need to signal. */ | ||
3194 | 602 | static gboolean | 725 | static gboolean |
3195 | 603 | show_interest (IndicateServer * server, gchar * sender, IndicateInterests interest) | 726 | show_interest (IndicateServer * server, gchar * sender, IndicateInterests interest) |
3196 | 604 | { | 727 | { |
3197 | @@ -615,7 +738,7 @@ | |||
3198 | 615 | GList * entry = g_list_find_custom(priv->interestedfolks, &localfolk, indicate_server_interested_folks_equal); | 738 | GList * entry = g_list_find_custom(priv->interestedfolks, &localfolk, indicate_server_interested_folks_equal); |
3199 | 616 | IndicateServerInterestedFolk * folkpointer = NULL; | 739 | IndicateServerInterestedFolk * folkpointer = NULL; |
3200 | 617 | if (entry == NULL) { | 740 | if (entry == NULL) { |
3202 | 618 | folkpointer = g_new(IndicateServerInterestedFolk, 1); | 741 | folkpointer = g_new0(IndicateServerInterestedFolk, 1); |
3203 | 619 | indicate_server_interested_folks_init(folkpointer, sender); | 742 | indicate_server_interested_folks_init(folkpointer, sender); |
3204 | 620 | priv->interestedfolks = g_list_append(priv->interestedfolks, folkpointer); | 743 | priv->interestedfolks = g_list_append(priv->interestedfolks, folkpointer); |
3205 | 621 | } else { | 744 | } else { |
3206 | @@ -631,6 +754,9 @@ | |||
3207 | 631 | return TRUE; | 754 | return TRUE; |
3208 | 632 | } | 755 | } |
3209 | 633 | 756 | ||
3210 | 757 | /* Removes an interest from a folk. It removes it from the | ||
3211 | 758 | folk structure and then checks to see if that has global | ||
3212 | 759 | effect, and handles it. */ | ||
3213 | 634 | static gboolean | 760 | static gboolean |
3214 | 635 | remove_interest (IndicateServer * server, gchar * sender, IndicateInterests interest) | 761 | remove_interest (IndicateServer * server, gchar * sender, IndicateInterests interest) |
3215 | 636 | { | 762 | { |
3216 | @@ -643,18 +769,24 @@ | |||
3217 | 643 | 769 | ||
3218 | 644 | IndicateServerPrivate * priv = INDICATE_SERVER_GET_PRIVATE(server); | 770 | IndicateServerPrivate * priv = INDICATE_SERVER_GET_PRIVATE(server); |
3219 | 645 | 771 | ||
3220 | 772 | /* Figure out the folk that we're talking to. If we | ||
3221 | 773 | have an entry for them, use it, otherwise we need | ||
3222 | 774 | to create one. */ | ||
3223 | 646 | GList * entry = g_list_find_custom(priv->interestedfolks, &localfolk, indicate_server_interested_folks_equal); | 775 | GList * entry = g_list_find_custom(priv->interestedfolks, &localfolk, indicate_server_interested_folks_equal); |
3224 | 647 | IndicateServerInterestedFolk * folkpointer = NULL; | 776 | IndicateServerInterestedFolk * folkpointer = NULL; |
3225 | 648 | if (entry == NULL) { | 777 | if (entry == NULL) { |
3227 | 649 | folkpointer = g_new(IndicateServerInterestedFolk, 1); | 778 | folkpointer = g_new0(IndicateServerInterestedFolk, 1); |
3228 | 650 | indicate_server_interested_folks_init(folkpointer, sender); | 779 | indicate_server_interested_folks_init(folkpointer, sender); |
3229 | 651 | priv->interestedfolks = g_list_append(priv->interestedfolks, folkpointer); | 780 | priv->interestedfolks = g_list_append(priv->interestedfolks, folkpointer); |
3230 | 652 | } else { | 781 | } else { |
3231 | 653 | folkpointer = (IndicateServerInterestedFolk *)entry->data; | 782 | folkpointer = (IndicateServerInterestedFolk *)entry->data; |
3232 | 654 | } | 783 | } |
3233 | 655 | 784 | ||
3234 | 785 | /* Set the interest for this guy */ | ||
3235 | 656 | indicate_server_interested_folks_set(folkpointer, interest, FALSE); | 786 | indicate_server_interested_folks_set(folkpointer, interest, FALSE); |
3236 | 657 | 787 | ||
3237 | 788 | /* Check to see if the interest has changed as a result of | ||
3238 | 789 | this an announce it to the world */ | ||
3239 | 658 | if (priv->interests[interest]) { | 790 | if (priv->interests[interest]) { |
3240 | 659 | guint i; | 791 | guint i; |
3241 | 660 | for (i = INDICATE_INTEREST_NONE; i < INDICATE_INTEREST_LAST; i++) { | 792 | for (i = INDICATE_INTEREST_NONE; i < INDICATE_INTEREST_LAST; i++) { |
3242 | @@ -675,6 +807,8 @@ | |||
3243 | 675 | return TRUE; | 807 | return TRUE; |
3244 | 676 | } | 808 | } |
3245 | 677 | 809 | ||
3246 | 810 | /* Checks to see if a particular interest value is | ||
3247 | 811 | set. Uses the interest cache. */ | ||
3248 | 678 | static gboolean | 812 | static gboolean |
3249 | 679 | check_interest (IndicateServer * server, IndicateInterests interest) | 813 | check_interest (IndicateServer * server, IndicateInterests interest) |
3250 | 680 | { | 814 | { |
3251 | @@ -682,12 +816,109 @@ | |||
3252 | 682 | return priv->interests[interest]; | 816 | return priv->interests[interest]; |
3253 | 683 | } | 817 | } |
3254 | 684 | 818 | ||
3255 | 819 | /* Internal function that can be subclassed to get | ||
3256 | 820 | the value of the max number of indicators. */ | ||
3257 | 821 | static gint | ||
3258 | 822 | max_indicators_get (IndicateServer * server) | ||
3259 | 823 | { | ||
3260 | 824 | IndicateServerPrivate * priv = INDICATE_SERVER_GET_PRIVATE(server); | ||
3261 | 825 | if (priv->max_indicators == MAX_INDICATORS_UNSET) { | ||
3262 | 826 | return MAX_INDICATORS_INFINITE; | ||
3263 | 827 | } else { | ||
3264 | 828 | return priv->max_indicators; | ||
3265 | 829 | } | ||
3266 | 830 | } | ||
3267 | 831 | |||
3268 | 832 | /* Internal function to set the number of max indicators | ||
3269 | 833 | from a particular listener. */ | ||
3270 | 834 | static gboolean | ||
3271 | 835 | max_indicators_set (IndicateServer * server, gchar * sender, gint max) | ||
3272 | 836 | { | ||
3273 | 837 | g_return_val_if_fail(max >= MAX_INDICATORS_INFINITE, FALSE); | ||
3274 | 838 | |||
3275 | 839 | IndicateServerInterestedFolk localfolk; | ||
3276 | 840 | localfolk.sender = sender; | ||
3277 | 841 | |||
3278 | 842 | IndicateServerPrivate * priv = INDICATE_SERVER_GET_PRIVATE(server); | ||
3279 | 843 | |||
3280 | 844 | /* Figure out the folk that we're talking to. If we | ||
3281 | 845 | have an entry for them, use it, otherwise we need | ||
3282 | 846 | to create one. */ | ||
3283 | 847 | GList * entry = g_list_find_custom(priv->interestedfolks, &localfolk, indicate_server_interested_folks_equal); | ||
3284 | 848 | IndicateServerInterestedFolk * folkpointer = NULL; | ||
3285 | 849 | if (entry == NULL) { | ||
3286 | 850 | folkpointer = g_new0(IndicateServerInterestedFolk, 1); | ||
3287 | 851 | indicate_server_interested_folks_init(folkpointer, sender); | ||
3288 | 852 | priv->interestedfolks = g_list_append(priv->interestedfolks, folkpointer); | ||
3289 | 853 | } else { | ||
3290 | 854 | folkpointer = (IndicateServerInterestedFolk *)entry->data; | ||
3291 | 855 | } | ||
3292 | 856 | |||
3293 | 857 | /* If there's a change going on... */ | ||
3294 | 858 | if (max != folkpointer->max_indicators) { | ||
3295 | 859 | gboolean recalculate = FALSE; | ||
3296 | 860 | /* If this guy is setting it to infinite or is | ||
3297 | 861 | increasing the number */ | ||
3298 | 862 | if ((max == -1 && priv->max_indicators != -1) || max > priv->max_indicators) { | ||
3299 | 863 | recalculate = TRUE; | ||
3300 | 864 | } | ||
3301 | 865 | |||
3302 | 866 | /* Or if potentially we were the ones setting the | ||
3303 | 867 | value for everyone */ | ||
3304 | 868 | if (priv->max_indicators == folkpointer->max_indicators) { | ||
3305 | 869 | recalculate = TRUE; | ||
3306 | 870 | } | ||
3307 | 871 | |||
3308 | 872 | folkpointer->max_indicators = max; | ||
3309 | 873 | if (recalculate) { | ||
3310 | 874 | recalculate_max_indicators(server); | ||
3311 | 875 | } | ||
3312 | 876 | } | ||
3313 | 877 | |||
3314 | 878 | return TRUE; | ||
3315 | 879 | } | ||
3316 | 880 | |||
3317 | 881 | /* Look through all the folks and trying to figure out | ||
3318 | 882 | what the max should be. Signal if it changes. */ | ||
3319 | 883 | static void | ||
3320 | 884 | recalculate_max_indicators (IndicateServer * server) | ||
3321 | 885 | { | ||
3322 | 886 | IndicateServerPrivate * priv = INDICATE_SERVER_GET_PRIVATE(server); | ||
3323 | 887 | |||
3324 | 888 | /* Let's talk to all the folks and see what they | ||
3325 | 889 | think the max should be. */ | ||
3326 | 890 | GList * folkitem; | ||
3327 | 891 | gint newmax = MAX_INDICATORS_UNSET; | ||
3328 | 892 | for (folkitem = priv->interestedfolks; folkitem != NULL; folkitem = g_list_next(folkitem)) { | ||
3329 | 893 | IndicateServerInterestedFolk * thisfolk = (IndicateServerInterestedFolk *)folkitem->data; | ||
3330 | 894 | if (thisfolk->max_indicators == MAX_INDICATORS_UNSET) { | ||
3331 | 895 | continue; | ||
3332 | 896 | } | ||
3333 | 897 | if (thisfolk->max_indicators == MAX_INDICATORS_INFINITE) { | ||
3334 | 898 | newmax = MAX_INDICATORS_INFINITE; | ||
3335 | 899 | break; | ||
3336 | 900 | } | ||
3337 | 901 | if (thisfolk->max_indicators > newmax) { | ||
3338 | 902 | newmax = thisfolk->max_indicators; | ||
3339 | 903 | } | ||
3340 | 904 | } | ||
3341 | 905 | |||
3342 | 906 | /* Okay, what ever happened, now it's changing | ||
3343 | 907 | things and we need to tell everyone. */ | ||
3344 | 908 | if (priv->max_indicators != newmax) { | ||
3345 | 909 | priv->max_indicators = newmax; | ||
3346 | 910 | g_signal_emit(G_OBJECT(server), signals[MAX_INDICATORS_CHANGED], 0, newmax, TRUE); | ||
3347 | 911 | } | ||
3348 | 912 | |||
3349 | 913 | return; | ||
3350 | 914 | } | ||
3351 | 915 | |||
3352 | 685 | static void | 916 | static void |
3353 | 686 | indicator_show_cb (IndicateIndicator * indicator, IndicateServer * server) | 917 | indicator_show_cb (IndicateIndicator * indicator, IndicateServer * server) |
3354 | 687 | { | 918 | { |
3355 | 688 | IndicateServerPrivate * priv = INDICATE_SERVER_GET_PRIVATE(server); | 919 | IndicateServerPrivate * priv = INDICATE_SERVER_GET_PRIVATE(server); |
3356 | 689 | priv->num_hidden--; | 920 | priv->num_hidden--; |
3358 | 690 | g_signal_emit(server, signals[INDICATOR_ADDED], 0, indicate_indicator_get_id(indicator), indicate_indicator_get_indicator_type(indicator), TRUE); | 921 | g_signal_emit(server, signals[INDICATOR_ADDED], 0, indicate_indicator_get_id(indicator), TRUE); |
3359 | 691 | return; | 922 | return; |
3360 | 692 | } | 923 | } |
3361 | 693 | 924 | ||
3362 | @@ -696,7 +927,7 @@ | |||
3363 | 696 | { | 927 | { |
3364 | 697 | IndicateServerPrivate * priv = INDICATE_SERVER_GET_PRIVATE(server); | 928 | IndicateServerPrivate * priv = INDICATE_SERVER_GET_PRIVATE(server); |
3365 | 698 | priv->num_hidden++; | 929 | priv->num_hidden++; |
3367 | 699 | g_signal_emit(server, signals[INDICATOR_REMOVED], 0, indicate_indicator_get_id(indicator), indicate_indicator_get_indicator_type(indicator), TRUE); | 930 | g_signal_emit(server, signals[INDICATOR_REMOVED], 0, indicate_indicator_get_id(indicator), TRUE); |
3368 | 700 | return; | 931 | return; |
3369 | 701 | } | 932 | } |
3370 | 702 | 933 | ||
3371 | @@ -730,7 +961,7 @@ | |||
3372 | 730 | if (!indicate_indicator_is_visible(indicator)) { | 961 | if (!indicate_indicator_is_visible(indicator)) { |
3373 | 731 | priv->num_hidden++; | 962 | priv->num_hidden++; |
3374 | 732 | } else { | 963 | } else { |
3376 | 733 | g_signal_emit(server, signals[INDICATOR_ADDED], 0, indicate_indicator_get_id(indicator), indicate_indicator_get_indicator_type(indicator), TRUE); | 964 | g_signal_emit(server, signals[INDICATOR_ADDED], 0, indicate_indicator_get_id(indicator), TRUE); |
3377 | 734 | } | 965 | } |
3378 | 735 | 966 | ||
3379 | 736 | g_signal_connect(indicator, INDICATE_INDICATOR_SIGNAL_SHOW, G_CALLBACK(indicator_show_cb), server); | 967 | g_signal_connect(indicator, INDICATE_INDICATOR_SIGNAL_SHOW, G_CALLBACK(indicator_show_cb), server); |
3380 | @@ -758,7 +989,7 @@ | |||
3381 | 758 | 989 | ||
3382 | 759 | priv->indicators = g_slist_remove(priv->indicators, indicator); | 990 | priv->indicators = g_slist_remove(priv->indicators, indicator); |
3383 | 760 | if (indicate_indicator_is_visible(indicator)) { | 991 | if (indicate_indicator_is_visible(indicator)) { |
3385 | 761 | g_signal_emit(server, signals[INDICATOR_REMOVED], 0, indicate_indicator_get_id(indicator), indicate_indicator_get_indicator_type(indicator), TRUE); | 992 | g_signal_emit(server, signals[INDICATOR_REMOVED], 0, indicate_indicator_get_id(indicator), TRUE); |
3386 | 762 | } else { | 993 | } else { |
3387 | 763 | priv->num_hidden--; | 994 | priv->num_hidden--; |
3388 | 764 | } | 995 | } |
3389 | @@ -883,54 +1114,6 @@ | |||
3390 | 883 | return TRUE; | 1114 | return TRUE; |
3391 | 884 | } | 1115 | } |
3392 | 885 | 1116 | ||
3393 | 886 | typedef struct { | ||
3394 | 887 | gchar * type; | ||
3395 | 888 | guint count; | ||
3396 | 889 | } count_by_t; | ||
3397 | 890 | |||
3398 | 891 | static void | ||
3399 | 892 | count_by_type (IndicateIndicator * indicator, count_by_t * cbt) | ||
3400 | 893 | { | ||
3401 | 894 | g_return_if_fail(INDICATE_IS_INDICATOR(indicator)); | ||
3402 | 895 | if (!indicate_indicator_is_visible(indicator)) { | ||
3403 | 896 | return; | ||
3404 | 897 | } | ||
3405 | 898 | |||
3406 | 899 | const gchar * type = indicate_indicator_get_indicator_type(indicator); | ||
3407 | 900 | /* g_debug("Looking for indicator of type '%s' and have type '%s'", cbt->type, type); */ | ||
3408 | 901 | |||
3409 | 902 | if (type == NULL && cbt->type == NULL) { | ||
3410 | 903 | cbt->count++; | ||
3411 | 904 | } else if (type == NULL || cbt->type == NULL) { | ||
3412 | 905 | } else if (!g_strcmp0(type, cbt->type)) { | ||
3413 | 906 | cbt->count++; | ||
3414 | 907 | } | ||
3415 | 908 | |||
3416 | 909 | return; | ||
3417 | 910 | } | ||
3418 | 911 | |||
3419 | 912 | static gboolean | ||
3420 | 913 | get_indicator_count_by_type (IndicateServer * server, gchar * type, guint * count, GError **error) | ||
3421 | 914 | { | ||
3422 | 915 | /* g_debug("get_indicator_count_by_type: '%s'", type); */ | ||
3423 | 916 | count_by_t cbt; | ||
3424 | 917 | cbt.type = type; | ||
3425 | 918 | cbt.count = 0; | ||
3426 | 919 | |||
3427 | 920 | /* Handle the NULL string case as NULL itself, we're a big | ||
3428 | 921 | boy language; we have pointers. */ | ||
3429 | 922 | if (cbt.type != NULL && cbt.type[0] == '\0') { | ||
3430 | 923 | cbt.type = NULL; | ||
3431 | 924 | } | ||
3432 | 925 | |||
3433 | 926 | IndicateServerPrivate * priv = INDICATE_SERVER_GET_PRIVATE(server); | ||
3434 | 927 | |||
3435 | 928 | g_slist_foreach(priv->indicators, (GFunc)count_by_type, &cbt); | ||
3436 | 929 | *count = cbt.count; | ||
3437 | 930 | |||
3438 | 931 | return TRUE; | ||
3439 | 932 | } | ||
3440 | 933 | |||
3441 | 934 | static gboolean | 1117 | static gboolean |
3442 | 935 | get_indicator_list (IndicateServer * server, GArray ** indicators, GError ** error) | 1118 | get_indicator_list (IndicateServer * server, GArray ** indicators, GError ** error) |
3443 | 936 | { | 1119 | { |
3444 | @@ -956,44 +1139,6 @@ | |||
3445 | 956 | return TRUE; | 1139 | return TRUE; |
3446 | 957 | } | 1140 | } |
3447 | 958 | 1141 | ||
3448 | 959 | static gboolean | ||
3449 | 960 | get_indicator_list_by_type (IndicateServer * server, gchar * type, GArray ** indicators, GError ** error) | ||
3450 | 961 | { | ||
3451 | 962 | g_return_val_if_fail(INDICATE_IS_SERVER(server), TRUE); | ||
3452 | 963 | |||
3453 | 964 | IndicateServerClass * class = INDICATE_SERVER_GET_CLASS(server); | ||
3454 | 965 | g_return_val_if_fail(class->get_indicator_count != NULL, TRUE); | ||
3455 | 966 | |||
3456 | 967 | if (type != NULL && type[0] == '\0') { | ||
3457 | 968 | type = NULL; | ||
3458 | 969 | } | ||
3459 | 970 | |||
3460 | 971 | IndicateServerPrivate * priv = INDICATE_SERVER_GET_PRIVATE(server); | ||
3461 | 972 | |||
3462 | 973 | /* Can't be larger than this and it's not worth the reallocation | ||
3463 | 974 | for the small number we have. The memory isn't worth the time. */ | ||
3464 | 975 | *indicators = g_array_sized_new(FALSE, FALSE, sizeof(guint), g_slist_length(priv->indicators) - priv->num_hidden); | ||
3465 | 976 | |||
3466 | 977 | GSList * iter; | ||
3467 | 978 | int i; | ||
3468 | 979 | for (iter = priv->indicators, i = 0; iter != NULL; iter = iter->next) { | ||
3469 | 980 | IndicateIndicator * indicator = INDICATE_INDICATOR(iter->data); | ||
3470 | 981 | if (indicate_indicator_is_visible(indicator)) { | ||
3471 | 982 | const gchar * itype = indicate_indicator_get_indicator_type(indicator); | ||
3472 | 983 | guint id = indicate_indicator_get_id(indicator); | ||
3473 | 984 | |||
3474 | 985 | if (type == NULL && itype == NULL) { | ||
3475 | 986 | g_array_insert_val(*indicators, i++, id); | ||
3476 | 987 | } else if (type == NULL || itype == NULL) { | ||
3477 | 988 | } else if (!g_strcmp0(type, itype)) { | ||
3478 | 989 | g_array_insert_val(*indicators, i++, id); | ||
3479 | 990 | } | ||
3480 | 991 | } | ||
3481 | 992 | } | ||
3482 | 993 | |||
3483 | 994 | return TRUE; | ||
3484 | 995 | } | ||
3485 | 996 | |||
3486 | 997 | static IndicateIndicator * | 1142 | static IndicateIndicator * |
3487 | 998 | get_indicator (IndicateServer * server, guint id, GError **error) | 1143 | get_indicator (IndicateServer * server, guint id, GError **error) |
3488 | 999 | { | 1144 | { |
3489 | @@ -1087,6 +1232,45 @@ | |||
3490 | 1087 | return TRUE; | 1232 | return TRUE; |
3491 | 1088 | } | 1233 | } |
3492 | 1089 | 1234 | ||
3493 | 1235 | /* A function representing when an indicator is shown | ||
3494 | 1236 | to the user in some form. First it sees if we've talked | ||
3495 | 1237 | to this listener before and uses that entry. Otherwise, we | ||
3496 | 1238 | build one. If we're displaying it, things are good, we can | ||
3497 | 1239 | just set that. If we're not, then we need to check to see | ||
3498 | 1240 | if anyone else is before continuing. */ | ||
3499 | 1241 | static gboolean | ||
3500 | 1242 | indicator_displayed (IndicateServer * server, gchar * sender, guint id, gboolean displayed, GError ** error) | ||
3501 | 1243 | { | ||
3502 | 1244 | IndicateServerInterestedFolk localfolk; | ||
3503 | 1245 | localfolk.sender = sender; | ||
3504 | 1246 | |||
3505 | 1247 | IndicateServerPrivate * priv = INDICATE_SERVER_GET_PRIVATE(server); | ||
3506 | 1248 | |||
3507 | 1249 | GList * entry = g_list_find_custom(priv->interestedfolks, &localfolk, indicate_server_interested_folks_equal); | ||
3508 | 1250 | IndicateServerInterestedFolk * folkpointer = NULL; | ||
3509 | 1251 | if (entry == NULL) { | ||
3510 | 1252 | folkpointer = g_new0(IndicateServerInterestedFolk, 1); | ||
3511 | 1253 | indicate_server_interested_folks_init(folkpointer, sender); | ||
3512 | 1254 | priv->interestedfolks = g_list_append(priv->interestedfolks, folkpointer); | ||
3513 | 1255 | } else { | ||
3514 | 1256 | folkpointer = (IndicateServerInterestedFolk *)entry->data; | ||
3515 | 1257 | } | ||
3516 | 1258 | |||
3517 | 1259 | g_hash_table_insert(folkpointer->indicators_displayed, GUINT_TO_POINTER(id), GUINT_TO_POINTER(displayed)); | ||
3518 | 1260 | |||
3519 | 1261 | if (displayed) { | ||
3520 | 1262 | IndicateIndicator * indicator = get_indicator(server, id, error); | ||
3521 | 1263 | if (indicator == NULL) { | ||
3522 | 1264 | return FALSE; | ||
3523 | 1265 | } | ||
3524 | 1266 | |||
3525 | 1267 | indicate_indicator_set_displayed(indicator, displayed); | ||
3526 | 1268 | } else { | ||
3527 | 1269 | recalculate_indicator_displayed(server, id); | ||
3528 | 1270 | } | ||
3529 | 1271 | |||
3530 | 1272 | return TRUE; | ||
3531 | 1273 | } | ||
3532 | 1090 | 1274 | ||
3533 | 1091 | /* Virtual Functions */ | 1275 | /* Virtual Functions */ |
3534 | 1092 | gboolean | 1276 | gboolean |
3535 | @@ -1111,27 +1295,6 @@ | |||
3536 | 1111 | } | 1295 | } |
3537 | 1112 | 1296 | ||
3538 | 1113 | gboolean | 1297 | gboolean |
3539 | 1114 | _indicate_server_get_indicator_count_by_type (IndicateServer * server, gchar * type, guint * count, GError **error) | ||
3540 | 1115 | { | ||
3541 | 1116 | IndicateServerClass * class = INDICATE_SERVER_GET_CLASS(server); | ||
3542 | 1117 | |||
3543 | 1118 | if (class != NULL && class->get_indicator_count_by_type != NULL) { | ||
3544 | 1119 | return class->get_indicator_count_by_type (server, type, count, error); | ||
3545 | 1120 | } | ||
3546 | 1121 | |||
3547 | 1122 | if (error) { | ||
3548 | 1123 | g_set_error(error, | ||
3549 | 1124 | indicate_server_error_quark(), | ||
3550 | 1125 | NO_GET_INDICATOR_COUNT_BY_TYPE, | ||
3551 | 1126 | "get_indicator_count_by_type function doesn't exist for this server class: %s", | ||
3552 | 1127 | G_OBJECT_TYPE_NAME(server)); | ||
3553 | 1128 | return FALSE; | ||
3554 | 1129 | } | ||
3555 | 1130 | |||
3556 | 1131 | return TRUE; | ||
3557 | 1132 | } | ||
3558 | 1133 | |||
3559 | 1134 | gboolean | ||
3560 | 1135 | _indicate_server_get_indicator_list (IndicateServer * server, GArray ** indicators, GError ** error) | 1298 | _indicate_server_get_indicator_list (IndicateServer * server, GArray ** indicators, GError ** error) |
3561 | 1136 | { | 1299 | { |
3562 | 1137 | IndicateServerClass * class = INDICATE_SERVER_GET_CLASS(server); | 1300 | IndicateServerClass * class = INDICATE_SERVER_GET_CLASS(server); |
3563 | @@ -1153,27 +1316,6 @@ | |||
3564 | 1153 | } | 1316 | } |
3565 | 1154 | 1317 | ||
3566 | 1155 | gboolean | 1318 | gboolean |
3567 | 1156 | _indicate_server_get_indicator_list_by_type (IndicateServer * server, gchar * type, GArray ** indicators, GError ** error) | ||
3568 | 1157 | { | ||
3569 | 1158 | IndicateServerClass * class = INDICATE_SERVER_GET_CLASS(server); | ||
3570 | 1159 | |||
3571 | 1160 | if (class != NULL && class->get_indicator_list_by_type != NULL) { | ||
3572 | 1161 | return class->get_indicator_list_by_type (server, type, indicators, error); | ||
3573 | 1162 | } | ||
3574 | 1163 | |||
3575 | 1164 | if (error) { | ||
3576 | 1165 | g_set_error(error, | ||
3577 | 1166 | indicate_server_error_quark(), | ||
3578 | 1167 | NO_GET_INDICATOR_LIST_BY_TYPE, | ||
3579 | 1168 | "get_indicator_list_by_type function doesn't exist for this server class: %s", | ||
3580 | 1169 | G_OBJECT_TYPE_NAME(server)); | ||
3581 | 1170 | return FALSE; | ||
3582 | 1171 | } | ||
3583 | 1172 | |||
3584 | 1173 | return TRUE; | ||
3585 | 1174 | } | ||
3586 | 1175 | |||
3587 | 1176 | gboolean | ||
3588 | 1177 | _indicate_server_get_indicator_property (IndicateServer * server, guint id, gchar * property, gchar ** value, GError **error) | 1319 | _indicate_server_get_indicator_property (IndicateServer * server, guint id, gchar * property, gchar ** value, GError **error) |
3589 | 1178 | { | 1320 | { |
3590 | 1179 | IndicateServerClass * class = INDICATE_SERVER_GET_CLASS(server); | 1321 | IndicateServerClass * class = INDICATE_SERVER_GET_CLASS(server); |
3591 | @@ -1257,6 +1399,36 @@ | |||
3592 | 1257 | return TRUE; | 1399 | return TRUE; |
3593 | 1258 | } | 1400 | } |
3594 | 1259 | 1401 | ||
3595 | 1402 | /* DBus function to wrap a virtual function call so that | ||
3596 | 1403 | it can be subclassed if someone so chooses */ | ||
3597 | 1404 | gboolean | ||
3598 | 1405 | _indicate_server_indicator_displayed (IndicateServer * server, guint id, gboolean displayed, DBusGMethodInvocation * method) | ||
3599 | 1406 | { | ||
3600 | 1407 | IndicateServerClass * class = INDICATE_SERVER_GET_CLASS(server); | ||
3601 | 1408 | |||
3602 | 1409 | if (class != NULL && class->indicator_displayed != NULL) { | ||
3603 | 1410 | GError * error = NULL; | ||
3604 | 1411 | if (class->indicator_displayed (server, dbus_g_method_get_sender(method), id, displayed, &error)) { | ||
3605 | 1412 | dbus_g_method_return(method); | ||
3606 | 1413 | return TRUE; | ||
3607 | 1414 | } else { | ||
3608 | 1415 | dbus_g_method_return_error(method, error); | ||
3609 | 1416 | g_error_free(error); | ||
3610 | 1417 | return FALSE; | ||
3611 | 1418 | } | ||
3612 | 1419 | } | ||
3613 | 1420 | |||
3614 | 1421 | GError * error = NULL; | ||
3615 | 1422 | g_set_error(&error, | ||
3616 | 1423 | indicate_server_error_quark(), | ||
3617 | 1424 | NO_INDICATOR_DISPLAYED, | ||
3618 | 1425 | "indicator_displayed function doesn't exist for this server class: %s", | ||
3619 | 1426 | G_OBJECT_TYPE_NAME(server)); | ||
3620 | 1427 | dbus_g_method_return_error(method, error); | ||
3621 | 1428 | g_error_free(error); | ||
3622 | 1429 | return FALSE; | ||
3623 | 1430 | } | ||
3624 | 1431 | |||
3625 | 1260 | /** | 1432 | /** |
3626 | 1261 | indicate_server_get_next_id: | 1433 | indicate_server_get_next_id: |
3627 | 1262 | @server: The #IndicateServer the ID will be on | 1434 | @server: The #IndicateServer the ID will be on |
3628 | @@ -1316,10 +1488,10 @@ | |||
3629 | 1316 | } else { | 1488 | } else { |
3630 | 1317 | GError * error; | 1489 | GError * error; |
3631 | 1318 | g_set_error(&error, | 1490 | g_set_error(&error, |
3636 | 1319 | indicate_server_error_quark(), | 1491 | indicate_server_error_quark(), |
3637 | 1320 | SHOW_INTEREST_FAILED, | 1492 | SHOW_INTEREST_FAILED, |
3638 | 1321 | "Unable to show interest: %s", | 1493 | "Unable to show interest: %s", |
3639 | 1322 | interest); | 1494 | interest); |
3640 | 1323 | dbus_g_method_return_error(method, error); | 1495 | dbus_g_method_return_error(method, error); |
3641 | 1324 | g_error_free(error); | 1496 | g_error_free(error); |
3642 | 1325 | return FALSE; | 1497 | return FALSE; |
3643 | @@ -1328,10 +1500,10 @@ | |||
3644 | 1328 | 1500 | ||
3645 | 1329 | GError * error; | 1501 | GError * error; |
3646 | 1330 | g_set_error(&error, | 1502 | g_set_error(&error, |
3651 | 1331 | indicate_server_error_quark(), | 1503 | indicate_server_error_quark(), |
3652 | 1332 | NO_SHOW_INTEREST, | 1504 | NO_SHOW_INTEREST, |
3653 | 1333 | "show_interest function doesn't exist for this server class: %s", | 1505 | "show_interest function doesn't exist for this server class: %s", |
3654 | 1334 | G_OBJECT_TYPE_NAME(server)); | 1506 | G_OBJECT_TYPE_NAME(server)); |
3655 | 1335 | dbus_g_method_return_error(method, error); | 1507 | dbus_g_method_return_error(method, error); |
3656 | 1336 | g_error_free(error); | 1508 | g_error_free(error); |
3657 | 1337 | return FALSE; | 1509 | return FALSE; |
3658 | @@ -1370,6 +1542,39 @@ | |||
3659 | 1370 | return FALSE; | 1542 | return FALSE; |
3660 | 1371 | } | 1543 | } |
3661 | 1372 | 1544 | ||
3662 | 1545 | gboolean | ||
3663 | 1546 | _indicate_server_set_max_indicators (IndicateServer * server, gint max, DBusGMethodInvocation * method) | ||
3664 | 1547 | { | ||
3665 | 1548 | IndicateServerClass * class = INDICATE_SERVER_GET_CLASS(server); | ||
3666 | 1549 | |||
3667 | 1550 | if (class != NULL && class->max_indicators_set != NULL) { | ||
3668 | 1551 | if (class->max_indicators_set (server, dbus_g_method_get_sender(method), max)){ | ||
3669 | 1552 | dbus_g_method_return(method); | ||
3670 | 1553 | return TRUE; | ||
3671 | 1554 | } else { | ||
3672 | 1555 | GError * error; | ||
3673 | 1556 | g_set_error(&error, | ||
3674 | 1557 | indicate_server_error_quark(), | ||
3675 | 1558 | MAX_INDICATORS_SET_FAILED, | ||
3676 | 1559 | "Unable to set max indicators: %d", | ||
3677 | 1560 | max); | ||
3678 | 1561 | dbus_g_method_return_error(method, error); | ||
3679 | 1562 | g_error_free(error); | ||
3680 | 1563 | return FALSE; | ||
3681 | 1564 | } | ||
3682 | 1565 | } | ||
3683 | 1566 | |||
3684 | 1567 | GError * error; | ||
3685 | 1568 | g_set_error(&error, | ||
3686 | 1569 | indicate_server_error_quark(), | ||
3687 | 1570 | NO_MAX_INDICATORS_SET, | ||
3688 | 1571 | "max_indicators_set function doesn't exist for this server class: %s", | ||
3689 | 1572 | G_OBJECT_TYPE_NAME(server)); | ||
3690 | 1573 | dbus_g_method_return_error(method, error); | ||
3691 | 1574 | g_error_free(error); | ||
3692 | 1575 | return FALSE; | ||
3693 | 1576 | } | ||
3694 | 1577 | |||
3695 | 1373 | /** | 1578 | /** |
3696 | 1374 | indicate_server_check_interest: | 1579 | indicate_server_check_interest: |
3697 | 1375 | @server: The #IndicateServer being checked | 1580 | @server: The #IndicateServer being checked |
3698 | @@ -1394,85 +1599,40 @@ | |||
3699 | 1394 | return FALSE; | 1599 | return FALSE; |
3700 | 1395 | } | 1600 | } |
3701 | 1396 | 1601 | ||
3771 | 1397 | /* Signal emission functions for sub-classes of the server */ | 1602 | /** |
3772 | 1398 | 1603 | indicate_server_get_max_indicators: | |
3773 | 1399 | /** | 1604 | @server: The #IndicateServer being checked |
3774 | 1400 | indicate_server_emit_indicator_added: | 1605 | |
3775 | 1401 | @server: The #IndicateServer being represented | 1606 | This function looks at everyone listening and determines |
3776 | 1402 | @id: The ID of the indicator being added | 1607 | the max number of indicators that can be shown to anyone. |
3777 | 1403 | @type: The type of the indicator | 1608 | |
3778 | 1404 | 1609 | Return value: A max number or -1 for unlimited. | |
3779 | 1405 | This function emits the #IndicateServer::indicator-added signal and is | 1610 | */ |
3780 | 1406 | used by subclasses. | 1611 | gint |
3781 | 1407 | */ | 1612 | indicate_server_get_max_indicators (IndicateServer * server) |
3782 | 1408 | void | 1613 | { |
3783 | 1409 | indicate_server_emit_indicator_added (IndicateServer *server, guint id, const gchar *type) | 1614 | IndicateServerClass * class = INDICATE_SERVER_GET_CLASS(server); |
3784 | 1410 | { | 1615 | |
3785 | 1411 | g_return_if_fail (INDICATE_IS_SERVER (server)); | 1616 | if (class != NULL && class->max_indicators_get != NULL) { |
3786 | 1412 | g_return_if_fail (type); | 1617 | return class->max_indicators_get (server); |
3787 | 1413 | 1618 | } | |
3788 | 1414 | g_signal_emit(server, signals[INDICATOR_ADDED], 0, id, type); | 1619 | |
3789 | 1415 | } | 1620 | g_warning("get_max_indicators function not implemented in this server class: %s", G_OBJECT_TYPE_NAME(server)); |
3790 | 1416 | 1621 | return -1; | |
3722 | 1417 | /** | ||
3723 | 1418 | indicate_server_emit_indicator_removed: | ||
3724 | 1419 | @server: The #IndicateServer being represented | ||
3725 | 1420 | @id: The ID of the indicator being removed | ||
3726 | 1421 | @type: The type of the indicator | ||
3727 | 1422 | |||
3728 | 1423 | This function emits the #IndicateServer::indicator-removed signal and is | ||
3729 | 1424 | used by subclasses. | ||
3730 | 1425 | */ | ||
3731 | 1426 | void | ||
3732 | 1427 | indicate_server_emit_indicator_removed (IndicateServer *server, guint id, const gchar *type) | ||
3733 | 1428 | { | ||
3734 | 1429 | g_return_if_fail (INDICATE_IS_SERVER (server)); | ||
3735 | 1430 | g_return_if_fail (type); | ||
3736 | 1431 | |||
3737 | 1432 | g_signal_emit(server, signals[INDICATOR_REMOVED], 0, id, type); | ||
3738 | 1433 | } | ||
3739 | 1434 | |||
3740 | 1435 | /** | ||
3741 | 1436 | indicate_server_emit_indicator_modified: | ||
3742 | 1437 | @server: The #IndicateServer being represented | ||
3743 | 1438 | @id: The ID of the indicator with the modified property | ||
3744 | 1439 | @property: The name of the property being modified | ||
3745 | 1440 | |||
3746 | 1441 | This function emits the #IndicateServer::indicator-modified signal and is | ||
3747 | 1442 | used by subclasses. | ||
3748 | 1443 | */ | ||
3749 | 1444 | void | ||
3750 | 1445 | indicate_server_emit_indicator_modified (IndicateServer *server, guint id, const gchar *property) | ||
3751 | 1446 | { | ||
3752 | 1447 | g_return_if_fail (INDICATE_IS_SERVER (server)); | ||
3753 | 1448 | g_return_if_fail (property); | ||
3754 | 1449 | |||
3755 | 1450 | g_signal_emit(server, signals[INDICATOR_MODIFIED], 0, id, property); | ||
3756 | 1451 | } | ||
3757 | 1452 | |||
3758 | 1453 | /** | ||
3759 | 1454 | indicate_server_emit_server_display: | ||
3760 | 1455 | @server: The #IndicateServer being displayed | ||
3761 | 1456 | |||
3762 | 1457 | This function emits the #IndicateServer::server-display signal and is | ||
3763 | 1458 | used by subclasses. | ||
3764 | 1459 | */ | ||
3765 | 1460 | void | ||
3766 | 1461 | indicate_server_emit_server_display (IndicateServer *server) | ||
3767 | 1462 | { | ||
3768 | 1463 | g_return_if_fail (INDICATE_IS_SERVER (server)); | ||
3769 | 1464 | |||
3770 | 1465 | g_signal_emit(server, signals[SERVER_DISPLAY], 0, TRUE); | ||
3791 | 1466 | } | 1622 | } |
3792 | 1467 | 1623 | ||
3793 | 1468 | /* *** Folks stuff *** */ | 1624 | /* *** Folks stuff *** */ |
3794 | 1469 | 1625 | ||
3795 | 1626 | /* This checks for folk by looking at the sender value | ||
3796 | 1627 | and sees if we can find any that have the same sender. */ | ||
3797 | 1470 | static gint | 1628 | static gint |
3798 | 1471 | indicate_server_interested_folks_equal (gconstpointer a, gconstpointer b) | 1629 | indicate_server_interested_folks_equal (gconstpointer a, gconstpointer b) |
3799 | 1472 | { | 1630 | { |
3800 | 1473 | return g_strcmp0(((IndicateServerInterestedFolk *)a)->sender,((IndicateServerInterestedFolk *)b)->sender); | 1631 | return g_strcmp0(((IndicateServerInterestedFolk *)a)->sender,((IndicateServerInterestedFolk *)b)->sender); |
3801 | 1474 | } | 1632 | } |
3802 | 1475 | 1633 | ||
3803 | 1634 | /* Creates a IndicateServerInterestedFolk structure and | ||
3804 | 1635 | initializes the default values to reasonable defaults. */ | ||
3805 | 1476 | static void | 1636 | static void |
3806 | 1477 | indicate_server_interested_folks_init (IndicateServerInterestedFolk * folk, gchar * sender) | 1637 | indicate_server_interested_folks_init (IndicateServerInterestedFolk * folk, gchar * sender) |
3807 | 1478 | { | 1638 | { |
3808 | @@ -1483,9 +1643,14 @@ | |||
3809 | 1483 | folk->interests[i] = FALSE; | 1643 | folk->interests[i] = FALSE; |
3810 | 1484 | } | 1644 | } |
3811 | 1485 | 1645 | ||
3812 | 1646 | folk->max_indicators = MAX_INDICATORS_UNSET; | ||
3813 | 1647 | |||
3814 | 1648 | folk->indicators_displayed = g_hash_table_new(g_direct_hash, g_direct_equal); | ||
3815 | 1649 | |||
3816 | 1486 | return; | 1650 | return; |
3817 | 1487 | } | 1651 | } |
3818 | 1488 | 1652 | ||
3819 | 1653 | /* Identifies an interest in the folk. */ | ||
3820 | 1489 | static void | 1654 | static void |
3821 | 1490 | indicate_server_interested_folks_set (IndicateServerInterestedFolk * folk, IndicateInterests interest, gboolean value) | 1655 | indicate_server_interested_folks_set (IndicateServerInterestedFolk * folk, IndicateInterests interest, gboolean value) |
3822 | 1491 | { | 1656 | { |
3823 | @@ -1493,6 +1658,8 @@ | |||
3824 | 1493 | return; | 1658 | return; |
3825 | 1494 | } | 1659 | } |
3826 | 1495 | 1660 | ||
3827 | 1661 | /* Copies the interest table from a folk structure into a | ||
3828 | 1662 | generic gboolean array of length INDICATE_INTEREST_LAST */ | ||
3829 | 1496 | static void | 1663 | static void |
3830 | 1497 | indicate_server_interested_folks_copy (IndicateServerInterestedFolk * folk, gboolean * interests) | 1664 | indicate_server_interested_folks_copy (IndicateServerInterestedFolk * folk, gboolean * interests) |
3831 | 1498 | { | 1665 | { |
3832 | @@ -1506,11 +1673,15 @@ | |||
3833 | 1506 | return; | 1673 | return; |
3834 | 1507 | } | 1674 | } |
3835 | 1508 | 1675 | ||
3836 | 1676 | /* Destroys all the internal parts of the IndicateServerInterestedFolk | ||
3837 | 1677 | and then destroys the structure itself */ | ||
3838 | 1509 | static void | 1678 | static void |
3839 | 1510 | indicate_server_interested_folks_destroy(IndicateServerInterestedFolk * folk) | 1679 | indicate_server_interested_folks_destroy(IndicateServerInterestedFolk * folk) |
3840 | 1511 | { | 1680 | { |
3841 | 1512 | g_free(folk->sender); | 1681 | g_free(folk->sender); |
3842 | 1682 | g_hash_table_destroy(folk->indicators_displayed); | ||
3843 | 1513 | g_free(folk); | 1683 | g_free(folk); |
3844 | 1514 | return; | 1684 | return; |
3845 | 1515 | } | 1685 | } |
3846 | 1686 | |||
3847 | 1516 | /* *** End Folks *** */ | 1687 | /* *** End Folks *** */ |
3848 | 1517 | 1688 | ||
3849 | === modified file 'libindicate/server.h' | |||
3850 | --- libindicate/server.h 2009-08-03 17:50:57 +0000 | |||
3851 | +++ libindicate/server.h 2009-09-08 21:57:25 +0000 | |||
3852 | @@ -47,14 +47,26 @@ | |||
3853 | 47 | 47 | ||
3854 | 48 | #define INDICATE_SERVER_INDICATOR_NULL (0) | 48 | #define INDICATE_SERVER_INDICATOR_NULL (0) |
3855 | 49 | 49 | ||
3864 | 50 | #define INDICATE_SERVER_SIGNAL_INDICATOR_ADDED "indicator-added" | 50 | #define INDICATE_SERVER_SIGNAL_INDICATOR_ADDED "indicator-new" |
3865 | 51 | #define INDICATE_SERVER_SIGNAL_INDICATOR_REMOVED "indicator-removed" | 51 | #define INDICATE_SERVER_SIGNAL_INDICATOR_ADDED_ID (g_signal_lookup(INDICATE_SERVER_SIGNAL_INDICATOR_ADDED, INDICATE_TYPE_SERVER)) |
3866 | 52 | #define INDICATE_SERVER_SIGNAL_INDICATOR_MODIFIED "indicator-modified" | 52 | #define INDICATE_SERVER_SIGNAL_INDICATOR_REMOVED "indicator-delete" |
3867 | 53 | #define INDICATE_SERVER_SIGNAL_SERVER_SHOW "server-show" | 53 | #define INDICATE_SERVER_SIGNAL_INDICATOR_REMOVED_ID (g_signal_lookup(INDICATE_SERVER_SIGNAL_INDICATOR_REMOVED, INDICATE_TYPE_SERVER)) |
3868 | 54 | #define INDICATE_SERVER_SIGNAL_SERVER_HIDE "server-hide" | 54 | #define INDICATE_SERVER_SIGNAL_INDICATOR_MODIFIED "indicator-modified" |
3869 | 55 | #define INDICATE_SERVER_SIGNAL_SERVER_DISPLAY "server-display" | 55 | #define INDICATE_SERVER_SIGNAL_INDICATOR_MODIFIED_ID (g_signal_lookup(INDICATE_SERVER_SIGNAL_INDICATOR_MODIFIED, INDICATE_TYPE_SERVER)) |
3870 | 56 | #define INDICATE_SERVER_SIGNAL_INTEREST_ADDED "interest-added" | 56 | #define INDICATE_SERVER_SIGNAL_SERVER_SHOW "server-show" |
3871 | 57 | #define INDICATE_SERVER_SIGNAL_INTEREST_REMOVED "interest-removed" | 57 | #define INDICATE_SERVER_SIGNAL_SERVER_SHOW_ID (g_signal_lookup(INDICATE_SERVER_SIGNAL_SERVER_SHOW, INDICATE_TYPE_SERVER)) |
3872 | 58 | #define INDICATE_SERVER_SIGNAL_SERVER_HIDE "server-hide" | ||
3873 | 59 | #define INDICATE_SERVER_SIGNAL_SERVER_HIDE_ID (g_signal_lookup(INDICATE_SERVER_SIGNAL_SERVER_HIDE, INDICATE_TYPE_SERVER)) | ||
3874 | 60 | #define INDICATE_SERVER_SIGNAL_SERVER_DISPLAY "server-display" | ||
3875 | 61 | #define INDICATE_SERVER_SIGNAL_SERVER_DISPLAY_ID (g_signal_lookup(INDICATE_SERVER_SIGNAL_SERVER_DISPLAY, INDICATE_TYPE_SERVER)) | ||
3876 | 62 | #define INDICATE_SERVER_SIGNAL_INTEREST_ADDED "interest-added" | ||
3877 | 63 | #define INDICATE_SERVER_SIGNAL_INTEREST_ADDED_ID (g_signal_lookup(INDICATE_SERVER_SIGNAL_INTEREST_ADDED, INDICATE_TYPE_SERVER)) | ||
3878 | 64 | #define INDICATE_SERVER_SIGNAL_INTEREST_REMOVED "interest-removed" | ||
3879 | 65 | #define INDICATE_SERVER_SIGNAL_INTEREST_REMOVED_ID (g_signal_lookup(INDICATE_SERVER_SIGNAL_INTEREST_REMOVED, INDICATE_TYPE_SERVER)) | ||
3880 | 66 | #define INDICATE_SERVER_SIGNAL_MAX_INDICATORS_CHANGED "max-indicators-changed" | ||
3881 | 67 | #define INDICATE_SERVER_SIGNAL_MAX_INDICATORS_CHANGED_ID (g_signal_lookup(INDICATE_SERVER_SIGNAL_MAX_INDICATORS_CHANGED, INDICATE_TYPE_SERVER)) | ||
3882 | 68 | #define INDICATE_SERVER_SIGNAL_SERVER_COUNT_CHANGED "server-count-changed" | ||
3883 | 69 | #define INDICATE_SERVER_SIGNAL_SERVER_COUNT_CHANGED_ID (g_signal_lookup(INDICATE_SERVER_SIGNAL_SERVER_COUNT_CHANGED, INDICATE_TYPE_SERVER)) | ||
3884 | 58 | 70 | ||
3885 | 59 | /** | 71 | /** |
3886 | 60 | IndicateServer: | 72 | IndicateServer: |
3887 | @@ -84,13 +96,11 @@ | |||
3888 | 84 | @server_display: Slot for #IndicateServer::server-display. | 96 | @server_display: Slot for #IndicateServer::server-display. |
3889 | 85 | @interest_added: Slot for #IndicateServer::interest-added. | 97 | @interest_added: Slot for #IndicateServer::interest-added. |
3890 | 86 | @interest_removed: Slot for #IndicateServer::interest-removed. | 98 | @interest_removed: Slot for #IndicateServer::interest-removed. |
3891 | 99 | @max_indicators_changed: Slot for #IndicateServer::max-indicators-changed. | ||
3892 | 100 | @server_count_changed: Slot for #IndicateServer::server-count-changed. | ||
3893 | 87 | @get_indicator_count: Returns the number of indicators that are visible | 101 | @get_indicator_count: Returns the number of indicators that are visible |
3894 | 88 | on the bus. Hidden indicators should not be counted. | 102 | on the bus. Hidden indicators should not be counted. |
3895 | 89 | @get_indicator_count_by_type: Returns the number of indicators that are | ||
3896 | 90 | of a given type and visible on the bus. | ||
3897 | 91 | @get_indicator_list: List all of the indicators that are visible. | 103 | @get_indicator_list: List all of the indicators that are visible. |
3898 | 92 | @get_indicator_list_by_type: List all of the indicators of a given | ||
3899 | 93 | type that are visible. | ||
3900 | 94 | @get_indicator_property: Get a property from a particular indicator. | 104 | @get_indicator_property: Get a property from a particular indicator. |
3901 | 95 | @get_indicator_property_group: Get the values for a set of properties | 105 | @get_indicator_property_group: Get the values for a set of properties |
3902 | 96 | as an array of entries, returning an array as well. | 106 | as an array of entries, returning an array as well. |
3903 | @@ -98,6 +108,8 @@ | |||
3904 | 98 | on a particular indicator. | 108 | on a particular indicator. |
3905 | 99 | @show_indicator_to_user: Respond to someone on the bus asking to show | 109 | @show_indicator_to_user: Respond to someone on the bus asking to show |
3906 | 100 | a particular indicator to the user. | 110 | a particular indicator to the user. |
3907 | 111 | @indicator_displayed: An indicator has been visualized by the listener | ||
3908 | 112 | or it hasn't. This function tracks that. | ||
3909 | 101 | @get_next_id: Get the next unused indicator ID. | 113 | @get_next_id: Get the next unused indicator ID. |
3910 | 102 | @show_interest: React to someone signifying that they are interested | 114 | @show_interest: React to someone signifying that they are interested |
3911 | 103 | in this server. | 115 | in this server. |
3912 | @@ -105,6 +117,10 @@ | |||
3913 | 105 | server, remove it's interest. | 117 | server, remove it's interest. |
3914 | 106 | @check_interest: Check to see if anyone on the bus is interested in this | 118 | @check_interest: Check to see if anyone on the bus is interested in this |
3915 | 107 | server for a particular feature. | 119 | server for a particular feature. |
3916 | 120 | @max_indicators_set: Set the maximum number of indicators that a | ||
3917 | 121 | given listener can display. | ||
3918 | 122 | @max_indicators_get: Gets the maximum number of indicators from all | ||
3919 | 123 | listeners that care about this server. | ||
3920 | 108 | @indicate_server_reserved1: Reserved for future use | 124 | @indicate_server_reserved1: Reserved for future use |
3921 | 109 | @indicate_server_reserved2: Reserved for future use | 125 | @indicate_server_reserved2: Reserved for future use |
3922 | 110 | @indicate_server_reserved3: Reserved for future use | 126 | @indicate_server_reserved3: Reserved for future use |
3923 | @@ -120,28 +136,31 @@ | |||
3924 | 120 | GObjectClass parent; | 136 | GObjectClass parent; |
3925 | 121 | 137 | ||
3926 | 122 | /* Signals */ | 138 | /* Signals */ |
3929 | 123 | void (* indicator_added) (IndicateServer * server, guint id, gchar * type); | 139 | void (* indicator_added) (IndicateServer * server, guint id); |
3930 | 124 | void (* indicator_removed) (IndicateServer * server, guint id, gchar * type); | 140 | void (* indicator_removed) (IndicateServer * server, guint id); |
3931 | 125 | void (* indicator_modified) (IndicateServer * server, guint id, gchar * property); | 141 | void (* indicator_modified) (IndicateServer * server, guint id, gchar * property); |
3932 | 126 | void (* server_show) (IndicateServer * server, gchar * type); | 142 | void (* server_show) (IndicateServer * server, gchar * type); |
3933 | 127 | void (* server_hide) (IndicateServer * server, gchar * type); | 143 | void (* server_hide) (IndicateServer * server, gchar * type); |
3934 | 128 | void (* server_display) (IndicateServer * server); | 144 | void (* server_display) (IndicateServer * server); |
3935 | 129 | void (* interest_added) (IndicateServer * server, IndicateInterests interest); | 145 | void (* interest_added) (IndicateServer * server, IndicateInterests interest); |
3936 | 130 | void (* interest_removed) (IndicateServer * server, IndicateInterests interest); | 146 | void (* interest_removed) (IndicateServer * server, IndicateInterests interest); |
3937 | 147 | void (* max_indicators_changed) (IndicateServer * server, gint max); | ||
3938 | 148 | void (* server_count_changed) (IndicateServer * server, guint count); | ||
3939 | 131 | 149 | ||
3940 | 132 | /* Virtual Functions */ | 150 | /* Virtual Functions */ |
3941 | 133 | gboolean (*get_indicator_count) (IndicateServer * server, guint * count, GError **error); | 151 | gboolean (*get_indicator_count) (IndicateServer * server, guint * count, GError **error); |
3942 | 134 | gboolean (*get_indicator_count_by_type) (IndicateServer * server, gchar * type, guint * count, GError **error); | ||
3943 | 135 | gboolean (*get_indicator_list) (IndicateServer * server, GArray ** indicators, GError ** error); | 152 | gboolean (*get_indicator_list) (IndicateServer * server, GArray ** indicators, GError ** error); |
3944 | 136 | gboolean (*get_indicator_list_by_type) (IndicateServer * server, gchar * type, GArray ** indicators, GError ** error); | ||
3945 | 137 | gboolean (*get_indicator_property) (IndicateServer * server, guint id, gchar * property, gchar ** value, GError **error); | 153 | gboolean (*get_indicator_property) (IndicateServer * server, guint id, gchar * property, gchar ** value, GError **error); |
3946 | 138 | gboolean (*get_indicator_property_group) (IndicateServer * server, guint id, GPtrArray * properties, gchar *** value, GError **error); | 154 | gboolean (*get_indicator_property_group) (IndicateServer * server, guint id, GPtrArray * properties, gchar *** value, GError **error); |
3947 | 139 | gboolean (*get_indicator_properties) (IndicateServer * server, guint id, gchar *** properties, GError **error); | 155 | gboolean (*get_indicator_properties) (IndicateServer * server, guint id, gchar *** properties, GError **error); |
3948 | 140 | gboolean (*show_indicator_to_user) (IndicateServer * server, guint id, GError ** error); | 156 | gboolean (*show_indicator_to_user) (IndicateServer * server, guint id, GError ** error); |
3949 | 157 | gboolean (*indicator_displayed) (IndicateServer * server, gchar * sender, guint id, gboolean displayed, GError ** error); | ||
3950 | 141 | guint (*get_next_id) (IndicateServer * server); | 158 | guint (*get_next_id) (IndicateServer * server); |
3951 | 142 | gboolean (*show_interest) (IndicateServer * server, gchar * sender, IndicateInterests interest); | 159 | gboolean (*show_interest) (IndicateServer * server, gchar * sender, IndicateInterests interest); |
3952 | 143 | gboolean (*remove_interest) (IndicateServer * server, gchar * sender, IndicateInterests interest); | 160 | gboolean (*remove_interest) (IndicateServer * server, gchar * sender, IndicateInterests interest); |
3953 | 144 | gboolean (*check_interest) (IndicateServer * server, IndicateInterests interest); | 161 | gboolean (*check_interest) (IndicateServer * server, IndicateInterests interest); |
3954 | 162 | gboolean (*max_indicators_set) (IndicateServer * server, gchar * sender, gint max); | ||
3955 | 163 | gint (*max_indicators_get) (IndicateServer * server); | ||
3956 | 145 | 164 | ||
3957 | 146 | /* Reserver for future use */ | 165 | /* Reserver for future use */ |
3958 | 147 | void (*indicate_server_reserved1)(void); | 166 | void (*indicate_server_reserved1)(void); |
3959 | @@ -159,6 +178,7 @@ | |||
3960 | 159 | * out of */ | 178 | * out of */ |
3961 | 160 | void indicate_server_set_desktop_file (IndicateServer * server, const gchar * path); | 179 | void indicate_server_set_desktop_file (IndicateServer * server, const gchar * path); |
3962 | 161 | void indicate_server_set_type (IndicateServer * server, const gchar * type); | 180 | void indicate_server_set_type (IndicateServer * server, const gchar * type); |
3963 | 181 | void indicate_server_set_count (IndicateServer * server, guint count); | ||
3964 | 162 | 182 | ||
3965 | 163 | /* Show and hide the server on DBus, this allows for the server to | 183 | /* Show and hide the server on DBus, this allows for the server to |
3966 | 164 | * be created, change the object, and then shown. If for some | 184 | * be created, change the object, and then shown. If for some |
3967 | @@ -176,13 +196,8 @@ | |||
3968 | 176 | 196 | ||
3969 | 177 | /* Check to see if there is someone, out there, who likes this */ | 197 | /* Check to see if there is someone, out there, who likes this */ |
3970 | 178 | gboolean indicate_server_check_interest (IndicateServer * server, IndicateInterests interest); | 198 | gboolean indicate_server_check_interest (IndicateServer * server, IndicateInterests interest); |
3978 | 179 | 199 | /* See how many indicators we can show */ | |
3979 | 180 | 200 | gint indicate_server_get_max_indicators (IndicateServer * server); | |
3973 | 181 | /* Signal emission functions for sub-classes of the server */ | ||
3974 | 182 | void indicate_server_emit_indicator_added (IndicateServer *server, guint id, const gchar *type); | ||
3975 | 183 | void indicate_server_emit_indicator_removed (IndicateServer *server, guint id, const gchar *type); | ||
3976 | 184 | void indicate_server_emit_indicator_modified (IndicateServer *server, guint id, const gchar *property); | ||
3977 | 185 | void indicate_server_emit_server_display (IndicateServer *server); | ||
3980 | 186 | 201 | ||
3981 | 187 | /** | 202 | /** |
3982 | 188 | SECTION:server | 203 | SECTION:server |
3983 | 189 | 204 | ||
3984 | === modified file 'tests/Makefile.am' | |||
3985 | --- tests/Makefile.am 2009-04-27 15:48:38 +0000 | |||
3986 | +++ tests/Makefile.am 2009-09-03 22:04:01 +0000 | |||
3987 | @@ -3,7 +3,11 @@ | |||
3988 | 3 | test_simple \ | 3 | test_simple \ |
3989 | 4 | test_interests \ | 4 | test_interests \ |
3990 | 5 | test_interests_multi \ | 5 | test_interests_multi \ |
3992 | 6 | test_thousand_indicators | 6 | test_thousand_indicators \ |
3993 | 7 | test_max_indicators \ | ||
3994 | 8 | test_max_indicators_repeat \ | ||
3995 | 9 | test_indicator_display \ | ||
3996 | 10 | test_indicator_display_half | ||
3997 | 7 | 11 | ||
3998 | 8 | libexec_PROGRAMS = \ | 12 | libexec_PROGRAMS = \ |
3999 | 9 | test-interests-client \ | 13 | test-interests-client \ |
4000 | @@ -16,7 +20,14 @@ | |||
4001 | 16 | test-thousand-indicators-client \ | 20 | test-thousand-indicators-client \ |
4002 | 17 | test-thousand-indicators-server \ | 21 | test-thousand-indicators-server \ |
4003 | 18 | test-simple-client \ | 22 | test-simple-client \ |
4005 | 19 | test-simple-server | 23 | test-simple-server \ |
4006 | 24 | test-max-indicators-server-repeat \ | ||
4007 | 25 | test-max-indicators-server \ | ||
4008 | 26 | test-max-indicators-client \ | ||
4009 | 27 | test-indicator-display-server \ | ||
4010 | 28 | test-indicator-display-client \ | ||
4011 | 29 | test-indicator-display-half-server \ | ||
4012 | 30 | test-indicator-display-half-client | ||
4013 | 20 | 31 | ||
4014 | 21 | EXTRA_DIST = \ | 32 | EXTRA_DIST = \ |
4015 | 22 | $(TESTS) | 33 | $(TESTS) |
4016 | @@ -139,3 +150,81 @@ | |||
4017 | 139 | ../libindicate/libindicate.la \ | 150 | ../libindicate/libindicate.la \ |
4018 | 140 | $(LIBINDICATE_LIBS) | 151 | $(LIBINDICATE_LIBS) |
4019 | 141 | 152 | ||
4020 | 153 | test_max_indicators: test-max-indicators-client test-max-indicators-server | ||
4021 | 154 | |||
4022 | 155 | test_max_indicators_client_SOURCES = \ | ||
4023 | 156 | test-max-indicators-client.c test-max-indicators-list.h | ||
4024 | 157 | |||
4025 | 158 | test_max_indicators_client_CFLAGS = \ | ||
4026 | 159 | $(LIBINDICATE_CFLAGS) -I$(srcdir)/.. | ||
4027 | 160 | |||
4028 | 161 | test_max_indicators_client_LDADD = \ | ||
4029 | 162 | ../libindicate/libindicate.la \ | ||
4030 | 163 | $(LIBINDICATE_LIBS) | ||
4031 | 164 | |||
4032 | 165 | test_max_indicators_server_SOURCES = \ | ||
4033 | 166 | test-max-indicators-server.c test-max-indicators-list.h | ||
4034 | 167 | |||
4035 | 168 | test_max_indicators_server_CFLAGS = \ | ||
4036 | 169 | $(LIBINDICATE_CFLAGS) -I$(srcdir)/.. | ||
4037 | 170 | |||
4038 | 171 | test_max_indicators_server_LDADD = \ | ||
4039 | 172 | ../libindicate/libindicate.la \ | ||
4040 | 173 | $(LIBINDICATE_LIBS) | ||
4041 | 174 | |||
4042 | 175 | test_max_indicators_repeat: test-max-indicators-client test-max-indicators-server-repeat | ||
4043 | 176 | |||
4044 | 177 | test_max_indicators_server_repeat_SOURCES = \ | ||
4045 | 178 | test-max-indicators-server-repeat.c test-max-indicators-list.h | ||
4046 | 179 | |||
4047 | 180 | test_max_indicators_server_repeat_CFLAGS = \ | ||
4048 | 181 | $(LIBINDICATE_CFLAGS) -I$(srcdir)/.. | ||
4049 | 182 | |||
4050 | 183 | test_max_indicators_server_repeat_LDADD = \ | ||
4051 | 184 | ../libindicate/libindicate.la \ | ||
4052 | 185 | $(LIBINDICATE_LIBS) | ||
4053 | 186 | |||
4054 | 187 | test_indicator_display: test-indicator-display-client test-indicator-display-server | ||
4055 | 188 | |||
4056 | 189 | test_indicator_display_client_SOURCES = \ | ||
4057 | 190 | test-indicator-display-client.c | ||
4058 | 191 | |||
4059 | 192 | test_indicator_display_client_CFLAGS = \ | ||
4060 | 193 | $(LIBINDICATE_CFLAGS) -I$(srcdir)/.. | ||
4061 | 194 | |||
4062 | 195 | test_indicator_display_client_LDADD = \ | ||
4063 | 196 | ../libindicate/libindicate.la \ | ||
4064 | 197 | $(LIBINDICATE_LIBS) | ||
4065 | 198 | |||
4066 | 199 | test_indicator_display_server_SOURCES = \ | ||
4067 | 200 | test-indicator-display-server.c | ||
4068 | 201 | |||
4069 | 202 | test_indicator_display_server_CFLAGS = \ | ||
4070 | 203 | $(LIBINDICATE_CFLAGS) -I$(srcdir)/.. | ||
4071 | 204 | |||
4072 | 205 | test_indicator_display_server_LDADD = \ | ||
4073 | 206 | ../libindicate/libindicate.la \ | ||
4074 | 207 | $(LIBINDICATE_LIBS) | ||
4075 | 208 | |||
4076 | 209 | test_indicator_display_half: test-indicator-display-half-client test-indicator-display-half-server | ||
4077 | 210 | |||
4078 | 211 | test_indicator_display_half_client_SOURCES = \ | ||
4079 | 212 | test-indicator-display-half-client.c | ||
4080 | 213 | |||
4081 | 214 | test_indicator_display_half_client_CFLAGS = \ | ||
4082 | 215 | $(LIBINDICATE_CFLAGS) -I$(srcdir)/.. | ||
4083 | 216 | |||
4084 | 217 | test_indicator_display_half_client_LDADD = \ | ||
4085 | 218 | ../libindicate/libindicate.la \ | ||
4086 | 219 | $(LIBINDICATE_LIBS) | ||
4087 | 220 | |||
4088 | 221 | test_indicator_display_half_server_SOURCES = \ | ||
4089 | 222 | test-indicator-display-half-server.c | ||
4090 | 223 | |||
4091 | 224 | test_indicator_display_half_server_CFLAGS = \ | ||
4092 | 225 | $(LIBINDICATE_CFLAGS) -I$(srcdir)/.. | ||
4093 | 226 | |||
4094 | 227 | test_indicator_display_half_server_LDADD = \ | ||
4095 | 228 | ../libindicate/libindicate.la \ | ||
4096 | 229 | $(LIBINDICATE_LIBS) | ||
4097 | 230 | |||
4098 | 142 | 231 | ||
4099 | === added file 'tests/test-indicator-display-client.c' | |||
4100 | --- tests/test-indicator-display-client.c 1970-01-01 00:00:00 +0000 | |||
4101 | +++ tests/test-indicator-display-client.c 2009-09-03 21:32:22 +0000 | |||
4102 | @@ -0,0 +1,64 @@ | |||
4103 | 1 | |||
4104 | 2 | #include <glib.h> | ||
4105 | 3 | #include "libindicate/indicator.h" | ||
4106 | 4 | #include "libindicate/server.h" | ||
4107 | 5 | #include "libindicate/interests.h" | ||
4108 | 6 | |||
4109 | 7 | #define MAX_INDICATOR_COUNT 100 | ||
4110 | 8 | |||
4111 | 9 | static gboolean passed = TRUE; | ||
4112 | 10 | static GMainLoop * mainloop = NULL; | ||
4113 | 11 | static int count = 0; | ||
4114 | 12 | |||
4115 | 13 | |||
4116 | 14 | static void | ||
4117 | 15 | indicator_displayed (IndicateIndicator * indicator, gboolean displayed, gpointer user_data) | ||
4118 | 16 | { | ||
4119 | 17 | g_debug("Indicator displayed: %s", displayed ? "true" : "false"); | ||
4120 | 18 | if (displayed) { | ||
4121 | 19 | count++; | ||
4122 | 20 | } | ||
4123 | 21 | |||
4124 | 22 | return; | ||
4125 | 23 | } | ||
4126 | 24 | |||
4127 | 25 | static gboolean | ||
4128 | 26 | done_timeout_cb (gpointer data) | ||
4129 | 27 | { | ||
4130 | 28 | g_debug("%d of %d indicators displayed", count, MAX_INDICATOR_COUNT); | ||
4131 | 29 | if (count != MAX_INDICATOR_COUNT) { | ||
4132 | 30 | passed = FALSE; | ||
4133 | 31 | } | ||
4134 | 32 | g_main_loop_quit(mainloop); | ||
4135 | 33 | return FALSE; | ||
4136 | 34 | } | ||
4137 | 35 | |||
4138 | 36 | static guint indicators = 0; | ||
4139 | 37 | static gboolean | ||
4140 | 38 | idle_func (gpointer data) | ||
4141 | 39 | { | ||
4142 | 40 | if (indicators == MAX_INDICATOR_COUNT) { | ||
4143 | 41 | return FALSE; | ||
4144 | 42 | } | ||
4145 | 43 | |||
4146 | 44 | indicators++; | ||
4147 | 45 | IndicateIndicator * indicator = indicate_indicator_new(); | ||
4148 | 46 | g_signal_connect(G_OBJECT(indicator), INDICATE_INDICATOR_SIGNAL_DISPLAYED, G_CALLBACK(indicator_displayed), NULL); | ||
4149 | 47 | indicate_indicator_show(indicator); | ||
4150 | 48 | |||
4151 | 49 | return TRUE; | ||
4152 | 50 | } | ||
4153 | 51 | |||
4154 | 52 | int | ||
4155 | 53 | main (int argc, char * argv) | ||
4156 | 54 | { | ||
4157 | 55 | g_type_init(); | ||
4158 | 56 | |||
4159 | 57 | g_idle_add(idle_func, NULL); | ||
4160 | 58 | g_timeout_add(MAX_INDICATOR_COUNT * 10, done_timeout_cb, NULL); | ||
4161 | 59 | |||
4162 | 60 | mainloop = g_main_loop_new(NULL, FALSE); | ||
4163 | 61 | g_main_loop_run(mainloop); | ||
4164 | 62 | |||
4165 | 63 | return !passed; | ||
4166 | 64 | } | ||
4167 | 0 | 65 | ||
4168 | === added file 'tests/test-indicator-display-half-client.c' | |||
4169 | --- tests/test-indicator-display-half-client.c 1970-01-01 00:00:00 +0000 | |||
4170 | +++ tests/test-indicator-display-half-client.c 2009-09-03 22:01:41 +0000 | |||
4171 | @@ -0,0 +1,64 @@ | |||
4172 | 1 | |||
4173 | 2 | #include <glib.h> | ||
4174 | 3 | #include "libindicate/indicator.h" | ||
4175 | 4 | #include "libindicate/server.h" | ||
4176 | 5 | #include "libindicate/interests.h" | ||
4177 | 6 | |||
4178 | 7 | #define MAX_INDICATOR_COUNT 100 | ||
4179 | 8 | |||
4180 | 9 | static gboolean passed = TRUE; | ||
4181 | 10 | static GMainLoop * mainloop = NULL; | ||
4182 | 11 | static int count = 0; | ||
4183 | 12 | |||
4184 | 13 | |||
4185 | 14 | static void | ||
4186 | 15 | indicator_displayed (IndicateIndicator * indicator, gboolean displayed, gpointer user_data) | ||
4187 | 16 | { | ||
4188 | 17 | g_debug("Indicator displayed: %s", displayed ? "true" : "false"); | ||
4189 | 18 | if (displayed) { | ||
4190 | 19 | count++; | ||
4191 | 20 | } | ||
4192 | 21 | |||
4193 | 22 | return; | ||
4194 | 23 | } | ||
4195 | 24 | |||
4196 | 25 | static gboolean | ||
4197 | 26 | done_timeout_cb (gpointer data) | ||
4198 | 27 | { | ||
4199 | 28 | g_debug("%d of %d indicators displayed", count, MAX_INDICATOR_COUNT / 2); | ||
4200 | 29 | if (count != MAX_INDICATOR_COUNT / 2) { | ||
4201 | 30 | passed = FALSE; | ||
4202 | 31 | } | ||
4203 | 32 | g_main_loop_quit(mainloop); | ||
4204 | 33 | return FALSE; | ||
4205 | 34 | } | ||
4206 | 35 | |||
4207 | 36 | static guint indicators = 0; | ||
4208 | 37 | static gboolean | ||
4209 | 38 | idle_func (gpointer data) | ||
4210 | 39 | { | ||
4211 | 40 | if (indicators == MAX_INDICATOR_COUNT) { | ||
4212 | 41 | return FALSE; | ||
4213 | 42 | } | ||
4214 | 43 | |||
4215 | 44 | indicators++; | ||
4216 | 45 | IndicateIndicator * indicator = indicate_indicator_new(); | ||
4217 | 46 | g_signal_connect(G_OBJECT(indicator), INDICATE_INDICATOR_SIGNAL_DISPLAYED, G_CALLBACK(indicator_displayed), NULL); | ||
4218 | 47 | indicate_indicator_show(indicator); | ||
4219 | 48 | |||
4220 | 49 | return TRUE; | ||
4221 | 50 | } | ||
4222 | 51 | |||
4223 | 52 | int | ||
4224 | 53 | main (int argc, char * argv) | ||
4225 | 54 | { | ||
4226 | 55 | g_type_init(); | ||
4227 | 56 | |||
4228 | 57 | g_idle_add(idle_func, NULL); | ||
4229 | 58 | g_timeout_add(MAX_INDICATOR_COUNT * 10, done_timeout_cb, NULL); | ||
4230 | 59 | |||
4231 | 60 | mainloop = g_main_loop_new(NULL, FALSE); | ||
4232 | 61 | g_main_loop_run(mainloop); | ||
4233 | 62 | |||
4234 | 63 | return !passed; | ||
4235 | 64 | } | ||
4236 | 0 | 65 | ||
4237 | === added file 'tests/test-indicator-display-half-server.c' | |||
4238 | --- tests/test-indicator-display-half-server.c 1970-01-01 00:00:00 +0000 | |||
4239 | +++ tests/test-indicator-display-half-server.c 2009-09-03 22:01:41 +0000 | |||
4240 | @@ -0,0 +1,55 @@ | |||
4241 | 1 | |||
4242 | 2 | #include <glib.h> | ||
4243 | 3 | #include "libindicate/listener.h" | ||
4244 | 4 | #include "test-max-indicators-list.h" | ||
4245 | 5 | |||
4246 | 6 | static gboolean passed = TRUE; | ||
4247 | 7 | static GMainLoop * mainloop = NULL; | ||
4248 | 8 | |||
4249 | 9 | gboolean doit = TRUE; | ||
4250 | 10 | |||
4251 | 11 | static void | ||
4252 | 12 | indicator_added (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gpointer data) | ||
4253 | 13 | { | ||
4254 | 14 | if (doit) { | ||
4255 | 15 | indicate_listener_displayed(listener, server, indicator, TRUE); | ||
4256 | 16 | doit = FALSE; | ||
4257 | 17 | } else { | ||
4258 | 18 | doit = TRUE; | ||
4259 | 19 | } | ||
4260 | 20 | return; | ||
4261 | 21 | } | ||
4262 | 22 | |||
4263 | 23 | static gboolean | ||
4264 | 24 | failed_cb (gpointer data) | ||
4265 | 25 | { | ||
4266 | 26 | g_debug("Done indicatating displayed"); | ||
4267 | 27 | g_main_loop_quit(mainloop); | ||
4268 | 28 | return FALSE; | ||
4269 | 29 | } | ||
4270 | 30 | |||
4271 | 31 | static void | ||
4272 | 32 | server_removed (void) | ||
4273 | 33 | { | ||
4274 | 34 | g_debug("Server went away, exiting."); | ||
4275 | 35 | g_main_loop_quit(mainloop); | ||
4276 | 36 | return; | ||
4277 | 37 | } | ||
4278 | 38 | |||
4279 | 39 | int | ||
4280 | 40 | main (int argc, char * argv) | ||
4281 | 41 | { | ||
4282 | 42 | g_type_init(); | ||
4283 | 43 | |||
4284 | 44 | IndicateListener * listener = indicate_listener_ref_default(); | ||
4285 | 45 | |||
4286 | 46 | g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_INDICATOR_ADDED, G_CALLBACK(indicator_added), NULL); | ||
4287 | 47 | g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_SERVER_REMOVED, G_CALLBACK(server_removed), NULL); | ||
4288 | 48 | |||
4289 | 49 | g_timeout_add_seconds(2, failed_cb, NULL); | ||
4290 | 50 | |||
4291 | 51 | mainloop = g_main_loop_new(NULL, FALSE); | ||
4292 | 52 | g_main_loop_run(mainloop); | ||
4293 | 53 | |||
4294 | 54 | return !passed; | ||
4295 | 55 | } | ||
4296 | 0 | 56 | ||
4297 | === added file 'tests/test-indicator-display-server.c' | |||
4298 | --- tests/test-indicator-display-server.c 1970-01-01 00:00:00 +0000 | |||
4299 | +++ tests/test-indicator-display-server.c 2009-09-03 21:25:30 +0000 | |||
4300 | @@ -0,0 +1,48 @@ | |||
4301 | 1 | |||
4302 | 2 | #include <glib.h> | ||
4303 | 3 | #include "libindicate/listener.h" | ||
4304 | 4 | #include "test-max-indicators-list.h" | ||
4305 | 5 | |||
4306 | 6 | static gboolean passed = TRUE; | ||
4307 | 7 | static GMainLoop * mainloop = NULL; | ||
4308 | 8 | |||
4309 | 9 | |||
4310 | 10 | static void | ||
4311 | 11 | indicator_added (IndicateListener * listener, IndicateListenerServer * server, IndicateListenerIndicator * indicator, gpointer data) | ||
4312 | 12 | { | ||
4313 | 13 | return indicate_listener_displayed(listener, server, indicator, TRUE); | ||
4314 | 14 | } | ||
4315 | 15 | |||
4316 | 16 | static gboolean | ||
4317 | 17 | failed_cb (gpointer data) | ||
4318 | 18 | { | ||
4319 | 19 | g_debug("Done indicatating displayed"); | ||
4320 | 20 | g_main_loop_quit(mainloop); | ||
4321 | 21 | return FALSE; | ||
4322 | 22 | } | ||
4323 | 23 | |||
4324 | 24 | static void | ||
4325 | 25 | server_removed (void) | ||
4326 | 26 | { | ||
4327 | 27 | g_debug("Server went away, exiting."); | ||
4328 | 28 | g_main_loop_quit(mainloop); | ||
4329 | 29 | return; | ||
4330 | 30 | } | ||
4331 | 31 | |||
4332 | 32 | int | ||
4333 | 33 | main (int argc, char * argv) | ||
4334 | 34 | { | ||
4335 | 35 | g_type_init(); | ||
4336 | 36 | |||
4337 | 37 | IndicateListener * listener = indicate_listener_ref_default(); | ||
4338 | 38 | |||
4339 | 39 | g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_INDICATOR_ADDED, G_CALLBACK(indicator_added), NULL); | ||
4340 | 40 | g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_SERVER_REMOVED, G_CALLBACK(server_removed), NULL); | ||
4341 | 41 | |||
4342 | 42 | g_timeout_add_seconds(2, failed_cb, NULL); | ||
4343 | 43 | |||
4344 | 44 | mainloop = g_main_loop_new(NULL, FALSE); | ||
4345 | 45 | g_main_loop_run(mainloop); | ||
4346 | 46 | |||
4347 | 47 | return !passed; | ||
4348 | 48 | } | ||
4349 | 0 | 49 | ||
4350 | === added file 'tests/test-max-indicators-client.c' | |||
4351 | --- tests/test-max-indicators-client.c 1970-01-01 00:00:00 +0000 | |||
4352 | +++ tests/test-max-indicators-client.c 2009-09-03 01:47:13 +0000 | |||
4353 | @@ -0,0 +1,57 @@ | |||
4354 | 1 | |||
4355 | 2 | #include <glib.h> | ||
4356 | 3 | #include "libindicate/indicator.h" | ||
4357 | 4 | #include "libindicate/server.h" | ||
4358 | 5 | #include "libindicate/interests.h" | ||
4359 | 6 | #include "test-max-indicators-list.h" | ||
4360 | 7 | |||
4361 | 8 | static gboolean passed = TRUE; | ||
4362 | 9 | static GMainLoop * mainloop = NULL; | ||
4363 | 10 | static int count = 0; | ||
4364 | 11 | |||
4365 | 12 | |||
4366 | 13 | static void | ||
4367 | 14 | max_changed (IndicateServer * server, gint max, gpointer userdata) | ||
4368 | 15 | { | ||
4369 | 16 | g_debug("Oh, max changed: %d", max); | ||
4370 | 17 | |||
4371 | 18 | if (max != max_indicator_list[count]) { | ||
4372 | 19 | passed = FALSE; | ||
4373 | 20 | g_debug("\tBut that's not right! We wanted: %d", max_indicator_list[count]); | ||
4374 | 21 | } | ||
4375 | 22 | count++; | ||
4376 | 23 | |||
4377 | 24 | if (count == MAX_INDICATOR_COUNT) { | ||
4378 | 25 | g_main_loop_quit(mainloop); | ||
4379 | 26 | } | ||
4380 | 27 | |||
4381 | 28 | return; | ||
4382 | 29 | } | ||
4383 | 30 | |||
4384 | 31 | static gboolean | ||
4385 | 32 | done_timeout_cb (gpointer data) | ||
4386 | 33 | { | ||
4387 | 34 | g_debug("All maxes not set"); | ||
4388 | 35 | passed = FALSE; | ||
4389 | 36 | g_main_loop_quit(mainloop); | ||
4390 | 37 | return FALSE; | ||
4391 | 38 | } | ||
4392 | 39 | |||
4393 | 40 | int | ||
4394 | 41 | main (int argc, char * argv) | ||
4395 | 42 | { | ||
4396 | 43 | g_type_init(); | ||
4397 | 44 | |||
4398 | 45 | IndicateIndicator * indicator = indicate_indicator_new(); | ||
4399 | 46 | indicate_indicator_show(indicator); | ||
4400 | 47 | |||
4401 | 48 | IndicateServer * server = indicate_server_ref_default(); | ||
4402 | 49 | g_signal_connect(G_OBJECT(server), INDICATE_SERVER_SIGNAL_MAX_INDICATORS_CHANGED, G_CALLBACK(max_changed), NULL); | ||
4403 | 50 | |||
4404 | 51 | g_timeout_add(MAX_INDICATOR_COUNT * 10 * 100, done_timeout_cb, indicator); | ||
4405 | 52 | |||
4406 | 53 | mainloop = g_main_loop_new(NULL, FALSE); | ||
4407 | 54 | g_main_loop_run(mainloop); | ||
4408 | 55 | |||
4409 | 56 | return !passed; | ||
4410 | 57 | } | ||
4411 | 0 | 58 | ||
4412 | === added file 'tests/test-max-indicators-list.h' | |||
4413 | --- tests/test-max-indicators-list.h 1970-01-01 00:00:00 +0000 | |||
4414 | +++ tests/test-max-indicators-list.h 2009-09-03 01:37:33 +0000 | |||
4415 | @@ -0,0 +1,3 @@ | |||
4416 | 1 | |||
4417 | 2 | #define MAX_INDICATOR_COUNT 8 | ||
4418 | 3 | gint max_indicator_list[MAX_INDICATOR_COUNT] = { 1, 0, 1000, 0, 500, 1, 7, -1 }; | ||
4419 | 0 | 4 | ||
4420 | === added file 'tests/test-max-indicators-server-repeat.c' | |||
4421 | --- tests/test-max-indicators-server-repeat.c 1970-01-01 00:00:00 +0000 | |||
4422 | +++ tests/test-max-indicators-server-repeat.c 2009-09-03 01:50:10 +0000 | |||
4423 | @@ -0,0 +1,86 @@ | |||
4424 | 1 | |||
4425 | 2 | #include <glib.h> | ||
4426 | 3 | #include "libindicate/listener.h" | ||
4427 | 4 | #include "test-max-indicators-list.h" | ||
4428 | 5 | |||
4429 | 6 | gint repeat_list[MAX_INDICATOR_COUNT] = { 2, 3, 1, 4, 2, 3, 1, 20 }; | ||
4430 | 7 | |||
4431 | 8 | static gboolean passed = TRUE; | ||
4432 | 9 | static GMainLoop * mainloop = NULL; | ||
4433 | 10 | |||
4434 | 11 | static guint count = 0; | ||
4435 | 12 | static guint repeat = 0; | ||
4436 | 13 | |||
4437 | 14 | static IndicateListener * l = NULL; | ||
4438 | 15 | static IndicateListenerServer * s = NULL; | ||
4439 | 16 | |||
4440 | 17 | gboolean | ||
4441 | 18 | set_max (gpointer userdata) | ||
4442 | 19 | { | ||
4443 | 20 | g_debug("Setting max indicators to: %d", max_indicator_list[count]); | ||
4444 | 21 | indicate_listener_set_server_max_indicators(l, s, max_indicator_list[count]); | ||
4445 | 22 | if (repeat == repeat_list[count]) { | ||
4446 | 23 | count++; | ||
4447 | 24 | repeat = 0; | ||
4448 | 25 | } else { | ||
4449 | 26 | repeat++; | ||
4450 | 27 | } | ||
4451 | 28 | |||
4452 | 29 | if (count >= MAX_INDICATOR_COUNT) { | ||
4453 | 30 | return FALSE; | ||
4454 | 31 | } else { | ||
4455 | 32 | return TRUE; | ||
4456 | 33 | } | ||
4457 | 34 | } | ||
4458 | 35 | |||
4459 | 36 | static void | ||
4460 | 37 | server_added (IndicateListener * listener, IndicateListenerServer * server, gchar * type, gpointer data) | ||
4461 | 38 | { | ||
4462 | 39 | g_debug("Indicator Server Added: %s %s", INDICATE_LISTENER_SERVER_DBUS_NAME(server), type); | ||
4463 | 40 | |||
4464 | 41 | if (l != NULL || s != NULL) { | ||
4465 | 42 | g_warning("Adding a second server? %s", INDICATE_LISTENER_SERVER_DBUS_NAME(server)); | ||
4466 | 43 | return; | ||
4467 | 44 | } | ||
4468 | 45 | |||
4469 | 46 | l = listener; | ||
4470 | 47 | s = server; | ||
4471 | 48 | |||
4472 | 49 | g_timeout_add(100, set_max, NULL); | ||
4473 | 50 | |||
4474 | 51 | return; | ||
4475 | 52 | } | ||
4476 | 53 | |||
4477 | 54 | static gboolean | ||
4478 | 55 | failed_cb (gpointer data) | ||
4479 | 56 | { | ||
4480 | 57 | g_debug("Done indicatating max indicators"); | ||
4481 | 58 | g_main_loop_quit(mainloop); | ||
4482 | 59 | return FALSE; | ||
4483 | 60 | } | ||
4484 | 61 | |||
4485 | 62 | int | ||
4486 | 63 | main (int argc, char * argv) | ||
4487 | 64 | { | ||
4488 | 65 | g_type_init(); | ||
4489 | 66 | |||
4490 | 67 | IndicateListener * listener = indicate_listener_ref_default(); | ||
4491 | 68 | |||
4492 | 69 | g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_SERVER_ADDED, G_CALLBACK(server_added), NULL); | ||
4493 | 70 | |||
4494 | 71 | guint i, repeat_sum = 0; | ||
4495 | 72 | for (i = 0; i < MAX_INDICATOR_COUNT; i++) { | ||
4496 | 73 | repeat_sum += repeat_list[i]; | ||
4497 | 74 | } | ||
4498 | 75 | |||
4499 | 76 | if (repeat_sum / MAX_INDICATOR_COUNT > 9) { | ||
4500 | 77 | g_warning("Risk of client timeout."); | ||
4501 | 78 | } | ||
4502 | 79 | |||
4503 | 80 | g_timeout_add((MAX_INDICATOR_COUNT + 4 + repeat_sum) * 100, failed_cb, NULL); | ||
4504 | 81 | |||
4505 | 82 | mainloop = g_main_loop_new(NULL, FALSE); | ||
4506 | 83 | g_main_loop_run(mainloop); | ||
4507 | 84 | |||
4508 | 85 | return !passed; | ||
4509 | 86 | } | ||
4510 | 0 | 87 | ||
4511 | === added file 'tests/test-max-indicators-server.c' | |||
4512 | --- tests/test-max-indicators-server.c 1970-01-01 00:00:00 +0000 | |||
4513 | +++ tests/test-max-indicators-server.c 2009-09-03 01:50:10 +0000 | |||
4514 | @@ -0,0 +1,69 @@ | |||
4515 | 1 | |||
4516 | 2 | #include <glib.h> | ||
4517 | 3 | #include "libindicate/listener.h" | ||
4518 | 4 | #include "test-max-indicators-list.h" | ||
4519 | 5 | |||
4520 | 6 | static gboolean passed = TRUE; | ||
4521 | 7 | static GMainLoop * mainloop = NULL; | ||
4522 | 8 | |||
4523 | 9 | static guint count = 0; | ||
4524 | 10 | |||
4525 | 11 | static IndicateListener * l = NULL; | ||
4526 | 12 | static IndicateListenerServer * s = NULL; | ||
4527 | 13 | |||
4528 | 14 | gboolean | ||
4529 | 15 | set_max (gpointer userdata) | ||
4530 | 16 | { | ||
4531 | 17 | g_debug("Setting max indicators to: %d", max_indicator_list[count]); | ||
4532 | 18 | indicate_listener_set_server_max_indicators(l, s, max_indicator_list[count]); | ||
4533 | 19 | count++; | ||
4534 | 20 | |||
4535 | 21 | if (count >= MAX_INDICATOR_COUNT) { | ||
4536 | 22 | return FALSE; | ||
4537 | 23 | } else { | ||
4538 | 24 | return TRUE; | ||
4539 | 25 | } | ||
4540 | 26 | } | ||
4541 | 27 | |||
4542 | 28 | static void | ||
4543 | 29 | server_added (IndicateListener * listener, IndicateListenerServer * server, gchar * type, gpointer data) | ||
4544 | 30 | { | ||
4545 | 31 | g_debug("Indicator Server Added: %s %s", INDICATE_LISTENER_SERVER_DBUS_NAME(server), type); | ||
4546 | 32 | |||
4547 | 33 | if (l != NULL || s != NULL) { | ||
4548 | 34 | g_warning("Adding a second server? %s", INDICATE_LISTENER_SERVER_DBUS_NAME(server)); | ||
4549 | 35 | return; | ||
4550 | 36 | } | ||
4551 | 37 | |||
4552 | 38 | l = listener; | ||
4553 | 39 | s = server; | ||
4554 | 40 | |||
4555 | 41 | g_timeout_add(100, set_max, NULL); | ||
4556 | 42 | |||
4557 | 43 | return; | ||
4558 | 44 | } | ||
4559 | 45 | |||
4560 | 46 | static gboolean | ||
4561 | 47 | failed_cb (gpointer data) | ||
4562 | 48 | { | ||
4563 | 49 | g_debug("Done indicatating max indicators"); | ||
4564 | 50 | g_main_loop_quit(mainloop); | ||
4565 | 51 | return FALSE; | ||
4566 | 52 | } | ||
4567 | 53 | |||
4568 | 54 | int | ||
4569 | 55 | main (int argc, char * argv) | ||
4570 | 56 | { | ||
4571 | 57 | g_type_init(); | ||
4572 | 58 | |||
4573 | 59 | IndicateListener * listener = indicate_listener_ref_default(); | ||
4574 | 60 | |||
4575 | 61 | g_signal_connect(listener, INDICATE_LISTENER_SIGNAL_SERVER_ADDED, G_CALLBACK(server_added), NULL); | ||
4576 | 62 | |||
4577 | 63 | g_timeout_add((MAX_INDICATOR_COUNT + 4) * 100, failed_cb, NULL); | ||
4578 | 64 | |||
4579 | 65 | mainloop = g_main_loop_new(NULL, FALSE); | ||
4580 | 66 | g_main_loop_run(mainloop); | ||
4581 | 67 | |||
4582 | 68 | return !passed; | ||
4583 | 69 | } | ||
4584 | 0 | 70 | ||
4585 | === added file 'tests/test_indicator_display' | |||
4586 | --- tests/test_indicator_display 1970-01-01 00:00:00 +0000 | |||
4587 | +++ tests/test_indicator_display 2009-09-03 21:07:15 +0000 | |||
4588 | @@ -0,0 +1,5 @@ | |||
4589 | 1 | #!/bin/sh | ||
4590 | 2 | |||
4591 | 3 | DBUS_RUNNER="dbus-test-runner --dbus-config /usr/share/dbus-test-runner/session.conf" | ||
4592 | 4 | |||
4593 | 5 | ${DBUS_RUNNER} --task ./test-indicator-display-client --task-name Client --task ./test-indicator-display-server --task-name Server | ||
4594 | 0 | 6 | ||
4595 | === added file 'tests/test_indicator_display_half' | |||
4596 | --- tests/test_indicator_display_half 1970-01-01 00:00:00 +0000 | |||
4597 | +++ tests/test_indicator_display_half 2009-09-03 21:58:04 +0000 | |||
4598 | @@ -0,0 +1,5 @@ | |||
4599 | 1 | #!/bin/sh | ||
4600 | 2 | |||
4601 | 3 | DBUS_RUNNER="dbus-test-runner --dbus-config /usr/share/dbus-test-runner/session.conf" | ||
4602 | 4 | |||
4603 | 5 | ${DBUS_RUNNER} --task ./test-indicator-display-half-client --task-name Client --task ./test-indicator-display-half-server --task-name Server | ||
4604 | 0 | 6 | ||
4605 | === added file 'tests/test_max_indicators' | |||
4606 | --- tests/test_max_indicators 1970-01-01 00:00:00 +0000 | |||
4607 | +++ tests/test_max_indicators 2009-09-02 22:07:29 +0000 | |||
4608 | @@ -0,0 +1,5 @@ | |||
4609 | 1 | #!/bin/sh | ||
4610 | 2 | |||
4611 | 3 | DBUS_RUNNER="dbus-test-runner --dbus-config /usr/share/dbus-test-runner/session.conf" | ||
4612 | 4 | |||
4613 | 5 | ${DBUS_RUNNER} --task ./test-max-indicators-client --task-name Client --task ./test-max-indicators-server --task-name Server | ||
4614 | 0 | 6 | ||
4615 | === added file 'tests/test_max_indicators_repeat' | |||
4616 | --- tests/test_max_indicators_repeat 1970-01-01 00:00:00 +0000 | |||
4617 | +++ tests/test_max_indicators_repeat 2009-09-03 01:41:31 +0000 | |||
4618 | @@ -0,0 +1,5 @@ | |||
4619 | 1 | #!/bin/sh | ||
4620 | 2 | |||
4621 | 3 | DBUS_RUNNER="dbus-test-runner --dbus-config /usr/share/dbus-test-runner/session.conf" | ||
4622 | 4 | |||
4623 | 5 | ${DBUS_RUNNER} --task ./test-max-indicators-client --task-name Client --task ./test-max-indicators-server-repeat --task-name Server |