Merge lp:~indicator-applet-developers/libindicator/ubuntu into lp:~ubuntu-desktop/libindicator/ubuntu

Proposed by Ted Gould
Status: Merged
Merged at revision: not available
Proposed branch: lp:~indicator-applet-developers/libindicator/ubuntu
Merge into: lp:~ubuntu-desktop/libindicator/ubuntu
Diff against target: 606 lines (+271/-15)
11 files modified
.bzrignore (+4/-0)
Makefile.am.marshal (+45/-0)
configure.ac (+4/-2)
debian/changelog (+8/-0)
libindicator/Makefile.am (+8/-0)
libindicator/indicator-object-marshal.list (+1/-0)
libindicator/indicator-object.c (+52/-2)
libindicator/indicator-object.h (+9/-4)
libindicator/indicator-service-manager.c (+106/-0)
tests/dummy-indicator-signaler.c (+1/-0)
tests/test-loader.c (+33/-7)
To merge this branch: bzr merge lp:~indicator-applet-developers/libindicator/ubuntu
Reviewer Review Type Date Requested Status
Indicator Applet Developers Pending
Review via email: mp+17836@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Ted Gould (ted) wrote :

0.3.1

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.bzrignore'
2--- .bzrignore 2009-12-02 21:58:52 +0000
3+++ .bzrignore 2010-01-21 19:20:24 +0000
4@@ -143,3 +143,7 @@
5 tests/service-version-tester
6 tests/service-manager-connect-nostart-tester
7 tests/service-manager-nostart-connect
8+libindicator/indicator-object-marshal.c
9+libindicator/indicator-object-marshal.h
10+libindicator/libindicator_la-indicator-object-marshal.lo
11+libindicator/stamp-marshal
12
13=== added file 'Makefile.am.marshal'
14--- Makefile.am.marshal 1970-01-01 00:00:00 +0000
15+++ Makefile.am.marshal 2010-01-21 19:20:25 +0000
16@@ -0,0 +1,45 @@
17+# Rules for generating marshal files using glib-genmarshal
18+#
19+# Define:
20+# glib_marshal_list = marshal list file
21+# glib_marshal_prefix = prefix for marshal functions
22+#
23+# before including Makefile.am.marshal. You will also need to have
24+# the following targets already defined:
25+#
26+# CLEANFILES
27+# DISTCLEANFILES
28+# BUILT_SOURCES
29+# EXTRA_DIST
30+#
31+# Author: Emmanuele Bassi <ebassi@linux.intel.com>
32+
33+marshal_h = $(glib_marshal_list:.list=.h)
34+marshal_c = $(glib_marshal_list:.list=.c)
35+
36+CLEANFILES += stamp-marshal
37+DISTCLEANFILES += $(marshal_h) $(marshal_c)
38+BUILT_SOURCES += $(marshal_h) $(marshal_c)
39+EXTRA_DIST += $(glib_marshal_list)
40+
41+stamp-marshal: $(glib_marshal_list)
42+ $(QUIET_GEN)$(GLIB_GENMARSHAL) \
43+ --prefix=$(glib_marshal_prefix) \
44+ --header \
45+ $(srcdir)/$(glib_marshal_list) > xgen-mh \
46+ && (cmp -s xgen-mh $(marshal_h) || cp -f xgen-mh $(marshal_h)) \
47+ && rm -f xgen-mh \
48+ && echo timestamp > $(@F)
49+
50+$(marshal_h): stamp-marshal
51+ @true
52+
53+$(marshal_c): $(marshal_h)
54+ $(QUIET_GEN)(echo "#include \"$(marshal_h)\"" ; \
55+ $(GLIB_GENMARSHAL) \
56+ --prefix=$(glib_marshal_prefix) \
57+ --body \
58+ $(srcdir)/$(glib_marshal_list)) > xgen-mc \
59+ && cp xgen-mc $(marshal_c) \
60+ && rm -f xgen-mc
61+
62
63=== modified file 'configure.ac'
64--- configure.ac 2009-11-04 19:07:37 +0000
65+++ configure.ac 2010-01-21 19:20:25 +0000
66@@ -1,10 +1,10 @@
67
68-AC_INIT(libindicator, 0.3.0, ted@canonical.com)
69+AC_INIT(libindicator, 0.3.1, ted@canonical.com)
70
71 AC_PREREQ(2.53)
72
73 AM_CONFIG_HEADER(config.h)
74-AM_INIT_AUTOMAKE(libindicator, 0.3.0)
75+AM_INIT_AUTOMAKE(libindicator, 0.3.1)
76
77 AM_MAINTAINER_MODE
78 m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES])
79@@ -15,6 +15,8 @@
80 AC_STDC_HEADERS
81 AC_PROG_LIBTOOL
82
83+AC_PATH_PROG([GLIB_GENMARSHAL], [glib-genmarshal])
84+
85 AC_SUBST(VERSION)
86 AC_CONFIG_MACRO_DIR([m4])
87
88
89=== modified file 'debian/changelog'
90--- debian/changelog 2009-12-10 17:18:01 +0000
91+++ debian/changelog 2010-01-21 19:20:25 +0000
92@@ -1,3 +1,11 @@
93+libindicator (0.3.1-0ubuntu1~ppa1) karmic; urgency=low
94+
95+ * Upstream release 0.3.1
96+ * Adding in entry ordering.
97+ * Adding in the code to restart services
98+
99+ -- Ted Gould <ted@ubuntu.com> Thu, 21 Jan 2010 13:15:07 -0600
100+
101 libindicator (0.3.0-0ubuntu1) lucid; urgency=low
102
103 * debian/control:
104
105=== modified file 'libindicator/Makefile.am'
106--- libindicator/Makefile.am 2009-12-02 19:56:44 +0000
107+++ libindicator/Makefile.am 2010-01-21 19:20:25 +0000
108@@ -1,8 +1,11 @@
109 BUILT_SOURCES =
110 CLEANFILES =
111+DISTCLEANFILES =
112 EXTRA_DIST = \
113 indicator.pc.in
114
115+include $(top_srcdir)/Makefile.am.marshal
116+
117 libindicatorincludedir=$(includedir)/libindicator-0.3/libindicator
118
119 indicator_headers = \
120@@ -21,6 +24,8 @@
121 $(indicator_headers) \
122 dbus-shared.h \
123 indicator-object.c \
124+ indicator-object-marshal.h \
125+ indicator-object-marshal.c \
126 indicator-service.c \
127 indicator-service-manager.c
128
129@@ -35,6 +40,9 @@
130 pkgconfig_DATA = indicator.pc
131 pkgconfigdir = $(libdir)/pkgconfig
132
133+glib_marshal_list = indicator-object-marshal.list
134+glib_marshal_prefix = _indicator_object_marshal
135+
136 ##################################
137 # DBus Specs
138 ##################################
139
140=== added file 'libindicator/indicator-object-marshal.list'
141--- libindicator/indicator-object-marshal.list 1970-01-01 00:00:00 +0000
142+++ libindicator/indicator-object-marshal.list 2010-01-21 19:20:25 +0000
143@@ -0,0 +1,1 @@
144+VOID: POINTER, UINT, UINT
145
146=== modified file 'libindicator/indicator-object.c'
147--- libindicator/indicator-object.c 2009-11-05 16:56:41 +0000
148+++ libindicator/indicator-object.c 2010-01-21 19:20:25 +0000
149@@ -27,6 +27,7 @@
150
151 #include "indicator.h"
152 #include "indicator-object.h"
153+#include "indicator-object-marshal.h"
154
155 /**
156 IndicatorObjectPrivate:
157@@ -54,6 +55,7 @@
158 enum {
159 ENTRY_ADDED,
160 ENTRY_REMOVED,
161+ ENTRY_MOVED,
162 LAST_SIGNAL
163 };
164
165@@ -86,11 +88,14 @@
166 klass->get_image = NULL;
167
168 klass->get_entries = get_entries_default;
169+ klass->get_location = NULL;
170
171 /**
172 IndicatorObject::entry-added:
173 @arg0: The #IndicatorObject object
174-
175+ @arg1: A pointer to the #IndicatorObjectEntry that
176+ is being added.
177+
178 Signaled when a new entry is added and should
179 be shown by the person using this object.
180 */
181@@ -105,7 +110,9 @@
182 /**
183 IndicatorObject::entry-removed:
184 @arg0: The #IndicatorObject object
185-
186+ @arg1: A pointer to the #IndicatorObjectEntry that
187+ is being removed.
188+
189 Signaled when an entry is removed and should
190 be removed by the person using this object.
191 */
192@@ -116,6 +123,24 @@
193 NULL, NULL,
194 g_cclosure_marshal_VOID__POINTER,
195 G_TYPE_NONE, 1, G_TYPE_POINTER, G_TYPE_NONE);
196+ /**
197+ IndicatorObject::entry-moved:
198+ @arg0: The #IndicatorObject object
199+ @arg1: A pointer to the #IndicatorObjectEntry that
200+ is being moved.
201+ @arg2: The old location of the entry
202+ @arg3: The new location of the entry
203+
204+ When the order of the entries change, then this signal
205+ is sent to tell the new location.
206+ */
207+ signals[ENTRY_MOVED] = g_signal_new (INDICATOR_OBJECT_SIGNAL_ENTRY_MOVED,
208+ G_TYPE_FROM_CLASS(klass),
209+ G_SIGNAL_RUN_LAST,
210+ G_STRUCT_OFFSET (IndicatorObjectClass, entry_moved),
211+ NULL, NULL,
212+ _indicator_object_marshal_VOID__POINTER_UINT_UINT,
213+ G_TYPE_NONE, 3, G_TYPE_POINTER, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_NONE);
214
215 return;
216 }
217@@ -342,3 +367,28 @@
218 g_error("No get_entries function on object. It must have been deleted?!?!");
219 return NULL;
220 }
221+
222+/**
223+ indicator_object_get_location:
224+ @io: #IndicatorObject to query
225+ @entry: The #IndicatorObjectEntry to look for.
226+
227+ This function looks on the class for the object and calls
228+ it's #IndicatorObjectClass::get_location function. If the
229+ function doesn't exist it returns zero.
230+
231+ Return value: Location of the @entry in the display or
232+ zero if no location is specified.
233+*/
234+guint
235+indicator_object_get_location (IndicatorObject * io, IndicatorObjectEntry * entry)
236+{
237+ g_return_val_if_fail(INDICATOR_IS_OBJECT(io), 0);
238+ IndicatorObjectClass * class = INDICATOR_OBJECT_GET_CLASS(io);
239+
240+ if (class->get_location) {
241+ return class->get_location(io, entry);
242+ }
243+
244+ return 0;
245+}
246
247=== modified file 'libindicator/indicator-object.h'
248--- libindicator/indicator-object.h 2009-11-04 17:24:25 +0000
249+++ libindicator/indicator-object.h 2010-01-21 19:20:25 +0000
250@@ -40,6 +40,8 @@
251 #define INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED_ID (g_signal_lookup(INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED, INDICATOR_OBJECT_TYPE))
252 #define INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED "entry-removed"
253 #define INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED_ID (g_signal_lookup(INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED, INDICATOR_OBJECT_TYPE))
254+#define INDICATOR_OBJECT_SIGNAL_ENTRY_MOVED "entry-moved"
255+#define INDICATOR_OBJECT_SIGNAL_ENTRY_MOVED_ID (g_signal_lookup(INDICATOR_OBJECT_SIGNAL_ENTRY_MOVED, INDICATOR_OBJECT_TYPE))
256
257 typedef struct _IndicatorObject IndicatorObject;
258 typedef struct _IndicatorObjectClass IndicatorObjectClass;
259@@ -62,12 +64,14 @@
260 a #GList of #IndicatorObjectEntries. The list should be
261 under the ownership of the caller but the entires will
262 not be.
263+ @get_location: Returns the location that a particular entry
264+ should be placed in. This is really only relevant for
265+ indicators that have more than one entry.
266 @entry_added: Slot for #IndicatorObject::entry-added
267 @entry_removed: Slot for #IndicatorObject::entry-removed
268+ @entry_moved: Slot for #IndicatorObject::entry-moved
269 @indicator_object_reserved_1: Reserved for future use
270 @indicator_object_reserved_2: Reserved for future use
271- @indicator_object_reserved_3: Reserved for future use
272- @indicator_object_reserved_4: Reserved for future use
273 */
274 struct _IndicatorObjectClass {
275 GObjectClass parent_class;
276@@ -78,16 +82,16 @@
277 GtkMenu * (*get_menu) (IndicatorObject * io);
278
279 GList * (*get_entries) (IndicatorObject * io);
280+ guint (*get_location) (IndicatorObject * io, IndicatorObjectEntry * entry);
281
282 /* Signals */
283 void (*entry_added) (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user_data);
284 void (*entry_removed) (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user_data);
285+ void (*entry_moved) (IndicatorObject * io, IndicatorObjectEntry * entry, guint old_pos, guint new_pos, gpointer user_data);
286
287 /* Reserved */
288 void (* indicator_object_reserved_1) (void);
289 void (* indicator_object_reserved_2) (void);
290- void (* indicator_object_reserved_3) (void);
291- void (* indicator_object_reserved_4) (void);
292 };
293
294 /**
295@@ -117,6 +121,7 @@
296 IndicatorObject * indicator_object_new_from_file (const gchar * file);
297
298 GList * indicator_object_get_entries (IndicatorObject * io);
299+guint indicator_object_get_location (IndicatorObject * io, IndicatorObjectEntry * entry);
300
301 G_END_DECLS
302
303
304=== modified file 'libindicator/indicator-service-manager.c'
305--- libindicator/indicator-service-manager.c 2009-12-07 20:22:35 +0000
306+++ libindicator/indicator-service-manager.c 2010-01-21 19:20:25 +0000
307@@ -25,6 +25,8 @@
308 #include "config.h"
309 #endif
310
311+#include <stdlib.h>
312+
313 #include <dbus/dbus-glib-bindings.h>
314 #include <dbus/dbus-glib-lowlevel.h>
315
316@@ -41,6 +43,7 @@
317 @connected: Whether we're connected to the service or not.
318 @this_service_version: The version of the service that we're looking for.
319 @bus: A reference to the bus so we don't have to keep getting it.
320+ @restart_count: The number of times we've restarted this service.
321 */
322 typedef struct _IndicatorServiceManagerPrivate IndicatorServiceManagerPrivate;
323 struct _IndicatorServiceManagerPrivate {
324@@ -50,6 +53,8 @@
325 gboolean connected;
326 guint this_service_version;
327 DBusGConnection * bus;
328+ guint restart_count;
329+ gint restart_source;
330 };
331
332 /* Signals Stuff */
333@@ -60,6 +65,13 @@
334
335 static guint signals[LAST_SIGNAL] = { 0 };
336
337+/* If this env variable is set, we don't restart */
338+#define TIMEOUT_ENV_NAME "INDICATOR_SERVICE_RESTART_DISABLE"
339+#define TIMEOUT_MULTIPLIER 100 /* In ms */
340+/* What to reset the restart_count to if we know that we're
341+ in a recoverable error condition, but waiting a little bit
342+ will probably make things better. 5 ~= 3 sec. */
343+#define TIMEOUT_A_LITTLE_WHILE 5
344
345 /* Properties */
346 /* Enum for the properties so that they can be quickly
347@@ -86,7 +98,9 @@
348 /* Prototypes */
349 static void set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec);
350 static void get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec);
351+static void service_proxy_destroyed (DBusGProxy * proxy, gpointer user_data);
352 static void start_service (IndicatorServiceManager * service);
353+static void start_service_again (IndicatorServiceManager * manager);
354
355 G_DEFINE_TYPE (IndicatorServiceManager, indicator_service_manager, G_TYPE_OBJECT);
356
357@@ -154,6 +168,8 @@
358 priv->connected = FALSE;
359 priv->this_service_version = 0;
360 priv->bus = NULL;
361+ priv->restart_count = 0;
362+ priv->restart_source = 0;
363
364 /* Start talkin' dbus */
365 GError * error = NULL;
366@@ -187,6 +203,13 @@
367 {
368 IndicatorServiceManagerPrivate * priv = INDICATOR_SERVICE_MANAGER_GET_PRIVATE(object);
369
370+ /* Removing the idle task to restart if it exists. */
371+ if (priv->restart_source != 0) {
372+ g_source_remove(priv->restart_source);
373+ }
374+ /* Block any restart calls */
375+ priv->restart_source = -1;
376+
377 /* If we were connected we need to make sure to
378 tell people that it's no longer the case. */
379 if (priv->connected) {
380@@ -309,18 +332,33 @@
381 if (error != NULL) {
382 g_warning("Unable to set watch on '%s': '%s'", priv->name, error->message);
383 g_error_free(error);
384+ start_service_again(INDICATOR_SERVICE_MANAGER(user_data));
385 return;
386 }
387
388+ /* We've done it, now let's stop counting. */
389+ /* Note: we're not checking versions. Because, the hope is that
390+ the guy holding the name we want with the wrong version will
391+ drop and we can start another service quickly. */
392+ priv->restart_count = 0;
393+
394 if (service_api_version != INDICATOR_SERVICE_VERSION) {
395 g_warning("Service is using a different version of the service interface. Expecting %d and got %d.", INDICATOR_SERVICE_VERSION, service_api_version);
396 dbus_g_proxy_call_no_reply(priv->service_proxy, "UnWatch", G_TYPE_INVALID);
397+
398+ /* Let's make us wait a little while, then try again */
399+ priv->restart_count = TIMEOUT_A_LITTLE_WHILE;
400+ start_service_again(INDICATOR_SERVICE_MANAGER(user_data));
401 return;
402 }
403
404 if (this_service_version != priv->this_service_version) {
405 g_warning("Service is using a different API version than the manager. Expecting %d and got %d.", priv->this_service_version, this_service_version);
406 dbus_g_proxy_call_no_reply(priv->service_proxy, "UnWatch", G_TYPE_INVALID);
407+
408+ /* Let's make us wait a little while, then try again */
409+ priv->restart_count = TIMEOUT_A_LITTLE_WHILE;
410+ start_service_again(INDICATOR_SERVICE_MANAGER(user_data));
411 return;
412 }
413
414@@ -343,11 +381,13 @@
415
416 if (error != NULL) {
417 g_warning("Unable to start service '%s': %s", priv->name, error->message);
418+ start_service_again(INDICATOR_SERVICE_MANAGER(user_data));
419 return;
420 }
421
422 if (status != DBUS_START_REPLY_SUCCESS && status != DBUS_START_REPLY_ALREADY_RUNNING) {
423 g_warning("Status of starting the process '%s' was an error: %d", priv->name, status);
424+ start_service_again(INDICATOR_SERVICE_MANAGER(user_data));
425 return;
426 }
427
428@@ -358,6 +398,7 @@
429 INDICATOR_SERVICE_INTERFACE,
430 &error);
431 g_object_add_weak_pointer(G_OBJECT(priv->service_proxy), (gpointer *)&(priv->service_proxy));
432+ g_signal_connect(G_OBJECT(priv->service_proxy), "destroy", G_CALLBACK(service_proxy_destroyed), user_data);
433
434 org_ayatana_indicator_service_watch_async(priv->service_proxy,
435 watch_cb,
436@@ -379,6 +420,11 @@
437 g_return_if_fail(priv->dbus_proxy != NULL);
438 g_return_if_fail(priv->name != NULL);
439
440+ if (priv->service_proxy != NULL) {
441+ g_object_unref(priv->service_proxy);
442+ priv->service_proxy = NULL;
443+ }
444+
445 /* Check to see if we can get a proxy to it first. */
446 priv->service_proxy = dbus_g_proxy_new_for_name_owner(priv->bus,
447 priv->name,
448@@ -396,6 +442,7 @@
449 service);
450 } else {
451 g_object_add_weak_pointer(G_OBJECT(priv->service_proxy), (gpointer *)&(priv->service_proxy));
452+ g_signal_connect(G_OBJECT(priv->service_proxy), "destroy", G_CALLBACK(service_proxy_destroyed), service);
453
454 /* If we got a proxy just because we're good people then
455 we need to call watch on it just like 'start_service_cb'
456@@ -408,6 +455,65 @@
457 return;
458 }
459
460+/* Responds to the destory event of the proxy and starts
461+ setting up to restart the service. */
462+static void
463+service_proxy_destroyed (DBusGProxy * proxy, gpointer user_data)
464+{
465+ IndicatorServiceManagerPrivate * priv = INDICATOR_SERVICE_MANAGER_GET_PRIVATE(user_data);
466+ if (priv->connected) {
467+ priv->connected = FALSE;
468+ g_signal_emit(G_OBJECT(user_data), signals[CONNECTION_CHANGE], 0, FALSE, TRUE);
469+ }
470+ return start_service_again(INDICATOR_SERVICE_MANAGER(user_data));
471+}
472+
473+/* The callback that starts the service for real after
474+ the timeout as determined in 'start_service_again'.
475+ This could be in the idle or a timer. */
476+static gboolean
477+start_service_again_cb (gpointer data)
478+{
479+ IndicatorServiceManagerPrivate * priv = INDICATOR_SERVICE_MANAGER_GET_PRIVATE(data);
480+ priv->restart_count++;
481+ start_service(INDICATOR_SERVICE_MANAGER(data));
482+ priv->restart_source = 0;
483+ return FALSE;
484+}
485+
486+/* This function tries to start a new service, perhaps
487+ after a timeout that it determines. The real issue
488+ here is that it throttles restarting if we're not
489+ being successful. */
490+static void
491+start_service_again (IndicatorServiceManager * manager)
492+{
493+ IndicatorServiceManagerPrivate * priv = INDICATOR_SERVICE_MANAGER_GET_PRIVATE(manager);
494+
495+ /* If we've already got a restart source running then
496+ let's not do this again. */
497+ if (priv->restart_source != 0) {
498+ return;
499+ }
500+
501+ /* Allow the restarting to be disabled */
502+ if (g_getenv(TIMEOUT_ENV_NAME)) {
503+ return;
504+ }
505+
506+ if (priv->restart_count == 0) {
507+ /* First time, do it in idle */
508+ g_idle_add(start_service_again_cb, manager);
509+ } else {
510+ /* Not our first time 'round the block. Let's slow this down. */
511+ if (priv->restart_count > 16)
512+ priv->restart_count = 16; /* Not more than 1024x */
513+ priv->restart_source = g_timeout_add((1 << priv->restart_count) * TIMEOUT_MULTIPLIER, start_service_again_cb, manager);
514+ }
515+
516+ return;
517+}
518+
519 /* API */
520
521 /**
522
523=== modified file 'tests/dummy-indicator-signaler.c'
524--- tests/dummy-indicator-signaler.c 2009-11-04 17:14:22 +0000
525+++ tests/dummy-indicator-signaler.c 2010-01-21 19:20:25 +0000
526@@ -81,6 +81,7 @@
527
528 g_signal_emit(G_OBJECT(self), INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED_ID, 0, GUINT_TO_POINTER(5), TRUE);
529 g_signal_emit(G_OBJECT(self), INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED_ID, 0, GUINT_TO_POINTER(5), TRUE);
530+ g_signal_emit(G_OBJECT(self), INDICATOR_OBJECT_SIGNAL_ENTRY_MOVED_ID, 0, GUINT_TO_POINTER(5), 0, 1, TRUE);
531
532 return FALSE; /* Don't queue again */
533 }
534
535=== modified file 'tests/test-loader.c'
536--- tests/test-loader.c 2009-11-04 17:14:22 +0000
537+++ tests/test-loader.c 2010-01-21 19:20:25 +0000
538@@ -12,15 +12,22 @@
539 }
540
541 void
542+entry_move_cb (IndicatorObject * io, IndicatorObjectEntry * entry, gint old, gint new, gpointer data)
543+{
544+ return entry_change_cb(io, entry, data);
545+}
546+
547+void
548 test_loader_filename_dummy_signaler (void)
549 {
550 IndicatorObject * object = indicator_object_new_from_file(BUILD_DIR "/.libs/libdummy-indicator-signaler.so");
551 g_assert(object != NULL);
552
553- gpointer added_value = NULL, removed_value = NULL;
554+ gpointer added_value = NULL, removed_value = NULL, moved_value = NULL;
555
556 g_signal_connect(G_OBJECT(object), INDICATOR_OBJECT_SIGNAL_ENTRY_ADDED, G_CALLBACK(entry_change_cb), &added_value);
557 g_signal_connect(G_OBJECT(object), INDICATOR_OBJECT_SIGNAL_ENTRY_REMOVED, G_CALLBACK(entry_change_cb), &removed_value);
558+ g_signal_connect(G_OBJECT(object), INDICATOR_OBJECT_SIGNAL_ENTRY_MOVED, G_CALLBACK(entry_move_cb), &moved_value);
559
560 GList * list = indicator_object_get_entries(object);
561 g_assert(list != NULL);
562@@ -32,12 +39,30 @@
563
564 g_assert(GPOINTER_TO_UINT(added_value) == 5);
565 g_assert(GPOINTER_TO_UINT(removed_value) == 5);
566-
567- g_object_unref(object);
568-
569- return;
570-}
571-
572+ g_assert(GPOINTER_TO_UINT(moved_value) == 5);
573+
574+ g_object_unref(object);
575+
576+ return;
577+}
578+
579+void
580+test_loader_filename_dummy_simple_location (void)
581+{
582+ IndicatorObject * object = indicator_object_new_from_file(BUILD_DIR "/.libs/libdummy-indicator-simple.so");
583+ g_assert(object != NULL);
584+
585+ GList * entries = indicator_object_get_entries(object);
586+ g_assert(entries != NULL);
587+ g_assert(g_list_length(entries) == 1);
588+
589+ g_assert(indicator_object_get_location(object, (IndicatorObjectEntry *)entries->data) == 0);
590+ g_assert(indicator_object_get_location(object, NULL) == 0);
591+
592+ g_object_unref(object);
593+
594+ return;
595+}
596
597 void
598 test_loader_filename_dummy_simple_accessors (void)
599@@ -125,6 +150,7 @@
600 g_test_add_func ("/libindicator/loader/dummy/blank_load", test_loader_filename_dummy_null);
601 g_test_add_func ("/libindicator/loader/dummy/simple_load", test_loader_filename_dummy_simple);
602 g_test_add_func ("/libindicator/loader/dummy/simple_accessors", test_loader_filename_dummy_simple_accessors);
603+ g_test_add_func ("/libindicator/loader/dummy/simple_location", test_loader_filename_dummy_simple_location);
604 g_test_add_func ("/libindicator/loader/dummy/signaler", test_loader_filename_dummy_signaler);
605
606 return;

Subscribers

People subscribed via source and target branches

to all changes: