From a17110ef804bc829df9f6e2275ed3210f7dc1031 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Sun, 9 Jan 2011 15:44:19 -0600 Subject: Adding a virtual function for closing the menu and a wrapper for it. --- libindicator/indicator-object.c | 21 +++++++++++++++++++++ libindicator/indicator-object.h | 5 +++++ 2 files changed, 26 insertions(+) diff --git a/libindicator/indicator-object.c b/libindicator/indicator-object.c index 7469cb9..f82a7c3 100644 --- a/libindicator/indicator-object.c +++ b/libindicator/indicator-object.c @@ -500,3 +500,24 @@ indicator_object_entry_activate (IndicatorObject * io, IndicatorObjectEntry * en return; } +/** + indicator_object_entry_activate: + @io: #IndicatorObject to query + @entry: The #IndicatorObjectEntry whose menu was closed + @timestamp: The X11 timestamp of the event + + Used to signal that a menu has been closed for the specific + entry that is specified. +*/ +void +indicator_object_entry_close (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp) +{ + g_return_if_fail(INDICATOR_IS_OBJECT(io)); + IndicatorObjectClass * class = INDICATOR_OBJECT_GET_CLASS(io); + + if (class->entry_close != NULL) { + return class->entry_close(io, entry, timestamp); + } + + return; +} diff --git a/libindicator/indicator-object.h b/libindicator/indicator-object.h index 6072f4f..9ad1366 100644 --- a/libindicator/indicator-object.h +++ b/libindicator/indicator-object.h @@ -83,6 +83,9 @@ typedef struct _IndicatorObjectEntry IndicatorObjectEntry; @get_show_now: Returns whether the entry is requesting to be shown "right now" in that it has something important to tell the user. + @entry_activate: Should be called when the menus for a given + entry are shown to the user. + @entry_close: Called when the menu is closed. @entry_added: Slot for #IndicatorObject::entry-added @entry_removed: Slot for #IndicatorObject::entry-removed @entry_moved: Slot for #IndicatorObject::entry-moved @@ -102,6 +105,7 @@ struct _IndicatorObjectClass { gboolean (*get_show_now) (IndicatorObject * io, IndicatorObjectEntry * entry); void (*entry_activate) (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp); + void (*entry_close) (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp); /* Signals */ void (*entry_added) (IndicatorObject * io, IndicatorObjectEntry * entry, gpointer user_data); @@ -150,6 +154,7 @@ GList * indicator_object_get_entries (IndicatorObject * io); guint indicator_object_get_location (IndicatorObject * io, IndicatorObjectEntry * entry); guint indicator_object_get_show_now (IndicatorObject * io, IndicatorObjectEntry * entry); void indicator_object_entry_activate (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp); +void indicator_object_entry_close (IndicatorObject * io, IndicatorObjectEntry * entry, guint timestamp); G_END_DECLS -- cgit v1.2.3 From 664e39bbed088df649d3135a0fd1c09f1fd882b6 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Sun, 9 Jan 2011 16:58:41 -0600 Subject: Using variant_unref instead of object_unref as it's a variant --- libindicator/indicator-service-manager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libindicator/indicator-service-manager.c b/libindicator/indicator-service-manager.c index c85f97b..4f98a5c 100644 --- a/libindicator/indicator-service-manager.c +++ b/libindicator/indicator-service-manager.c @@ -370,7 +370,7 @@ watch_cb (GObject * object, GAsyncResult * res, gpointer user_data) guint this_service_version; g_variant_get(params, "(uu)", &service_api_version, &this_service_version); - g_object_unref(params); + g_variant_unref(params); /* We've done it, now let's stop counting. */ /* Note: we're not checking versions. Because, the hope is that -- cgit v1.2.3 From 4a3d68bb35a2f371708568e199bdb0fc92af4ef5 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Sun, 9 Jan 2011 17:06:45 -0600 Subject: Using the GCancellable to detect if we're already creating a proxy so that we don't do it twice. --- libindicator/indicator-service-manager.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/libindicator/indicator-service-manager.c b/libindicator/indicator-service-manager.c index 4f98a5c..34b6baa 100644 --- a/libindicator/indicator-service-manager.c +++ b/libindicator/indicator-service-manager.c @@ -417,14 +417,17 @@ start_service (IndicatorServiceManager * service) g_return_if_fail(priv->name != NULL); + if (priv->service_proxy_cancel != NULL) { + /* A service proxy is being gotten currently */ + return; + } + if (priv->service_proxy != NULL) { g_object_unref(priv->service_proxy); priv->service_proxy = NULL; } - if (priv->service_proxy_cancel == NULL) { - priv->service_proxy_cancel = g_cancellable_new(); - } + priv->service_proxy_cancel = g_cancellable_new(); g_dbus_proxy_new_for_bus(G_BUS_TYPE_SESSION, G_DBUS_PROXY_FLAGS_NONE, @@ -446,13 +449,24 @@ static void service_proxy_cb (GObject * object, GAsyncResult * res, gpointer user_data) { GError * error = NULL; + + IndicatorServiceManager * service = INDICATOR_SERVICE_MANAGER(user_data); + g_return_if_fail(service != NULL); + GDBusProxy * proxy = g_dbus_proxy_new_for_bus_finish(res, &error); + IndicatorServiceManagerPrivate * priv = INDICATOR_SERVICE_MANAGER_GET_PRIVATE(user_data); + + if (priv->service_proxy_cancel != NULL) { + g_object_unref(priv->service_proxy_cancel); + priv->service_proxy_cancel = NULL; + } + if (error != NULL) { /* Unable to create the proxy, eh, let's try again in a bit */ g_error_free(error); - start_service_again(INDICATOR_SERVICE_MANAGER(user_data)); + start_service_again(service); return; } @@ -462,12 +476,13 @@ service_proxy_cb (GObject * object, GAsyncResult * res, gpointer user_data) odd that it wouldn't have an owner at this point. But, all we can do is try again. */ g_object_unref(proxy); - start_service_again(INDICATOR_SERVICE_MANAGER(user_data)); + start_service_again(service); return; } g_free(name); - IndicatorServiceManagerPrivate * priv = INDICATOR_SERVICE_MANAGER_GET_PRIVATE(user_data); + /* Okay, we're good to grab the proxy at this point, we're + sure that it's ours. */ priv->service_proxy = proxy; /* Signal for drop */ -- cgit v1.2.3 From 2b6655fef97e8d37f0d29b668fdd382692cdaca8 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 10 Jan 2011 10:19:52 -0600 Subject: Fixing doc strings --- libindicator/indicator-object.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libindicator/indicator-object.c b/libindicator/indicator-object.c index f82a7c3..988a8ae 100644 --- a/libindicator/indicator-object.c +++ b/libindicator/indicator-object.c @@ -501,12 +501,12 @@ indicator_object_entry_activate (IndicatorObject * io, IndicatorObjectEntry * en } /** - indicator_object_entry_activate: + indicator_object_entry_close: @io: #IndicatorObject to query @entry: The #IndicatorObjectEntry whose menu was closed @timestamp: The X11 timestamp of the event - Used to signal that a menu has been closed for the specific + Used to tell the indicator that a menu has been closed for the entry that is specified. */ void -- cgit v1.2.3