From 14cdff4c343ce0eee37f769a0ba815222c405086 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 7 Jul 2011 08:25:11 -0500 Subject: Handling the right box for the right version of GTK --- tools/indicator-loader.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/indicator-loader.c b/tools/indicator-loader.c index 0cdf1ff..027d364 100644 --- a/tools/indicator-loader.c +++ b/tools/indicator-loader.c @@ -44,7 +44,11 @@ entry_added (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user_d g_debug("Signal: Entry Added"); GtkWidget * menuitem = gtk_menu_item_new(); +#if GTK_CHECK_VERSION(3,0,0) GtkWidget * hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 3); +#else + GtkWidget * hbox = gtk_hbox_new(FALSE, 3); +#endif if (entry->image != NULL) { gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(entry->image), FALSE, FALSE, 0); -- cgit v1.2.3 From dedf43d1fcdf9c40643d581592728cf56e063e3d Mon Sep 17 00:00:00 2001 From: Ken VanDine Date: Thu, 7 Jul 2011 10:09:23 -0400 Subject: Changed to help message for --with-gtk to reflect the new default --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index 1188b04..bc11ce3 100644 --- a/configure.ac +++ b/configure.ac @@ -47,7 +47,7 @@ GIO_UNIX_REQUIRED_VERSION=2.22 AC_ARG_WITH([gtk], [AS_HELP_STRING([--with-gtk], - [Which version of gtk to use @<:@default=2@:>@])], + [Which version of gtk to use @<:@default=3@:>@])], [], [with_gtk=3]) AS_IF([test "x$with_gtk" = x3], -- cgit v1.2.3 From d23b4e89cdc6f95ff8e14d8a9fcb89ce2d8682d5 Mon Sep 17 00:00:00 2001 From: Ken VanDine Date: Thu, 7 Jul 2011 10:38:35 -0400 Subject: Make xsessiondir = $(pkgdatadir) --- tools/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/Makefile.am b/tools/Makefile.am index 287d34f..cefd944 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -34,7 +34,7 @@ indicator_loader3_SOURCES = $(indicator_loader_SOURCES) indicator_loader3_CFLAGS = $(indicator_loader_CFLAGS) indicator_loader3_LDADD = $(indicator_loader_LDADD) -xsessiondir = $(sysconfdir)/X11/Xsession.d +xsessiondir = $(pkgdatadir) xsession_DATA = 80indicator-debugging -- cgit v1.2.3 From 801419bd8a07b7870fc7dcaa5b154c5d2c028c98 Mon Sep 17 00:00:00 2001 From: Robert Ancell Date: Fri, 8 Jul 2011 10:39:59 +1000 Subject: Annotate the return value of indicator_object_get_entries so that the type in the list is known, also fix typo in docstring --- libindicator/indicator-object.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libindicator/indicator-object.c b/libindicator/indicator-object.c index 2fe8dd1..a563ebe 100644 --- a/libindicator/indicator-object.c +++ b/libindicator/indicator-object.c @@ -447,15 +447,15 @@ get_entries_default (IndicatorObject * io) } /** - indicator_object_get_entires: + indicator_object_get_entries: @io: #IndicatorObject to query This function looks on the class for the object and calls it's #IndicatorObjectClass::get_entries function. The list should be owned by the caller, but the individual - enteries should not be. + entries should not be. - Return value: A list if #IndicatorObjectEntry structures or + Return value: (element-type IndicatorObjectEntry) (transfer container): A list if #IndicatorObjectEntry structures or NULL if there is an error. */ GList * -- cgit v1.2.3 From ee271867c1390ff9438158a3b88387432cd24f37 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 11 Jul 2011 16:00:12 -0500 Subject: Handle NULL entries without crashing --- tools/indicator-loader.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/indicator-loader.c b/tools/indicator-loader.c index 027d364..06dd4b4 100644 --- a/tools/indicator-loader.c +++ b/tools/indicator-loader.c @@ -32,7 +32,9 @@ activate_entry (GtkWidget * widget, gpointer user_data) { g_return_if_fail(INDICATOR_IS_OBJECT(user_data)); gpointer entry = g_object_get_data(G_OBJECT(widget), ENTRY_DATA_NAME); - g_return_if_fail(entry == NULL); + if (entry == NULL) { + g_debug("Activation on: (null)"); + } indicator_object_entry_activate(INDICATOR_OBJECT(user_data), (IndicatorObjectEntry *)entry, gtk_get_current_event_time()); return; @@ -99,7 +101,11 @@ entry_removed (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user static void menu_show (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp, gpointer user_data) { - g_debug("Show Menu: %s", entry->label != NULL ? gtk_label_get_text(entry->label) : "No Label"); + if (entry != NULL) { + g_debug("Show Menu: %s", entry->label != NULL ? gtk_label_get_text(entry->label) : "No Label"); + } else { + g_debug("Show Menu: (null)"); + } return; } -- cgit v1.2.3 From 0c3a68569683c34c08ae9bf8183bcd360c175fb7 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 11 Jul 2011 16:06:10 -0500 Subject: Add the PC file instead of replace it --- libindicator/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libindicator/Makefile.am b/libindicator/Makefile.am index 4433655..f9fb011 100644 --- a/libindicator/Makefile.am +++ b/libindicator/Makefile.am @@ -22,7 +22,7 @@ INDICATOR_API_VERSION = 4 -e "s|\@indicator_abi_version\@|$(INDICATOR_ABI_VERSION)|" \ $< > $@ -CLEANFILES = indicator$(VER)-0.$(INDICATOR_API_VERSION).pc +CLEANFILES += indicator$(VER)-0.$(INDICATOR_API_VERSION).pc include $(top_srcdir)/Makefile.am.marshal -- cgit v1.2.3 From 269f1a1483dc6bed062ed970d05655ba26ed57c3 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 11 Jul 2011 16:34:48 -0500 Subject: Define the bus well known type in the session.conf file --- tests/Makefile.am | 4 ---- tests/session.conf.in | 2 ++ 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index e78ac6b..9425789 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -258,8 +258,6 @@ service-manager-connect-tester: service-manager-connect service-manager-connect- TESTS += service-manager-connect-tester DISTCLEANFILES += service-manager-connect-tester session.conf service-manager-connect.service -# Bug 806690 -XFAIL_TESTS += service-manager-connect-tester ############################# # Service Versions @@ -323,8 +321,6 @@ service-version-tester: service-version-manager service-version-bad-service serv TESTS += service-version-tester DISTCLEANFILES += service-version-tester service-version-bad.service service-version-good.service -# Bug 806691 -XFAIL_TESTS += service-version-tester ############################# # Service Versions diff --git a/tests/session.conf.in b/tests/session.conf.in index d1e2805..5c0cf36 100644 --- a/tests/session.conf.in +++ b/tests/session.conf.in @@ -1,6 +1,8 @@ + session + -- cgit v1.2.3 From 64c3e2e2ba1ddcaac62e6ec50f414abd51e6b3d9 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 11 Jul 2011 17:01:12 -0500 Subject: Cleaning up removal of watchers as the string was getting free'd before it could get used to remove the entry from the hashtable. Now using a destroy function as that is possible with GDBus but wasn't with dbus-glib --- libindicator/indicator-service.c | 20 +++++++++----------- tests/Makefile.am | 2 -- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/libindicator/indicator-service.c b/libindicator/indicator-service.c index e5eaa5b..1b4bc8c 100644 --- a/libindicator/indicator-service.c +++ b/libindicator/indicator-service.c @@ -32,7 +32,7 @@ License along with this library. If not, see #include "dbus-shared.h" static void unwatch_core (IndicatorService * service, const gchar * name); -static gboolean watchers_remove (gpointer key, gpointer value, gpointer user_data); +static void watchers_remove (gpointer value); static void bus_get_cb (GObject * object, GAsyncResult * res, gpointer user_data); static GVariant * bus_watch (IndicatorService * service, const gchar * sender); @@ -203,10 +203,9 @@ indicator_service_init (IndicatorService *self) } /* NOTE: We're using g_free here because that's what needs to - happen, but you really should call watchers_remove first as well - since that disconnects the signals. We can't do that with a callback - here because there is no user data to pass the object as well. */ - priv->watchers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); + happen and we're watchers_remove as well to clean up the dbus + watches we've setup. */ + priv->watchers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, watchers_remove); priv->bus_cancel = g_cancellable_new(); g_bus_get(G_BUS_TYPE_SESSION, @@ -225,7 +224,8 @@ indicator_service_dispose (GObject *object) IndicatorServicePrivate * priv = INDICATOR_SERVICE_GET_PRIVATE(object); if (priv->watchers != NULL) { - g_hash_table_foreach_remove(priv->watchers, watchers_remove, object); + g_hash_table_destroy(priv->watchers); + priv->watchers = NULL; } if (priv->timeout != 0) { @@ -407,11 +407,11 @@ bus_method_call (GDBusConnection * connection, const gchar * sender, const gchar /* A function to remove the signals on a proxy before we destroy it because in this case we've stopped caring. */ -static gboolean -watchers_remove (gpointer key, gpointer value, gpointer user_data) +static void +watchers_remove (gpointer value) { g_bus_unwatch_name(GPOINTER_TO_UINT(value)); - return TRUE; + return; } /* This is the function that gets executed if we timeout @@ -553,8 +553,6 @@ unwatch_core (IndicatorService * service, const gchar * name) /* Remove us from the watcher list here */ gpointer watcher_item = g_hash_table_lookup(priv->watchers, name); if (watcher_item != NULL) { - /* Free the watcher */ - watchers_remove((gpointer)name, watcher_item, service); g_hash_table_remove(priv->watchers, name); } else { /* Odd that we couldn't find the person, but, eh */ diff --git a/tests/Makefile.am b/tests/Makefile.am index 9425789..f11a9d1 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -378,8 +378,6 @@ service-version-multiwatch-tester: service-version-multiwatch-manager service-ve TESTS += service-version-multiwatch-tester DISTCLEANFILES += service-version-multiwatch-tester -# Bug 806692 -XFAIL_TESTS += service-version-multiwatch-tester ############################# # Service Manager Shutdown -- cgit v1.2.3 From b412bfe918592d1986743e52d967205395788da3 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 12 Jul 2011 10:14:12 -0500 Subject: Adding in a property for being in replace mode --- libindicator/indicator-service.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libindicator/indicator-service.c b/libindicator/indicator-service.c index e5eaa5b..0e87332 100644 --- a/libindicator/indicator-service.c +++ b/libindicator/indicator-service.c @@ -57,6 +57,7 @@ struct _IndicatorServicePrivate { GHashTable * watchers; guint this_service_version; guint dbus_registration; + gboolean replace_mode; }; /* Signals Stuff */ @@ -192,6 +193,7 @@ indicator_service_init (IndicatorService *self) priv->this_service_version = 0; priv->timeout_length = 500; priv->dbus_registration = 0; + priv->replace_mode = FALSE; const gchar * timeoutenv = g_getenv("INDICATOR_SERVICE_SHUTDOWN_TIMEOUT"); if (timeoutenv != NULL) { @@ -202,6 +204,12 @@ indicator_service_init (IndicatorService *self) } } + const gchar * replaceenv = g_getenv("INDICATOR_SERVICE_REPLACE_MODE"); + if (replaceenv != NULL) { + priv->replace_mode = TRUE; + g_debug("Putting into replace mode"); + } + /* NOTE: We're using g_free here because that's what needs to happen, but you really should call watchers_remove first as well since that disconnects the signals. We can't do that with a callback -- cgit v1.2.3 From 5de36e3edb6286f9768ac6aa3c96616b6522efe3 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 12 Jul 2011 10:43:45 -0500 Subject: In replace mode we need to ask the other guy to shutdown and still wait for the name a bit. --- libindicator/indicator-service.c | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/libindicator/indicator-service.c b/libindicator/indicator-service.c index 0e87332..5a15d5e 100644 --- a/libindicator/indicator-service.c +++ b/libindicator/indicator-service.c @@ -470,8 +470,33 @@ try_and_get_name_lost_cb (GDBusConnection * connection, const gchar * name, gpoi g_return_if_fail(connection != NULL); g_return_if_fail(INDICATOR_IS_SERVICE(user_data)); - g_warning("Name request failed."); - g_signal_emit(G_OBJECT(user_data), signals[SHUTDOWN], 0, TRUE); + IndicatorServicePrivate * priv = INDICATOR_SERVICE_GET_PRIVATE(user_data); + + if (!priv->replace_mode) { + g_warning("Name request failed."); + g_signal_emit(G_OBJECT(user_data), signals[SHUTDOWN], 0, TRUE); + } else { + /* If we're in replace mode we can be a little more trickey + here. We're going to tell the other guy to shutdown and hope + that we get the name. */ + GDBusMessage * message = NULL; + message = g_dbus_message_new_method_call(name, + INDICATOR_SERVICE_OBJECT, + INDICATOR_SERVICE_INTERFACE, + "Shutdown"); + + g_dbus_connection_send_message(connection, message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL); + g_object_unref(message); + + /* Check to see if we need to clean up a timeout */ + if (priv->timeout != 0) { + g_source_remove(priv->timeout); + priv->timeout = 0; + } + + /* Set a timeout for no watchers if we can't get the name */ + priv->timeout = g_timeout_add(priv->timeout_length * 4, timeout_no_watchers, user_data); + } return; } -- cgit v1.2.3 From 1838bfc6981fec3b0131e28cdbddb9cb4e4b0ec8 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 12 Jul 2011 10:46:35 -0500 Subject: Adding in the shutdown function --- libindicator/indicator-service.c | 2 ++ libindicator/indicator-service.xml | 1 + 2 files changed, 3 insertions(+) diff --git a/libindicator/indicator-service.c b/libindicator/indicator-service.c index 5a15d5e..d7ab375 100644 --- a/libindicator/indicator-service.c +++ b/libindicator/indicator-service.c @@ -405,6 +405,8 @@ bus_method_call (GDBusConnection * connection, const gchar * sender, const gchar retval = bus_watch(service, sender); } else if (g_strcmp0(method, "UnWatch") == 0) { unwatch_core(service, sender); + } else if (g_strcmp0(method, "Shutdown") == 0) { + g_signal_emit(G_OBJECT(service), signals[SHUTDOWN], 0, TRUE); } else { g_warning("Calling method '%s' on the indicator service and it's unknown", method); } diff --git a/libindicator/indicator-service.xml b/libindicator/indicator-service.xml index 6bd7d80..71ef4df 100644 --- a/libindicator/indicator-service.xml +++ b/libindicator/indicator-service.xml @@ -13,6 +13,7 @@ + -- cgit v1.2.3 From 2e66ca5c013f2f37fc274c9d02b714fe6d21928e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 12 Jul 2011 14:34:50 -0500 Subject: Watching when we do name switches --- libindicator/indicator-service-manager.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/libindicator/indicator-service-manager.c b/libindicator/indicator-service-manager.c index f3a29d0..f58c148 100644 --- a/libindicator/indicator-service-manager.c +++ b/libindicator/indicator-service-manager.c @@ -536,8 +536,9 @@ service_proxy_name_changed (GDBusConnection * connection, const gchar * sender_n { IndicatorServiceManagerPrivate * priv = INDICATOR_SERVICE_MANAGER_GET_PRIVATE(user_data); - const gchar * new_name; - g_variant_get(parameters, "(&s&s&s)", NULL, NULL, &new_name); + const gchar * new_name = NULL; + const gchar * prev_name = NULL; + g_variant_get(parameters, "(&s&s&s)", NULL, &prev_name, &new_name); if (new_name == NULL || new_name[0] == 0) { if (priv->connected) { @@ -547,10 +548,27 @@ service_proxy_name_changed (GDBusConnection * connection, const gchar * sender_n start_service_again(INDICATOR_SERVICE_MANAGER(user_data)); } else { + /* If we weren't connected before, we are now. Let's tell the + world! */ if (!priv->connected) { priv->connected = TRUE; g_signal_emit(G_OBJECT(user_data), signals[CONNECTION_CHANGE], 0, TRUE, TRUE); } + + /* If the names are both valid, and they're not the same, it means that + we've actually changed. So we need to tell the new guy that we're + watching them */ + if (new_name != NULL && prev_name != NULL && new_name[0] != 0 && prev_name != 0 && g_strcmp0(prev_name, new_name) != 0) { + /* Send watch */ + g_dbus_proxy_call(priv->service_proxy, + "Watch", + NULL, /* params */ + G_DBUS_CALL_FLAGS_NONE, + -1, + priv->watch_cancel, + watch_cb, + user_data); + } } return; -- cgit v1.2.3 From c6d763c2fa431fefd0869d381b15c25364e8972f Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 14 Jul 2011 13:09:21 -0500 Subject: 0.3.91 --- configure.ac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index bc11ce3..e8a162f 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_INIT([libindicator], - [0.3.90], + [0.3.91], [http://bugs.launchpad.net/libindicator], [libindicator], [http://launchpad.net/libindicator]) -- cgit v1.2.3