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

Subscribers

People subscribed via source and target branches

to all changes: