aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libindicator/indicator-object.c21
-rw-r--r--libindicator/indicator-object.h5
-rw-r--r--libindicator/indicator-service-manager.c29
3 files changed, 48 insertions, 7 deletions
diff --git a/libindicator/indicator-object.c b/libindicator/indicator-object.c
index 7469cb9..988a8ae 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_close:
+ @io: #IndicatorObject to query
+ @entry: The #IndicatorObjectEntry whose menu was closed
+ @timestamp: The X11 timestamp of the event
+
+ Used to tell the indicator that a menu has been closed for the
+ 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
diff --git a/libindicator/indicator-service-manager.c b/libindicator/indicator-service-manager.c
index c85f97b..34b6baa 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
@@ -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 */