From e4b55fd76e9506e3ecfe98b60518849c8b1ac87d Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 12 Nov 2010 13:20:29 -0600 Subject: Switching the headers and private variables --- libdbusmenu-glib/client.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 6a51764..2aa938c 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -30,7 +30,7 @@ License version 3 and version 2.1 along with this program. If not, see #include "config.h" #endif -#include +#include #include #include @@ -39,7 +39,6 @@ License version 3 and version 2.1 along with this program. If not, see #include "menuitem.h" #include "menuitem-private.h" #include "client-menuitem.h" -#include "dbusmenu-client.h" #include "server-marshal.h" #include "client-marshal.h" @@ -69,15 +68,15 @@ struct _DbusmenuClientPrivate gchar * dbus_object; gchar * dbus_name; - DBusGConnection * session_bus; - DBusGProxy * menuproxy; - DBusGProxy * propproxy; - DBusGProxyCall * layoutcall; + GDBusConnection * session_bus; + GDBusProxy * menuproxy; + GDBusProxy * propproxy; + GCancellable * layoutcall; gint current_revision; gint my_revision; - DBusGProxy * dbusproxy; + GDBusProxy * dbusproxy; GHashTable * type_handlers; -- cgit v1.2.3 From 6d36d55acf43696ba371d1af757e0662d89918d3 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 12 Nov 2010 13:20:48 -0600 Subject: Changing the flush --- libdbusmenu-glib/client.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 2aa938c..8ede85d 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -562,6 +562,21 @@ get_properties_idle (gpointer user_data) return FALSE; } +/* Report and error if we're unable to flush the connection, likely + to be a cause of some other issues. */ +static void +connection_flush_cb (GObject * object, GAsyncResult * result, gpointer user_data) +{ + GError * error = NULL; + + if (!g_dbus_connection_flush_finish(G_DBUS_CONNECTION(object), result, &error)) { + g_warning("Unable to flush DBus connection: %s", error->message); + g_error_free(error); + } + + return; +} + /* Forces a call out to start getting properties with the menu items that we have queued up already. */ static void @@ -578,7 +593,11 @@ get_properties_flush (DbusmenuClient * client) get_properties_idle(client); - dbus_g_connection_flush(priv->session_bus); + /* I'm not sure this flush is necissary with GDBus running the + DBus connection in another thread. But, I don't think that + it'll hurt anything either, so I'm leaving it in. */ + g_return_if_fail(priv->session_bus != NULL); + g_dbus_connection_flush(priv->session_bus, NULL, connection_flush_cb, NULL); return; } -- cgit v1.2.3 From 51c9cc0eb87f0a379c891a23162e232b1f597bd6 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 12 Nov 2010 13:57:22 -0600 Subject: Changing the flow for creating the async session bus. It is now cancellable. --- libdbusmenu-glib/client.c | 65 ++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 59 insertions(+), 6 deletions(-) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 8ede85d..f662f74 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -69,6 +69,8 @@ struct _DbusmenuClientPrivate gchar * dbus_name; GDBusConnection * session_bus; + GCancelable * session_bus_cancel; + GDBusProxy * menuproxy; GDBusProxy * propproxy; GCancellable * layoutcall; @@ -261,6 +263,8 @@ dbusmenu_client_init (DbusmenuClient *self) priv->dbus_name = NULL; priv->session_bus = NULL; + priv->session_bus_cancel = NULL; + priv->menuproxy = NULL; priv->propproxy = NULL; priv->layoutcall = NULL; @@ -339,7 +343,16 @@ dbusmenu_client_dispose (GObject *object) g_object_unref(G_OBJECT(priv->dbusproxy)); priv->dbusproxy = NULL; } - priv->session_bus = NULL; + + if (priv->session_bus_cancel != NULL) { + g_cancellable_cancel(priv->session_bus_cancel); + g_object_unref(priv->session_bus_cancel); + priv->session_bus_cancel = NULL; + } + if (priv->session_bus != NULL) { + g_object_unref(priv->session_bus); + priv->session_bus = NULL; + } if (priv->root != NULL) { g_object_unref(G_OBJECT(priv->root)); @@ -848,6 +861,37 @@ proxy_destroyed (GObject * gobj_proxy, gpointer userdata) return; } +/* Respond to us getting the session bus (hopefully) or handle + the error if not */ +void +session_bus_cb (GObject * object, GAsyncResult * res, gpointer user_data) +{ + GError * error = NULL; + + /* NOTE: We're not using any other variables before checking + the result because they could be destroyed and thus invalid */ + GDBusConnection * bus = g_bus_get_finish(res, &error); + if (error != NULL) { + g_warning("Unable to get session bus: %s", error->message); + g_error_free(error); + return; + } + + /* If this wasn't cancelled, we should be good */ + DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); + priv->session_bus = bus; + + if (priv->session_bus_cancel != NULL) { + g_object_unref(priv->session_bus_cancel); + priv->session_bus_cancel = NULL; + } + + /* Retry to build the proxies now that we have a bus */ + build_proxies(DBUSMENU_CLIENT(user_data)); + + return; +} + /* When we have a name and an object, build the two proxies and get the first version of the layout */ static void @@ -859,11 +903,20 @@ build_proxies (DbusmenuClient * client) g_return_if_fail(priv->dbus_object != NULL); g_return_if_fail(priv->dbus_name != NULL); - priv->session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, &error); - if (error != NULL) { - g_error("Unable to get session bus: %s", error->message); - g_error_free(error); - build_dbus_proxy(client); + if (priv->session_bus == NULL) { + /* We don't have the session bus yet, that's okay, but + we need to handle that. */ + + /* If we're already running we don't need to look again. */ + if (priv->session_bus_cancel == NULL) { + priv->session_bus_cancel = g_cancellable_new(); + + /* Async get the session bus */ + g_bus_get(G_BUS_SESSION, priv->session_bus_cancel, session_bus_cb, client); + } + + /* This function exists, it'll be called again when we get + the session bus so this condition will be ignored */ return; } -- cgit v1.2.3 From 030de7ba74d6560ef61b31913c244a4be1d5116b Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 12 Nov 2010 14:26:31 -0600 Subject: Removing the proxy for the property interface on the object as GDBus puts that in the standard proxy now --- libdbusmenu-glib/client.c | 26 +------------------------- 1 file changed, 1 insertion(+), 25 deletions(-) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index f662f74..f672696 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -69,10 +69,9 @@ struct _DbusmenuClientPrivate gchar * dbus_name; GDBusConnection * session_bus; - GCancelable * session_bus_cancel; + GCancellable * session_bus_cancel; GDBusProxy * menuproxy; - GDBusProxy * propproxy; GCancellable * layoutcall; gint current_revision; @@ -266,7 +265,6 @@ dbusmenu_client_init (DbusmenuClient *self) priv->session_bus_cancel = NULL; priv->menuproxy = NULL; - priv->propproxy = NULL; priv->layoutcall = NULL; priv->current_revision = 0; @@ -335,10 +333,6 @@ dbusmenu_client_dispose (GObject *object) g_object_unref(G_OBJECT(priv->menuproxy)); priv->menuproxy = NULL; } - if (priv->propproxy != NULL) { - g_object_unref(G_OBJECT(priv->propproxy)); - priv->propproxy = NULL; - } if (priv->dbusproxy != NULL) { g_object_unref(G_OBJECT(priv->dbusproxy)); priv->dbusproxy = NULL; @@ -920,20 +914,6 @@ build_proxies (DbusmenuClient * client) return; } - priv->propproxy = dbus_g_proxy_new_for_name_owner(priv->session_bus, - priv->dbus_name, - priv->dbus_object, - DBUS_INTERFACE_PROPERTIES, - &error); - if (error != NULL) { - g_warning("Unable to get property proxy for %s on %s: %s", priv->dbus_name, priv->dbus_object, error->message); - g_error_free(error); - build_dbus_proxy(client); - return; - } - g_object_add_weak_pointer(G_OBJECT(priv->propproxy), (gpointer *)&priv->propproxy); - g_signal_connect(G_OBJECT(priv->propproxy), "destroy", G_CALLBACK(proxy_destroyed), client); - priv->menuproxy = dbus_g_proxy_new_for_name_owner(priv->session_bus, priv->dbus_name, priv->dbus_object, @@ -1551,10 +1531,6 @@ dbusmenu_client_get_root (DbusmenuClient * client) DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); - if (priv->propproxy == NULL) { - return NULL; - } - #ifdef MASSIVEDEBUGGING g_debug("Client get root: %X", (guint)priv->root); #endif -- cgit v1.2.3 From efd88243d8e4e8911f08e86744ef13387ac4ae6a Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 12 Nov 2010 14:30:46 -0600 Subject: Including the interface description and building the objects from it once --- libdbusmenu-glib/client.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index f672696..30dce89 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -41,6 +41,7 @@ License version 3 and version 2.1 along with this program. If not, see #include "client-menuitem.h" #include "server-marshal.h" #include "client-marshal.h" +#include "dbus-menu.xml.h" /* Properties */ enum { @@ -136,6 +137,10 @@ static void get_properties_globber (DbusmenuClient * client, gint id, const gcha static GQuark error_domain (void); static void item_activated (DBusGProxy * proxy, gint id, guint timestamp, DbusmenuClient * client); +/* Globals */ +static GDBusNodeInfo * dbusmenu_node_info = NULL; +static GDBusInterfaceInfo * dbusmenu_interface_info = NULL; + /* Build a type */ G_DEFINE_TYPE (DbusmenuClient, dbusmenu_client, G_TYPE_OBJECT); @@ -246,6 +251,24 @@ dbusmenu_client_class_init (DbusmenuClientClass *klass) NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); + if (dbusmenu_node_info == NULL) { + GError * error = NULL; + + dbusmenu_node_info = g_dbus_node_info_new_for_xml(dbus_menu_xml, &error); + if (error != NULL) { + g_error("Unable to parse DBusmenu Interface description: %s", error->message); + g_error_free(error); + } + } + + if (dbusmenu_interface_info == NULL) { + dbusmenu_interface_info = g_dbus_node_info_lookup_interface(dbusmenu_node_info, DBUSMENU_INTERFACE); + + if (dbusmenu_interface_info == NULL) { + g_error("Unable to find interface '" DBUSMENU_INTERFACE "'"); + } + } + return; } -- cgit v1.2.3 From 08053906621fc5240e7bb7a549a09b0acf930809 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 12 Nov 2010 15:04:45 -0600 Subject: Adding a cancellable for the menu proxy in the private object --- libdbusmenu-glib/client.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 30dce89..17f52b4 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -73,6 +73,8 @@ struct _DbusmenuClientPrivate GCancellable * session_bus_cancel; GDBusProxy * menuproxy; + GCancellable * menuproxy_cancel; + GCancellable * layoutcall; gint current_revision; @@ -288,6 +290,8 @@ dbusmenu_client_init (DbusmenuClient *self) priv->session_bus_cancel = NULL; priv->menuproxy = NULL; + priv->menuproxy_cancel = NULL; + priv->layoutcall = NULL; priv->current_revision = 0; @@ -352,15 +356,26 @@ dbusmenu_client_dispose (GObject *object) dbus_g_proxy_cancel_call(priv->menuproxy, priv->layoutcall); priv->layoutcall = NULL; } + + /* Bring down the menu proxy, ensure we're not + looking for one at the same time. */ + if (priv->menuproxy_cancel != NULL) { + g_cancellable_cancel(priv->menuproxy_cancel); + g_object_unref(priv->menuproxy_cancel); + priv->menuproxy_cancel = NULL; + } if (priv->menuproxy != NULL) { g_object_unref(G_OBJECT(priv->menuproxy)); priv->menuproxy = NULL; } + if (priv->dbusproxy != NULL) { g_object_unref(G_OBJECT(priv->dbusproxy)); priv->dbusproxy = NULL; } + /* Bring down the session bus, ensure we're not + looking for one at the same time. */ if (priv->session_bus_cancel != NULL) { g_cancellable_cancel(priv->session_bus_cancel); g_object_unref(priv->session_bus_cancel); -- cgit v1.2.3 From 88cc4c919ee836870a326f22eb0b773f8395aeec Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 12 Nov 2010 15:05:22 -0600 Subject: Reshuffling the creation of the menu proxy to be async with a callback. --- libdbusmenu-glib/client.c | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 17f52b4..42144ae 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -138,6 +138,7 @@ static void menuitem_get_properties_cb (DBusGProxy * proxy, GHashTable * propert static void get_properties_globber (DbusmenuClient * client, gint id, const gchar ** properties, org_ayatana_dbusmenu_get_properties_reply callback, gpointer user_data); static GQuark error_domain (void); static void item_activated (DBusGProxy * proxy, gint id, guint timestamp, DbusmenuClient * client); +static void menuproxy_build_cb (GObject * object, GAsyncResult * res, gpointer user_data); /* Globals */ static GDBusNodeInfo * dbusmenu_node_info = NULL; @@ -952,17 +953,33 @@ build_proxies (DbusmenuClient * client) return; } - priv->menuproxy = dbus_g_proxy_new_for_name_owner(priv->session_bus, - priv->dbus_name, - priv->dbus_object, - "org.ayatana.dbusmenu", - &error); - if (error != NULL) { - g_warning("Unable to get dbusmenu proxy for %s on %s: %s", priv->dbus_name, priv->dbus_object, error->message); - g_error_free(error); - build_dbus_proxy(client); - return; + /* Build us a menu proxy */ + if (priv->menuproxy == NULL) { + + /* Check to see if we're already building one */ + if (priv->menuproxy_cancel == NULL) { + priv->menuproxy_cancel = g_cancellable_new(); + + g_dbus_proxy_new(priv->session_bus, + G_DBUS_PROXY_FLAGS_NONE, + dbusmenu_interface_info, + priv->dbus_name, + priv->dbus_object, + DBUSMENU_INTERFACE, + priv->menuproxy_cancel, + menuproxy_build_cb, + client); + } } + + return; +} + +/* Callback when we know if the menu proxy can be created or + not and do something with it! */ +static void +menuproxy_build_cb (GObject * object, GAsyncResult * res, gpointer user_data) +{ g_object_add_weak_pointer(G_OBJECT(priv->menuproxy), (gpointer *)&priv->menuproxy); g_signal_connect(G_OBJECT(priv->menuproxy), "destroy", G_CALLBACK(proxy_destroyed), client); -- cgit v1.2.3 From 567ff35378371596e1304cad97f634969e954cc1 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Fri, 12 Nov 2010 16:56:07 -0600 Subject: Adjusting how the menu proxy gets built up and signals connected --- libdbusmenu-glib/client.c | 83 +++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 69 insertions(+), 14 deletions(-) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 42144ae..d2bfc8f 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -139,6 +139,8 @@ static void get_properties_globber (DbusmenuClient * client, gint id, const gcha static GQuark error_domain (void); static void item_activated (DBusGProxy * proxy, gint id, guint timestamp, DbusmenuClient * client); static void menuproxy_build_cb (GObject * object, GAsyncResult * res, gpointer user_data); +static void menuproxy_name_changed_cb (GObject * object, GParamSpec * pspec, gpointer user_data); +static void menuproxy_signal_cb (GDBusProxy * proxy, gchar * sender, gchar * signal, GVariant * params, gpointer user_data); /* Globals */ static GDBusNodeInfo * dbusmenu_node_info = NULL; @@ -980,8 +982,25 @@ build_proxies (DbusmenuClient * client) static void menuproxy_build_cb (GObject * object, GAsyncResult * res, gpointer user_data) { - g_object_add_weak_pointer(G_OBJECT(priv->menuproxy), (gpointer *)&priv->menuproxy); - g_signal_connect(G_OBJECT(priv->menuproxy), "destroy", G_CALLBACK(proxy_destroyed), client); + GError * error = NULL; + + /* NOTE: We're not using any other variables before checking + the result because they could be destroyed and thus invalid */ + GDBusProxy * proxy = g_dbus_proxy_new_finish(res, &error); + if (error != NULL) { + g_warning("Unable to get menu proxy: %s", error->message); + g_error_free(error); + return; + } + + /* If this wasn't cancelled, we should be good */ + DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(user_data); + priv->menuproxy = proxy; + + if (priv->menuproxy_cancel != NULL) { + g_object_unref(priv->menuproxy_cancel); + priv->menuproxy_cancel = NULL; + } /* If we get here, we don't need the DBus proxy */ if (priv->dbusproxy != NULL) { @@ -989,22 +1008,58 @@ menuproxy_build_cb (GObject * object, GAsyncResult * res, gpointer user_data) priv->dbusproxy = NULL; } - dbus_g_object_register_marshaller(_dbusmenu_server_marshal_VOID__UINT_INT, G_TYPE_NONE, G_TYPE_UINT, G_TYPE_INT, G_TYPE_INVALID); - dbus_g_proxy_add_signal(priv->menuproxy, "LayoutUpdated", G_TYPE_UINT, G_TYPE_INT, G_TYPE_INVALID); - dbus_g_proxy_connect_signal(priv->menuproxy, "LayoutUpdated", G_CALLBACK(layout_update), client, NULL); + g_signal_connect(priv->menuproxy, "g-signal", G_CALLBACK(menuproxy_signal_cb), client); + g_signal_connect(priv->menuproxy, "notify::g-name-owner", G_CALLBACK(menuproxy_name_changed_cb), client); - dbus_g_object_register_marshaller(_dbusmenu_server_marshal_VOID__INT_STRING_POINTER, G_TYPE_NONE, G_TYPE_INT, G_TYPE_STRING, G_TYPE_VALUE, G_TYPE_INVALID); - dbus_g_proxy_add_signal(priv->menuproxy, "ItemPropertyUpdated", G_TYPE_INT, G_TYPE_STRING, G_TYPE_VALUE, G_TYPE_INVALID); - dbus_g_proxy_connect_signal(priv->menuproxy, "ItemPropertyUpdated", G_CALLBACK(id_prop_update), client, NULL); + update_layout(client); - dbus_g_proxy_add_signal(priv->menuproxy, "ItemUpdated", G_TYPE_INT, G_TYPE_INVALID); - dbus_g_proxy_connect_signal(priv->menuproxy, "ItemUpdated", G_CALLBACK(id_update), client, NULL); + return; +} + +/* Handle the case where we change owners */ +static void +menuproxy_name_changed_cb (GObject * object, GParamSpec * pspec, gpointer user_data) +{ + GDBusProxy * proxy = G_DBUS_PROXY(object); - dbus_g_object_register_marshaller(_dbusmenu_server_marshal_VOID__INT_UINT, G_TYPE_NONE, G_TYPE_INT, G_TYPE_UINT, G_TYPE_INVALID); - dbus_g_proxy_add_signal(priv->menuproxy, "ItemActivationRequested", G_TYPE_INT, G_TYPE_UINT, G_TYPE_INVALID); - dbus_g_proxy_connect_signal(priv->menuproxy, "ItemActivationRequested", G_CALLBACK(item_activated), client, NULL); + gchar * owner = g_dbus_proxy_get_name_owner(proxy); - update_layout(client); + if (owner == NULL) { + /* Oh, no! We lost our owner! */ + proxy_destroyed(G_OBJECT(proxy), user_data); + } else { + g_free(owner); + } + + return; +} + +/* Handle the signals out of the proxy */ +static void +menuproxy_signal_cb (GDBusProxy * proxy, gchar * sender, gchar * signal, GVariant * params, gpointer user_data) +{ + g_return_if_fail(DBUSMENU_IS_CLIENT(user_data)); + DbusmenuClient * client = DBUSMENU_CLIENT(user_data); + + if (g_strcmp0(signal, "LayoutUpdated") == 0) { + guint revision; gint parent; + g_variant_get(params, "(ui)", &revision, &parent); + layout_update(proxy, revision, parent, client); + } else if (g_strcmp0(signal, "ItemPropertyUpdated") == 0) { + gint id; gchar * property; GVariant * value; + g_variant_get(params, "(isv)", &id, &property, &value); + id_prop_update(proxy, id, property, value, client); + } else if (g_strcmp0(signal, "ItemUpdated") == 0) { + gint id; + g_variant_get(params, "(i)", &id); + id_update(proxy, id, client); + } else if (g_strcmp0(signal, "ItemActivationRequested") == 0) { + gint id; guint timestamp; + g_variant_get(params, "(iu)", &id, ×tamp); + item_activated(proxy, id, timestamp, client); + } else { + g_warning("Received signal '%s' from menu proxy that is unknown", signal); + } return; } -- cgit v1.2.3 From a71b34a9103a9a383cff69bfe7b44319f7cb114c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 15 Nov 2010 08:45:02 -0600 Subject: Changing the function prototype for properties callback to be local, and make more sense. --- libdbusmenu-glib/client.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index d2bfc8f..6f31354 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -60,6 +60,8 @@ enum { LAST_SIGNAL }; +typedef void (*properties_func) (DbusmenuClient * client, GVariant * properties); + static guint signals[LAST_SIGNAL] = { 0 }; struct _DbusmenuClientPrivate @@ -100,7 +102,7 @@ struct _newItemPropData typedef struct _properties_listener_t properties_listener_t; struct _properties_listener_t { gint id; - org_ayatana_dbusmenu_get_properties_reply callback; + properties_func callback; gpointer user_data; gboolean replied; }; @@ -135,7 +137,7 @@ static gint parse_layout (DbusmenuClient * client, const gchar * layout); static void update_layout_cb (DBusGProxy * proxy, guint rev, gchar * xml, GError * in_error, void * data); static void update_layout (DbusmenuClient * client); static void menuitem_get_properties_cb (DBusGProxy * proxy, GHashTable * properties, GError * error, gpointer data); -static void get_properties_globber (DbusmenuClient * client, gint id, const gchar ** properties, org_ayatana_dbusmenu_get_properties_reply callback, gpointer user_data); +static void get_properties_globber (DbusmenuClient * client, gint id, const gchar ** properties, properties_func callback, gpointer user_data); static GQuark error_domain (void); static void item_activated (DBusGProxy * proxy, gint id, guint timestamp, DbusmenuClient * client); static void menuproxy_build_cb (GObject * object, GAsyncResult * res, gpointer user_data); @@ -653,7 +655,7 @@ get_properties_flush (DbusmenuClient * client) /* A function to group all the get_properties commands to make them more efficient over dbus. */ static void -get_properties_globber (DbusmenuClient * client, gint id, const gchar ** properties, org_ayatana_dbusmenu_get_properties_reply callback, gpointer user_data) +get_properties_globber (DbusmenuClient * client, gint id, const gchar ** properties, properties_func callback, gpointer user_data) { DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); if (find_listener(priv->delayed_property_listeners, 0, id) != NULL) { -- cgit v1.2.3 From fb510a52796e9ff1a5bfc52fad72e94c22efc6e1 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 15 Nov 2010 08:47:36 -0600 Subject: Blanket replace of DBusGProxy with GDBusProxy --- libdbusmenu-glib/client.c | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 6f31354..92991b3 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -127,19 +127,19 @@ static void dbusmenu_client_finalize (GObject *object); static void set_property (GObject * obj, guint id, const GValue * value, GParamSpec * pspec); static void get_property (GObject * obj, guint id, GValue * value, GParamSpec * pspec); /* Private Funcs */ -static void layout_update (DBusGProxy * proxy, guint revision, gint parent, DbusmenuClient * client); -static void id_prop_update (DBusGProxy * proxy, gint id, gchar * property, GValue * value, DbusmenuClient * client); -static void id_update (DBusGProxy * proxy, gint id, DbusmenuClient * client); +static void layout_update (GDBusProxy * proxy, guint revision, gint parent, DbusmenuClient * client); +static void id_prop_update (GDBusProxy * proxy, gint id, gchar * property, GValue * value, DbusmenuClient * client); +static void id_update (GDBusProxy * proxy, gint id, DbusmenuClient * client); static void build_proxies (DbusmenuClient * client); static gint parse_node_get_id (xmlNodePtr node); -static DbusmenuMenuitem * parse_layout_xml(DbusmenuClient * client, xmlNodePtr node, DbusmenuMenuitem * item, DbusmenuMenuitem * parent, DBusGProxy * proxy); +static DbusmenuMenuitem * parse_layout_xml(DbusmenuClient * client, xmlNodePtr node, DbusmenuMenuitem * item, DbusmenuMenuitem * parent, GDBusProxy * proxy); static gint parse_layout (DbusmenuClient * client, const gchar * layout); -static void update_layout_cb (DBusGProxy * proxy, guint rev, gchar * xml, GError * in_error, void * data); +static void update_layout_cb (GDBusProxy * proxy, guint rev, gchar * xml, GError * in_error, void * data); static void update_layout (DbusmenuClient * client); -static void menuitem_get_properties_cb (DBusGProxy * proxy, GHashTable * properties, GError * error, gpointer data); +static void menuitem_get_properties_cb (GDBusProxy * proxy, GHashTable * properties, GError * error, gpointer data); static void get_properties_globber (DbusmenuClient * client, gint id, const gchar ** properties, properties_func callback, gpointer user_data); static GQuark error_domain (void); -static void item_activated (DBusGProxy * proxy, gint id, guint timestamp, DbusmenuClient * client); +static void item_activated (GDBusProxy * proxy, gint id, guint timestamp, DbusmenuClient * client); static void menuproxy_build_cb (GObject * object, GAsyncResult * res, gpointer user_data); static void menuproxy_name_changed_cb (GObject * object, GParamSpec * pspec, gpointer user_data); static void menuproxy_signal_cb (GDBusProxy * proxy, gchar * sender, gchar * signal, GVariant * params, gpointer user_data); @@ -494,7 +494,7 @@ find_listener (GArray * listeners, guint index, gint id) /* Call back from getting the group properties, now we need to unwind and call the various functions. */ static void -get_properties_callback (DBusGProxy *proxy, GPtrArray *OUT_properties, GError *error, gpointer userdata) +get_properties_callback (GDBusProxy *proxy, GPtrArray *OUT_properties, GError *error, gpointer userdata) { GArray * listeners = (GArray *)userdata; int i; @@ -701,7 +701,7 @@ get_properties_globber (DbusmenuClient * client, gint id, const gchar ** propert /* Called when a server item wants to activate the menu */ static void -item_activated (DBusGProxy * proxy, gint id, guint timestamp, DbusmenuClient * client) +item_activated (GDBusProxy * proxy, gint id, guint timestamp, DbusmenuClient * client) { g_return_if_fail(DBUSMENU_IS_CLIENT(client)); @@ -725,7 +725,7 @@ item_activated (DBusGProxy * proxy, gint id, guint timestamp, DbusmenuClient * c /* Annoying little wrapper to make the right function update */ static void -layout_update (DBusGProxy * proxy, guint revision, gint parent, DbusmenuClient * client) +layout_update (GDBusProxy * proxy, guint revision, gint parent, DbusmenuClient * client) { DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); priv->current_revision = revision; @@ -738,7 +738,7 @@ layout_update (DBusGProxy * proxy, guint revision, gint parent, DbusmenuClient * /* Signal from the server that a property has changed on one of our menuitems */ static void -id_prop_update (DBusGProxy * proxy, gint id, gchar * property, GValue * value, DbusmenuClient * client) +id_prop_update (GDBusProxy * proxy, gint id, gchar * property, GValue * value, DbusmenuClient * client) { #ifdef MASSIVEDEBUGGING GValue valstr = {0}; @@ -768,7 +768,7 @@ id_prop_update (DBusGProxy * proxy, gint id, gchar * property, GValue * value, D /* Oh, lots of updates now. That silly server, they want to change all kinds of stuff! */ static void -id_update (DBusGProxy * proxy, gint id, DbusmenuClient * client) +id_update (GDBusProxy * proxy, gint id, DbusmenuClient * client) { #ifdef MASSIVEDEBUGGING g_debug("Client side ID update: %d", id); @@ -788,7 +788,7 @@ id_update (DBusGProxy * proxy, gint id, DbusmenuClient * client) /* Watches to see if our DBus savior comes onto the bus */ static void -dbus_owner_change (DBusGProxy * proxy, const gchar * name, const gchar * prev, const gchar * new, DbusmenuClient * client) +dbus_owner_change (GDBusProxy * proxy, const gchar * name, const gchar * prev, const gchar * new, DbusmenuClient * client) { DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); /* g_debug("Owner change: %s %s %s", name, prev, new); */ @@ -815,7 +815,7 @@ dbus_owner_change (DBusGProxy * proxy, const gchar * name, const gchar * prev, c it does, then we should build the proxies here. Race condition check. */ static void -name_owner_check (DBusGProxy *proxy, gboolean has_owner, GError *error, gpointer userdata) +name_owner_check (GDBusProxy *proxy, gboolean has_owner, GError *error, gpointer userdata) { if (error != NULL) { return; @@ -1115,7 +1115,7 @@ get_properties_helper (gpointer key, gpointer value, gpointer data) This isn't the most efficient way. We can optimize this by somehow removing the foreach. But that is for later. */ static void -menuitem_get_properties_cb (DBusGProxy * proxy, GHashTable * properties, GError * error, gpointer data) +menuitem_get_properties_cb (GDBusProxy * proxy, GHashTable * properties, GError * error, gpointer data) { g_return_if_fail(DBUSMENU_IS_MENUITEM(data)); if (error != NULL) { @@ -1133,7 +1133,7 @@ menuitem_get_properties_cb (DBusGProxy * proxy, GHashTable * properties, GError is getting recycled with the update, but we think might have prop changes. */ static void -menuitem_get_properties_replace_cb (DBusGProxy * proxy, GHashTable * properties, GError * error, gpointer data) +menuitem_get_properties_replace_cb (GDBusProxy * proxy, GHashTable * properties, GError * error, gpointer data) { g_return_if_fail(DBUSMENU_IS_MENUITEM(data)); gboolean have_error = FALSE; @@ -1164,7 +1164,7 @@ menuitem_get_properties_replace_cb (DBusGProxy * proxy, GHashTable * properties, /* This is a different get properites call back that also sends new signals. It basically is a small wrapper around the original. */ static void -menuitem_get_properties_new_cb (DBusGProxy * proxy, GHashTable * properties, GError * error, gpointer data) +menuitem_get_properties_new_cb (GDBusProxy * proxy, GHashTable * properties, GError * error, gpointer data) { g_return_if_fail(data != NULL); newItemPropData * propdata = (newItemPropData *)data; @@ -1216,7 +1216,7 @@ menuitem_get_properties_new_cb (DBusGProxy * proxy, GHashTable * properties, GEr /* Respond to the call function to make sure that the other side got it, or print a warning. */ static void -menuitem_call_cb (DBusGProxy * proxy, GError * error, gpointer userdata) +menuitem_call_cb (GDBusProxy * proxy, GError * error, gpointer userdata) { event_data_t * edata = (event_data_t *)userdata; @@ -1285,7 +1285,7 @@ struct _about_to_show_t { /* Reports errors and responds to update request that were a result of sending the about to show signal. */ static void -about_to_show_cb (DBusGProxy * proxy, gboolean need_update, GError * error, gpointer userdata) +about_to_show_cb (GDBusProxy * proxy, gboolean need_update, GError * error, gpointer userdata) { about_to_show_t * data = (about_to_show_t *)userdata; @@ -1369,7 +1369,7 @@ parse_layout_update (DbusmenuMenuitem * item, DbusmenuClient * client) /* Parse recursively through the XML and make it into objects as need be */ static DbusmenuMenuitem * -parse_layout_xml(DbusmenuClient * client, xmlNodePtr node, DbusmenuMenuitem * item, DbusmenuMenuitem * parent, DBusGProxy * proxy) +parse_layout_xml(DbusmenuClient * client, xmlNodePtr node, DbusmenuMenuitem * item, DbusmenuMenuitem * parent, GDBusProxy * proxy) { /* First verify and figure out what we've got */ gint id = parse_node_get_id(node); @@ -1540,7 +1540,7 @@ parse_layout (DbusmenuClient * client, const gchar * layout) /* When the layout property returns, here's where we take care of that. */ static void -update_layout_cb (DBusGProxy * proxy, guint rev, gchar * xml, GError * error, void * data) +update_layout_cb (GDBusProxy * proxy, guint rev, gchar * xml, GError * error, void * data) { DbusmenuClient * client = DBUSMENU_CLIENT(data); DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); -- cgit v1.2.3 From 5a5e31fd65810bd106f01833c5b66545d936e831 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 15 Nov 2010 08:49:20 -0600 Subject: Adding in the dbusmenu interface --- libdbusmenu-glib/client.c | 1 + 1 file changed, 1 insertion(+) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 92991b3..e24a182 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -118,6 +118,7 @@ struct _event_data_t { #define DBUSMENU_CLIENT_GET_PRIVATE(o) (DBUSMENU_CLIENT(o)->priv) +#define DBUSMENU_INTERFACE "org.ayatana.dbusmenu" /* GObject Stuff */ static void dbusmenu_client_class_init (DbusmenuClientClass *klass); -- cgit v1.2.3 From dbb933c7da1d7ec7d3a40b7f0aead90aafe87911 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 15 Nov 2010 08:54:03 -0600 Subject: Changing the prototype for one call to the callback, need a different approach --- libdbusmenu-glib/client.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index e24a182..b80999e 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -60,7 +60,7 @@ enum { LAST_SIGNAL }; -typedef void (*properties_func) (DbusmenuClient * client, GVariant * properties); +typedef void (*properties_func) (DbusmenuClient * client, GVariant * properties, GError * error); static guint signals[LAST_SIGNAL] = { 0 }; @@ -318,6 +318,7 @@ dbusmenu_client_init (DbusmenuClient *self) static void dbusmenu_client_dispose (GObject *object) { + DbusmenuClient * client = DBUSMENU_CLIENT(object); DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(object); if (priv->delayed_idle != 0) { @@ -347,7 +348,7 @@ dbusmenu_client_dispose (GObject *object) if (localerror == NULL) { g_set_error_literal(&localerror, error_domain(), 0, "DbusmenuClient Shutdown"); } - listener->callback(priv->menuproxy, NULL, localerror, listener->user_data); + listener->callback(client, NULL, localerror); } } if (localerror != NULL) { -- cgit v1.2.3 From 80fe2298aff27d9c10b3fbb8bbab120954e7f2be Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 15 Nov 2010 14:24:14 -0600 Subject: Changing the properties callback to use the proper prototype and GVariant --- libdbusmenu-glib/client.c | 57 +++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 29 deletions(-) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index b80999e..50b379c 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -60,7 +60,7 @@ enum { LAST_SIGNAL }; -typedef void (*properties_func) (DbusmenuClient * client, GVariant * properties, GError * error); +typedef void (*properties_func) (GVariant * properties, GError * error, gpointer user_data); static guint signals[LAST_SIGNAL] = { 0 }; @@ -348,7 +348,7 @@ dbusmenu_client_dispose (GObject *object) if (localerror == NULL) { g_set_error_literal(&localerror, error_domain(), 0, "DbusmenuClient Shutdown"); } - listener->callback(client, NULL, localerror); + listener->callback(NULL, localerror, listener->user_data); } } if (localerror != NULL) { @@ -496,47 +496,37 @@ find_listener (GArray * listeners, guint index, gint id) /* Call back from getting the group properties, now we need to unwind and call the various functions. */ static void -get_properties_callback (GDBusProxy *proxy, GPtrArray *OUT_properties, GError *error, gpointer userdata) +get_properties_callback (GObject *obj, GAsyncResult * res, gpointer user_data) { - GArray * listeners = (GArray *)userdata; + GArray * listeners = (GArray *)user_data; int i; + GError * error = NULL; + GVariant * params = NULL; - #ifdef MASSIVEDEBUGGING - g_debug("Get properties callback: %d", OUT_properties->len); - #endif + params = g_dbus_proxy_call_finish(G_DBUS_PROXY(obj), res, &error); if (error != NULL) { /* If we get an error, all our callbacks need to hear about it. */ g_warning("Group Properties error: %s", error->message); for (i = 0; i < listeners->len; i++) { properties_listener_t * listener = &g_array_index(listeners, properties_listener_t, i); - listener->callback(proxy, NULL, error, listener->user_data); + listener->callback(NULL, error, listener->user_data); } g_array_free(listeners, TRUE); return; } /* Callback all the folks we can find */ - for (i = 0; i < OUT_properties->len; i++) { - GValueArray * varray = (GValueArray *)g_ptr_array_index(OUT_properties, i); - - if (varray->n_values != 2) { - g_warning("Value Array is %d entries long but we expected 2.", varray->n_values); + GVariantIter * iter = g_variant_iter_new(params); + GVariant * child; + while ((child = g_variant_iter_next_value(iter)) != NULL) { + if (g_strcmp0(g_variant_get_type_string(child), "ia(sv)") != 0) { + g_warning("Properties return signature is not 'ia(sv)' it is '%s'", g_variant_get_type_string(child)); continue; } - GValue * vid = g_value_array_get_nth(varray, 0); - GValue * vproperties = g_value_array_get_nth(varray, 1); - - if (G_VALUE_TYPE(vid) != G_TYPE_INT) { - g_warning("ID Entry not holding an int: %s", G_VALUE_TYPE_NAME(vid)); - } - if (G_VALUE_TYPE(vproperties) != dbus_g_type_get_map("GHashTable", G_TYPE_STRING, G_TYPE_VALUE)) { - g_warning("Properties Entry not holding an a{sv}: %s", G_VALUE_TYPE_NAME(vproperties)); - } - - gint id = g_value_get_int(vid); - GHashTable * properties = g_value_get_boxed(vproperties); + gint id = g_variant_get_int32(g_variant_get_child_value(child, 0)); + GVariant * properties = g_variant_get_child_value(child, 1); properties_listener_t * listener = find_listener(listeners, 0, id); if (listener == NULL) { @@ -545,12 +535,13 @@ get_properties_callback (GDBusProxy *proxy, GPtrArray *OUT_properties, GError *e } if (!listener->replied) { - listener->callback(proxy, properties, NULL, listener->user_data); + listener->callback(properties, NULL, listener->user_data); listener->replied = TRUE; } else { g_warning("Odd, we've already replied to the listener on ID %d", id); } } + g_variant_iter_free(iter); /* Provide errors for those who we can't */ GError * localerror = NULL; @@ -560,7 +551,7 @@ get_properties_callback (GDBusProxy *proxy, GPtrArray *OUT_properties, GError *e if (localerror == NULL) { g_set_error_literal(&localerror, error_domain(), 0, "Error getting properties for ID"); } - listener->callback(proxy, NULL, localerror, listener->user_data); + listener->callback(NULL, localerror, listener->user_data); } } if (localerror != NULL) { @@ -579,7 +570,7 @@ static gboolean get_properties_idle (gpointer user_data) { DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(user_data); - //org_ayatana_dbusmenu_get_properties_async(priv->menuproxy, id, properties, callback, user_data); + g_return_val_if_fail(priv->menuproxy != NULL, TRUE); if (priv->delayed_property_listeners->len == 0) { g_warning("Odd, idle func got no listeners."); @@ -593,7 +584,15 @@ get_properties_idle (gpointer user_data) g_array_append_val(idlist, g_array_index(priv->delayed_property_listeners, properties_listener_t, i).id); } - org_ayatana_dbusmenu_get_group_properties_async(priv->menuproxy, idlist, (const gchar **)priv->delayed_property_list->data, get_properties_callback, priv->delayed_property_listeners); + GVariant * variant_params = g_variant_new("a(s)", (const gchar **)priv->delayed_property_list->data); + g_dbus_proxy_call(priv->menuproxy, + "GetGroupProperties", + variant_params, + G_DBUS_CALL_FLAGS_NONE, + -1, /* timeout */ + NULL, /* cancellable */ + get_properties_callback, + priv->delayed_property_listeners); /* Free ID List */ g_array_free(idlist, TRUE); -- cgit v1.2.3 From 26311e4db0f50c805374a1cf2265e7a5c81dd083 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 15 Nov 2010 14:37:53 -0600 Subject: Fixing the menuitem_get_properties_cb to use Variants and match the right prototype --- libdbusmenu-glib/client.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 50b379c..23981de 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -137,7 +137,7 @@ static DbusmenuMenuitem * parse_layout_xml(DbusmenuClient * client, xmlNodePtr n static gint parse_layout (DbusmenuClient * client, const gchar * layout); static void update_layout_cb (GDBusProxy * proxy, guint rev, gchar * xml, GError * in_error, void * data); static void update_layout (DbusmenuClient * client); -static void menuitem_get_properties_cb (GDBusProxy * proxy, GHashTable * properties, GError * error, gpointer data); +static void menuitem_get_properties_cb (GVariant * properties, GError * error, gpointer data); static void get_properties_globber (DbusmenuClient * client, gint id, const gchar ** properties, properties_func callback, gpointer user_data); static GQuark error_domain (void); static void item_activated (GDBusProxy * proxy, gint id, guint timestamp, DbusmenuClient * client); @@ -542,6 +542,7 @@ get_properties_callback (GObject *obj, GAsyncResult * res, gpointer user_data) } } g_variant_iter_free(iter); + g_variant_unref(params); /* Provide errors for those who we can't */ GError * localerror = NULL; @@ -1116,17 +1117,32 @@ get_properties_helper (gpointer key, gpointer value, gpointer data) This isn't the most efficient way. We can optimize this by somehow removing the foreach. But that is for later. */ static void -menuitem_get_properties_cb (GDBusProxy * proxy, GHashTable * properties, GError * error, gpointer data) +menuitem_get_properties_cb (GVariant * properties, GError * error, gpointer data) { g_return_if_fail(DBUSMENU_IS_MENUITEM(data)); + DbusmenuMenuitem * item = DBUSMENU_MENUITEM(data); + if (error != NULL) { g_warning("Error getting properties on a menuitem: %s", error->message); g_object_unref(data); return; } - g_hash_table_foreach(properties, get_properties_helper, data); - g_hash_table_destroy(properties); + + GVariantIter * iter = g_variant_iter_new(properties); + gchar * key; + GVariant * value; + + while (g_variant_iter_next(iter, "{sv}", &key, &value)) { + dbusmenu_menuitem_property_set_variant(item, key, value); + + g_variant_unref(value); + g_free(key); + } + + g_variant_iter_free(iter); + g_object_unref(data); + return; } @@ -1154,7 +1170,7 @@ menuitem_get_properties_replace_cb (GDBusProxy * proxy, GHashTable * properties, } if (!have_error) { - menuitem_get_properties_cb(proxy, properties, error, data); + menuitem_get_properties_cb(properties, error, data); } else { g_object_unref(data); } @@ -1181,7 +1197,7 @@ menuitem_get_properties_new_cb (GDBusProxy * proxy, GHashTable * properties, GEr /* Extra ref as get_properties will unref once itself */ g_object_ref(propdata->item); - menuitem_get_properties_cb (proxy, properties, error, propdata->item); + menuitem_get_properties_cb (properties, error, propdata->item); gboolean handled = FALSE; -- cgit v1.2.3 From cbabf67cabb66079fa89d3972fea2aaee9543b5e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 15 Nov 2010 14:46:12 -0600 Subject: Changing the prototypes for the get_properties wrappers --- libdbusmenu-glib/client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 23981de..c206e47 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -1150,7 +1150,7 @@ menuitem_get_properties_cb (GVariant * properties, GError * error, gpointer data is getting recycled with the update, but we think might have prop changes. */ static void -menuitem_get_properties_replace_cb (GDBusProxy * proxy, GHashTable * properties, GError * error, gpointer data) +menuitem_get_properties_replace_cb (GVariant * properties, GError * error, gpointer data) { g_return_if_fail(DBUSMENU_IS_MENUITEM(data)); gboolean have_error = FALSE; @@ -1181,7 +1181,7 @@ menuitem_get_properties_replace_cb (GDBusProxy * proxy, GHashTable * properties, /* This is a different get properites call back that also sends new signals. It basically is a small wrapper around the original. */ static void -menuitem_get_properties_new_cb (GDBusProxy * proxy, GHashTable * properties, GError * error, gpointer data) +menuitem_get_properties_new_cb (GVariant * properties, GError * error, gpointer data) { g_return_if_fail(data != NULL); newItemPropData * propdata = (newItemPropData *)data; -- cgit v1.2.3 From e911ad73aadd6cb2cb58771a750df1e600613c08 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 15 Nov 2010 15:20:38 -0600 Subject: Completely change layoutcall to be a GCancellable --- libdbusmenu-glib/client.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index c206e47..51113f0 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -360,7 +360,8 @@ dbusmenu_client_dispose (GObject *object) } if (priv->layoutcall != NULL) { - dbus_g_proxy_cancel_call(priv->menuproxy, priv->layoutcall); + g_cancellable_cancel(priv->layoutcall); + g_object_unref(priv->layoutcall); priv->layoutcall = NULL; } @@ -890,7 +891,11 @@ proxy_destroyed (GObject * gobj_proxy, gpointer userdata) } if ((gpointer)priv->menuproxy == (gpointer)gobj_proxy) { - priv->layoutcall = NULL; + if (priv->layoutcall != NULL) { + g_cancellable_cancel(priv->layoutcall); + g_object_unref(priv->layoutcall); + priv->layoutcall = NULL; + } } priv->current_revision = 0; @@ -1574,7 +1579,10 @@ update_layout_cb (GDBusProxy * proxy, guint rev, gchar * xml, GError * error, vo priv->my_revision = rev; /* g_debug("Root is now: 0x%X", (unsigned int)priv->root); */ - priv->layoutcall = NULL; + if (priv->layoutcall != NULL) { + g_object_unref(priv->layoutcall); + priv->layoutcall = NULL; + } #ifdef MASSIVEDEBUGGING g_debug("Client signaling layout has changed."); #endif @@ -1604,7 +1612,9 @@ update_layout (DbusmenuClient * client) return; } - priv->layoutcall = org_ayatana_dbusmenu_get_layout_async(priv->menuproxy, + priv->layoutcall = g_cancellable_new(); + + org_ayatana_dbusmenu_get_layout_async(priv->menuproxy, 0, /* Parent is the root */ update_layout_cb, client); -- cgit v1.2.3 From 187694edd077b979c6e19c511b5227791c3cd3f6 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 15 Nov 2010 15:21:48 -0600 Subject: A couple of clean ups from the compiler --- libdbusmenu-glib/client.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 51113f0..2027e7a 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -318,7 +318,6 @@ dbusmenu_client_init (DbusmenuClient *self) static void dbusmenu_client_dispose (GObject *object) { - DbusmenuClient * client = DBUSMENU_CLIENT(object); DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(object); if (priv->delayed_idle != 0) { @@ -665,7 +664,7 @@ get_properties_globber (DbusmenuClient * client, gint id, const gchar ** propert g_warning("Asking for properties from same ID twice: %d", id); GError * localerror = NULL; g_set_error_literal(&localerror, error_domain(), 0, "ID already queued"); - callback(priv->menuproxy, NULL, localerror, user_data); + callback(NULL, localerror, user_data); g_error_free(localerror); return; } -- cgit v1.2.3 From c4882fb11cece780073e56ba186e87b9cc2e90d7 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 15 Nov 2010 15:29:34 -0600 Subject: Switching over our call to AboutToShow --- libdbusmenu-glib/client.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 2027e7a..ab3730d 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -1306,14 +1306,22 @@ struct _about_to_show_t { /* Reports errors and responds to update request that were a result of sending the about to show signal. */ static void -about_to_show_cb (GDBusProxy * proxy, gboolean need_update, GError * error, gpointer userdata) +about_to_show_cb (GObject * proxy, GAsyncResult * res, gpointer userdata) { + gboolean need_update = FALSE; + GError * error = NULL; about_to_show_t * data = (about_to_show_t *)userdata; + GVariant * params = NULL; + + params = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), res, &error); if (error != NULL) { g_warning("Unable to send about_to_show: %s", error->message); /* Note: we're just ensuring only the callback gets called */ need_update = FALSE; + } else { + g_variant_get(params, "b", &need_update); + g_variant_unref(params); } /* If we need to update, do that first. */ @@ -1344,7 +1352,14 @@ dbusmenu_client_send_about_to_show(DbusmenuClient * client, gint id, void (*cb)( data->cb_data = cb_data; g_object_ref(client); - org_ayatana_dbusmenu_about_to_show_async (priv->menuproxy, id, about_to_show_cb, data); + g_dbus_proxy_call(priv->menuproxy, + "AboutToShow", + g_variant_new("i", id), + G_DBUS_CALL_FLAGS_NONE, + -1, /* timeout */ + NULL, /* cancellable */ + about_to_show_cb, + data); return; } -- cgit v1.2.3 From f60be7e8228a685fadc88e4b41ae707b5c67ec94 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 15 Nov 2010 15:39:00 -0600 Subject: Reshuffling update layout to use GDBus and GVariants --- libdbusmenu-glib/client.c | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index ab3730d..7f6da7b 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -135,7 +135,7 @@ static void build_proxies (DbusmenuClient * client); static gint parse_node_get_id (xmlNodePtr node); static DbusmenuMenuitem * parse_layout_xml(DbusmenuClient * client, xmlNodePtr node, DbusmenuMenuitem * item, DbusmenuMenuitem * parent, GDBusProxy * proxy); static gint parse_layout (DbusmenuClient * client, const gchar * layout); -static void update_layout_cb (GDBusProxy * proxy, guint rev, gchar * xml, GError * in_error, void * data); +static void update_layout_cb (GObject * proxy, GAsyncResult * res, gpointer data); static void update_layout (DbusmenuClient * client); static void menuitem_get_properties_cb (GVariant * properties, GError * error, gpointer data); static void get_properties_globber (DbusmenuClient * client, gint id, const gchar ** properties, properties_func callback, gpointer user_data); @@ -1576,17 +1576,31 @@ parse_layout (DbusmenuClient * client, const gchar * layout) /* When the layout property returns, here's where we take care of that. */ static void -update_layout_cb (GDBusProxy * proxy, guint rev, gchar * xml, GError * error, void * data) +update_layout_cb (GObject * proxy, GAsyncResult * res, gpointer data) { - DbusmenuClient * client = DBUSMENU_CLIENT(data); - DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); + GError * error = NULL; + GVariant * params = NULL; + + params = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), res, &error); if (error != NULL) { - g_warning("Getting layout failed on client %s object %s: %s", priv->dbus_name, priv->dbus_object, error->message); + g_warning("Getting layout failed: %s", error->message); return; } - if (!parse_layout(client, xml)) { + guint rev; + gchar * xml; + + g_variant_get(params, "us", &rev, &xml); + g_variant_unref(params); + + DbusmenuClient * client = DBUSMENU_CLIENT(data); + DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); + + guint parseable = parse_layout(client, xml); + g_free(xml); + + if (parseable == 0) { g_warning("Unable to parse layout!"); return; } @@ -1628,10 +1642,14 @@ update_layout (DbusmenuClient * client) priv->layoutcall = g_cancellable_new(); - org_ayatana_dbusmenu_get_layout_async(priv->menuproxy, - 0, /* Parent is the root */ - update_layout_cb, - client); + g_dbus_proxy_call(priv->menuproxy, + "GetLayout", + g_variant_new("i", 0), /* root */ + G_DBUS_CALL_FLAGS_NONE, + -1, /* timeout */ + priv->layoutcall, /* cancellable */ + update_layout_cb, + client); return; } -- cgit v1.2.3 From 4d1386938c19e6819c3d7ae631336bc8f37bfc48 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 15 Nov 2010 15:51:03 -0600 Subject: Changing the 'Event' call to use GDBus and GVariant --- libdbusmenu-glib/client.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 7f6da7b..3a47465 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -1237,9 +1237,13 @@ menuitem_get_properties_new_cb (GVariant * properties, GError * error, gpointer /* Respond to the call function to make sure that the other side got it, or print a warning. */ static void -menuitem_call_cb (GDBusProxy * proxy, GError * error, gpointer userdata) +menuitem_call_cb (GObject * proxy, GAsyncResult * res, gpointer userdata) { + GError * error = NULL; event_data_t * edata = (event_data_t *)userdata; + GVariant * params; + + params = g_dbus_proxy_call_finish(G_DBUS_PROXY(proxy), res, &error); if (error != NULL) { g_warning("Unable to call event '%s' on menu item %d: %s", edata->event, dbusmenu_menuitem_get_id(edata->menuitem), error->message); @@ -1252,6 +1256,11 @@ menuitem_call_cb (GDBusProxy * proxy, GError * error, gpointer userdata) g_object_unref(edata->menuitem); g_free(edata); + if (error != NULL) { + g_error_free(error); + } + g_variant_unref(params); + return; } @@ -1287,11 +1296,14 @@ dbusmenu_client_send_event (DbusmenuClient * client, gint id, const gchar * name g_value_copy(value, &edata->data); edata->timestamp = timestamp; - DBusGAsyncData *stuff; - stuff = g_slice_new (DBusGAsyncData); - stuff->cb = G_CALLBACK (menuitem_call_cb); - stuff->userdata = edata; - dbus_g_proxy_begin_call_with_timeout (priv->menuproxy, "Event", org_ayatana_dbusmenu_event_async_callback, stuff, _dbus_glib_async_data_free, 1000, G_TYPE_INT, id, G_TYPE_STRING, name, G_TYPE_VALUE, value, G_TYPE_UINT, timestamp, G_TYPE_INVALID); + g_dbus_proxy_call(priv->menuproxy, + "Event", + g_variant_new("isvu", id, name, value, timestamp), + G_DBUS_CALL_FLAGS_NONE, + 1000, /* timeout */ + NULL, /* cancellable */ + menuitem_call_cb, + edata); return; } -- cgit v1.2.3 From c5ddb96e4b861edf0d0281942bea99d22296d077 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 15 Nov 2010 16:00:35 -0600 Subject: Changing how the watcher is setup --- libdbusmenu-glib/client.c | 59 +++++++++++++++-------------------------------- 1 file changed, 19 insertions(+), 40 deletions(-) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 3a47465..f9584a9 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -82,7 +82,7 @@ struct _DbusmenuClientPrivate gint current_revision; gint my_revision; - GDBusProxy * dbusproxy; + guint dbusproxy; GHashTable * type_handlers; @@ -303,7 +303,7 @@ dbusmenu_client_init (DbusmenuClient *self) priv->current_revision = 0; priv->my_revision = 0; - priv->dbusproxy = NULL; + priv->dbusproxy = 0; priv->type_handlers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); @@ -376,9 +376,9 @@ dbusmenu_client_dispose (GObject *object) priv->menuproxy = NULL; } - if (priv->dbusproxy != NULL) { - g_object_unref(G_OBJECT(priv->dbusproxy)); - priv->dbusproxy = NULL; + if (priv->dbusproxy != 0) { + g_bus_unwatch_name(priv->dbusproxy); + priv->dbusproxy = 0; } /* Bring down the session bus, ensure we're not @@ -790,23 +790,11 @@ id_update (GDBusProxy * proxy, gint id, DbusmenuClient * client) /* Watches to see if our DBus savior comes onto the bus */ static void -dbus_owner_change (GDBusProxy * proxy, const gchar * name, const gchar * prev, const gchar * new, DbusmenuClient * client) +dbus_owner_change (GDBusConnection * connection, const gchar * name, const gchar * owner, gpointer user_data) { - DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); - /* g_debug("Owner change: %s %s %s", name, prev, new); */ - - if (!(new[0] != '\0' && prev[0] == '\0')) { - /* If it's not someone new getting on the bus, sorry we - simply just don't care. It's not that your service isn't - important to someone, just not us. You'll find the right - process someday, there's lots of processes out there. */ - return; - } + g_return_if_fail(DBUSMENU_IS_CLIENT(user_data)); - if (g_strcmp0(name, priv->dbus_name)) { - /* Again, someone else's service. */ - return; - } + DbusmenuClient * client = DBUSMENU_CLIENT(user_data); /* Woot! A service for us to love and to hold for ever and ever and ever! */ @@ -840,26 +828,17 @@ build_dbus_proxy (DbusmenuClient * client) DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); GError * error = NULL; - if (priv->dbusproxy != NULL) { - return; - } - - priv->dbusproxy = dbus_g_proxy_new_for_name_owner (priv->session_bus, - DBUS_SERVICE_DBUS, - DBUS_PATH_DBUS, - DBUS_INTERFACE_DBUS, - &error); - if (error != NULL) { - g_debug("Oh, that's bad. That's really bad. We can't get a proxy to DBus itself? Seriously? Here's all I know: %s", error->message); - g_error_free(error); + if (priv->dbusproxy != 0) { return; } - dbus_g_proxy_add_signal(priv->dbusproxy, "NameOwnerChanged", - G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, - G_TYPE_INVALID); - dbus_g_proxy_connect_signal(priv->dbusproxy, "NameOwnerChanged", - G_CALLBACK(dbus_owner_change), client, NULL); + priv->dbusproxy = g_bus_watch_name_on_connection(priv->session_bus, + priv->dbus_name, + G_BUS_NAME_WATCHER_FLAGS_NONE, + dbus_owner_change, + NULL, + client, + NULL); /* Now let's check to make sure we're not in some race condition case. */ @@ -1011,9 +990,9 @@ menuproxy_build_cb (GObject * object, GAsyncResult * res, gpointer user_data) } /* If we get here, we don't need the DBus proxy */ - if (priv->dbusproxy != NULL) { - g_object_unref(G_OBJECT(priv->dbusproxy)); - priv->dbusproxy = NULL; + if (priv->dbusproxy != 0) { + g_bus_unwatch(priv->dbusproxy); + priv->dbusproxy = 0; } g_signal_connect(priv->menuproxy, "g-signal", G_CALLBACK(menuproxy_signal_cb), client); -- cgit v1.2.3 From 7fd7547baeb728c162de08b7278ebbbff81832d3 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 15 Nov 2010 16:09:34 -0600 Subject: Dropping the name check, need to figure out another way to do this. --- libdbusmenu-glib/client.c | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index f9584a9..563fbe0 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -801,25 +801,6 @@ dbus_owner_change (GDBusConnection * connection, const gchar * name, const gchar return build_proxies(client); } -/* This is the response to see if the name has an owner. If - it does, then we should build the proxies here. Race condition - check. */ -static void -name_owner_check (GDBusProxy *proxy, gboolean has_owner, GError *error, gpointer userdata) -{ - if (error != NULL) { - return; - } - - if (!has_owner) { - return; - } - - DbusmenuClient * client = DBUSMENU_CLIENT(userdata); - build_proxies(client); - return; -} - /* This function builds the DBus proxy which will look out for the service coming up. */ static void @@ -842,10 +823,7 @@ build_dbus_proxy (DbusmenuClient * client) /* Now let's check to make sure we're not in some race condition case. */ - org_freedesktop_DBus_name_has_owner_async(priv->dbusproxy, - priv->dbus_name, - name_owner_check, - client); + /* TODO: Not sure how to check for names in GDBus */ return; } -- cgit v1.2.3 From fb8c8e53f6bcbac9e589e1ee86a364765ce4ec83 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 15 Nov 2010 16:15:04 -0600 Subject: A set of basically typos caught by the compiler --- libdbusmenu-glib/client.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 563fbe0..8658104 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -807,7 +807,6 @@ static void build_dbus_proxy (DbusmenuClient * client) { DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); - GError * error = NULL; if (priv->dbusproxy != 0) { return; @@ -878,6 +877,7 @@ session_bus_cb (GObject * object, GAsyncResult * res, gpointer user_data) } /* If this wasn't cancelled, we should be good */ + DbusmenuClient * client = DBUSMENU_CLIENT(user_data); DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); priv->session_bus = bus; @@ -898,7 +898,6 @@ static void build_proxies (DbusmenuClient * client) { DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); - GError * error = NULL; g_return_if_fail(priv->dbus_object != NULL); g_return_if_fail(priv->dbus_name != NULL); @@ -912,7 +911,7 @@ build_proxies (DbusmenuClient * client) priv->session_bus_cancel = g_cancellable_new(); /* Async get the session bus */ - g_bus_get(G_BUS_SESSION, priv->session_bus_cancel, session_bus_cb, client); + g_bus_get(G_BUS_TYPE_SESSION, priv->session_bus_cancel, session_bus_cb, client); } /* This function exists, it'll be called again when we get @@ -959,7 +958,8 @@ menuproxy_build_cb (GObject * object, GAsyncResult * res, gpointer user_data) } /* If this wasn't cancelled, we should be good */ - DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(user_data); + DbusmenuClient * client = DBUSMENU_CLIENT(user_data); + DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); priv->menuproxy = proxy; if (priv->menuproxy_cancel != NULL) { @@ -969,7 +969,7 @@ menuproxy_build_cb (GObject * object, GAsyncResult * res, gpointer user_data) /* If we get here, we don't need the DBus proxy */ if (priv->dbusproxy != 0) { - g_bus_unwatch(priv->dbusproxy); + g_bus_unwatch_name(priv->dbusproxy); priv->dbusproxy = 0; } -- cgit v1.2.3 From 1b970b18f1ef93c597ae4d079eba78340eaced20 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 15 Nov 2010 16:16:29 -0600 Subject: Changing property update to use variants --- libdbusmenu-glib/client.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 8658104..18cbfce 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -129,7 +129,7 @@ static void set_property (GObject * obj, guint id, const GValue * value, GParamS static void get_property (GObject * obj, guint id, GValue * value, GParamSpec * pspec); /* Private Funcs */ static void layout_update (GDBusProxy * proxy, guint revision, gint parent, DbusmenuClient * client); -static void id_prop_update (GDBusProxy * proxy, gint id, gchar * property, GValue * value, DbusmenuClient * client); +static void id_prop_update (GDBusProxy * proxy, gint id, gchar * property, GVariant * value, DbusmenuClient * client); static void id_update (GDBusProxy * proxy, gint id, DbusmenuClient * client); static void build_proxies (DbusmenuClient * client); static gint parse_node_get_id (xmlNodePtr node); @@ -740,16 +740,8 @@ layout_update (GDBusProxy * proxy, guint revision, gint parent, DbusmenuClient * /* Signal from the server that a property has changed on one of our menuitems */ static void -id_prop_update (GDBusProxy * proxy, gint id, gchar * property, GValue * value, DbusmenuClient * client) +id_prop_update (GDBusProxy * proxy, gint id, gchar * property, GVariant * value, DbusmenuClient * client) { - #ifdef MASSIVEDEBUGGING - GValue valstr = {0}; - g_value_init(&valstr, G_TYPE_STRING); - g_value_transform(value, &valstr); - g_debug("Property change sent to client for item %d property %s value %s", id, property, g_utf8_strlen(g_value_get_string(&valstr), 50) < 25 ? g_value_get_string(&valstr) : ""); - g_value_unset(&valstr); - #endif - DbusmenuClientPrivate * priv = DBUSMENU_CLIENT_GET_PRIVATE(client); g_return_if_fail(priv->root != NULL); @@ -762,7 +754,7 @@ id_prop_update (GDBusProxy * proxy, gint id, gchar * property, GValue * value, D return; } - dbusmenu_menuitem_property_set_value(menuitem, property, value); + dbusmenu_menuitem_property_set_variant(menuitem, property, value); return; } -- cgit v1.2.3 From ab90d78d2079ac5dbdd8c6ae259e893559307246 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 15 Nov 2010 16:20:35 -0600 Subject: Removing the lookup in the properties to see if an item should be replaced, since we're calling all of them, I don't think we want any leftovers. --- libdbusmenu-glib/client.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 18cbfce..f25ed7d 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -1116,11 +1116,11 @@ menuitem_get_properties_replace_cb (GVariant * properties, GError * error, gpoin GList * current_props = NULL; for (current_props = dbusmenu_menuitem_properties_list(DBUSMENU_MENUITEM(data)); - current_props != NULL ; current_props = g_list_next(current_props)) { - if (have_error || g_hash_table_lookup(properties, current_props->data) == NULL) { - dbusmenu_menuitem_property_remove(DBUSMENU_MENUITEM(data), (const gchar *)current_props->data); - } + current_props != NULL && have_error == FALSE; + current_props = g_list_next(current_props)) { + dbusmenu_menuitem_property_remove(DBUSMENU_MENUITEM(data), (const gchar *)current_props->data); } + g_list_free(current_props); if (!have_error) { menuitem_get_properties_cb(properties, error, data); -- cgit v1.2.3 From 80ab7485e816b687caeee4d6f0395ba010b99d2e Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 15 Nov 2010 16:21:07 -0600 Subject: Oops, unused helper --- libdbusmenu-glib/client.c | 9 --------- 1 file changed, 9 deletions(-) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index f25ed7d..ff7d5ec 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -1055,15 +1055,6 @@ parse_node_get_id (xmlNodePtr node) return -1; } -/* A small helper that calls _property_set on each hash table - entry in the properties hash. */ -static void -get_properties_helper (gpointer key, gpointer value, gpointer data) -{ - dbusmenu_menuitem_property_set_value((DbusmenuMenuitem *)data, (gchar *)key, (GValue *)value); - return; -} - /* This is the callback for the properties on a menu item. There should be all of them in the Hash, and they we use foreach to copy them into the menuitem. -- cgit v1.2.3 From 080cf37f48dba3dc521167bd3ddc51f45681ea1d Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 15 Nov 2010 16:55:43 -0600 Subject: Cleaning out namespaces from the XML so that GDBus will read it. --- libdbusmenu-glib/client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index ff7d5ec..7c90fa6 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -41,7 +41,7 @@ License version 3 and version 2.1 along with this program. If not, see #include "client-menuitem.h" #include "server-marshal.h" #include "client-marshal.h" -#include "dbus-menu.xml.h" +#include "dbus-menu-clean.xml.h" /* Properties */ enum { @@ -262,7 +262,7 @@ dbusmenu_client_class_init (DbusmenuClientClass *klass) if (dbusmenu_node_info == NULL) { GError * error = NULL; - dbusmenu_node_info = g_dbus_node_info_new_for_xml(dbus_menu_xml, &error); + dbusmenu_node_info = g_dbus_node_info_new_for_xml(dbus_menu_clean_xml, &error); if (error != NULL) { g_error("Unable to parse DBusmenu Interface description: %s", error->message); g_error_free(error); -- cgit v1.2.3 From 01603a653335b7f4f09120fc5e04f3273c36a8b5 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 17 Nov 2010 20:50:45 -0600 Subject: Change all the event handling to use GVariants --- libdbusmenu-glib/client.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 7c90fa6..6f16eb2 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -112,7 +112,7 @@ struct _event_data_t { DbusmenuClient * client; DbusmenuMenuitem * menuitem; gchar * event; - GValue data; + GVariant * variant; guint timestamp; }; @@ -1189,9 +1189,9 @@ menuitem_call_cb (GObject * proxy, GAsyncResult * res, gpointer userdata) g_warning("Unable to call event '%s' on menu item %d: %s", edata->event, dbusmenu_menuitem_get_id(edata->menuitem), error->message); } - g_signal_emit(edata->client, signals[EVENT_RESULT], 0, edata->menuitem, edata->event, &edata->data, edata->timestamp, error, TRUE); + g_signal_emit(edata->client, signals[EVENT_RESULT], 0, edata->menuitem, edata->event, edata->variant, edata->timestamp, error, TRUE); - g_value_unset(&edata->data); + g_variant_unref(edata->variant); g_free(edata->event); g_object_unref(edata->menuitem); g_free(edata); @@ -1207,7 +1207,7 @@ menuitem_call_cb (GObject * proxy, GAsyncResult * res, gpointer userdata) /* Sends the event over DBus to the server on the other side of the bus. */ void -dbusmenu_client_send_event (DbusmenuClient * client, gint id, const gchar * name, const GValue * value, guint timestamp) +dbusmenu_client_send_event (DbusmenuClient * client, gint id, const gchar * name, GVariant * variant, guint timestamp) { g_return_if_fail(DBUSMENU_IS_CLIENT(client)); g_return_if_fail(id >= 0); @@ -1220,11 +1220,8 @@ dbusmenu_client_send_event (DbusmenuClient * client, gint id, const gchar * name return; } - if (value == NULL) { - GValue internalval = {0}; - g_value_init(&internalval, G_TYPE_INT); - g_value_set_int(&internalval, 0); - value = &internalval; + if (variant == NULL) { + variant = g_variant_new("i", 0); } event_data_t * edata = g_new0(event_data_t, 1); @@ -1232,13 +1229,13 @@ dbusmenu_client_send_event (DbusmenuClient * client, gint id, const gchar * name edata->menuitem = mi; g_object_ref(edata->menuitem); edata->event = g_strdup(name); - g_value_init(&edata->data, G_VALUE_TYPE(value)); - g_value_copy(value, &edata->data); edata->timestamp = timestamp; + edata->variant = variant; + g_variant_ref(variant); g_dbus_proxy_call(priv->menuproxy, "Event", - g_variant_new("isvu", id, name, value, timestamp), + g_variant_new("isvu", id, name, variant, timestamp), G_DBUS_CALL_FLAGS_NONE, 1000, /* timeout */ NULL, /* cancellable */ -- cgit v1.2.3 From 0dea1bb0779b8cddbf631ee80f76d13aa8920ec5 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 17 Nov 2010 21:11:40 -0600 Subject: Fixing our signals and marshallers for them as well --- libdbusmenu-glib/client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 6f16eb2..629a1be 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -245,8 +245,8 @@ dbusmenu_client_class_init (DbusmenuClientClass *klass) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (DbusmenuClientClass, event_result), NULL, NULL, - _dbusmenu_client_marshal_VOID__OBJECT_STRING_POINTER_UINT_POINTER, - G_TYPE_NONE, 5, G_TYPE_OBJECT, G_TYPE_STRING, G_TYPE_POINTER, G_TYPE_UINT, G_TYPE_POINTER); + _dbusmenu_client_marshal_VOID__OBJECT_STRING_VARIANT_UINT_POINTER, + G_TYPE_NONE, 5, G_TYPE_OBJECT, G_TYPE_STRING, G_TYPE_VARIANT, G_TYPE_UINT, G_TYPE_POINTER); g_object_class_install_property (object_class, PROP_DBUSOBJECT, g_param_spec_string(DBUSMENU_CLIENT_PROP_DBUS_OBJECT, "DBus Object we represent", -- cgit v1.2.3 From 72da1b32a6a834de66496fbaa6f3c57cac4d4d7a Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 18 Nov 2010 09:13:19 -0600 Subject: Fixing our use of GVariant type strings --- libdbusmenu-glib/client.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 629a1be..e0ab2d4 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -1221,7 +1221,7 @@ dbusmenu_client_send_event (DbusmenuClient * client, gint id, const gchar * name } if (variant == NULL) { - variant = g_variant_new("i", 0); + variant = g_variant_new("(i)", 0); } event_data_t * edata = g_new0(event_data_t, 1); @@ -1235,7 +1235,7 @@ dbusmenu_client_send_event (DbusmenuClient * client, gint id, const gchar * name g_dbus_proxy_call(priv->menuproxy, "Event", - g_variant_new("isvu", id, name, variant, timestamp), + g_variant_new("(isvu)", id, name, variant, timestamp), G_DBUS_CALL_FLAGS_NONE, 1000, /* timeout */ NULL, /* cancellable */ @@ -1303,7 +1303,7 @@ dbusmenu_client_send_about_to_show(DbusmenuClient * client, gint id, void (*cb)( g_dbus_proxy_call(priv->menuproxy, "AboutToShow", - g_variant_new("i", id), + g_variant_new("(i)", id), G_DBUS_CALL_FLAGS_NONE, -1, /* timeout */ NULL, /* cancellable */ @@ -1540,7 +1540,7 @@ update_layout_cb (GObject * proxy, GAsyncResult * res, gpointer data) guint rev; gchar * xml; - g_variant_get(params, "us", &rev, &xml); + g_variant_get(params, "(us)", &rev, &xml); g_variant_unref(params); DbusmenuClient * client = DBUSMENU_CLIENT(data); @@ -1593,7 +1593,7 @@ update_layout (DbusmenuClient * client) g_dbus_proxy_call(priv->menuproxy, "GetLayout", - g_variant_new("i", 0), /* root */ + g_variant_new("(i)", 0), /* root */ G_DBUS_CALL_FLAGS_NONE, -1, /* timeout */ priv->layoutcall, /* cancellable */ -- cgit v1.2.3 From 62a03e300af33f8ad306c08337f33f59fb8511b3 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 18 Nov 2010 11:54:41 -0600 Subject: Cleaning up the building of the property requests --- libdbusmenu-glib/client.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index e0ab2d4..1e6e479 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -579,13 +579,26 @@ get_properties_idle (gpointer user_data) } /* Build up an ID list to pass */ - GArray * idlist = g_array_new(FALSE, FALSE, sizeof(gint)); + GVariantBuilder builder; + g_variant_builder_init(&builder, G_VARIANT_TYPE_ARRAY); + gint i; for (i = 0; i < priv->delayed_property_listeners->len; i++) { - g_array_append_val(idlist, g_array_index(priv->delayed_property_listeners, properties_listener_t, i).id); + g_variant_builder_add(&builder, "i", g_array_index(priv->delayed_property_listeners, properties_listener_t, i).id); } - GVariant * variant_params = g_variant_new("a(s)", (const gchar **)priv->delayed_property_list->data); + GVariant * variant_ids = g_variant_builder_end(&builder); + + /* Build up a prop list to pass */ + g_variant_builder_init(&builder, g_variant_type_new("as")); + GVariant * variant_props = g_variant_builder_end(&builder); + + /* Combine them into a value for the parameter */ + g_variant_builder_init(&builder, G_VARIANT_TYPE_TUPLE); + g_variant_builder_add_value(&builder, variant_ids); + g_variant_builder_add_value(&builder, variant_props); + GVariant * variant_params = g_variant_builder_end(&builder); + g_dbus_proxy_call(priv->menuproxy, "GetGroupProperties", variant_params, @@ -595,9 +608,6 @@ get_properties_idle (gpointer user_data) get_properties_callback, priv->delayed_property_listeners); - /* Free ID List */ - g_array_free(idlist, TRUE); - /* Free properties */ gchar ** dataregion = (gchar **)g_array_free(priv->delayed_property_list, FALSE); if (dataregion != NULL) { -- cgit v1.2.3 From b5e90b0ce320570a1338e84538874a02c5dd5753 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 18 Nov 2010 13:49:50 -0600 Subject: Break out of the tuple --- libdbusmenu-glib/client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 1e6e479..696f7c5 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -517,7 +517,7 @@ get_properties_callback (GObject *obj, GAsyncResult * res, gpointer user_data) } /* Callback all the folks we can find */ - GVariantIter * iter = g_variant_iter_new(params); + GVariantIter * iter = g_variant_iter_new(g_variant_get_child_value(params, 0)); GVariant * child; while ((child = g_variant_iter_next_value(iter)) != NULL) { if (g_strcmp0(g_variant_get_type_string(child), "ia(sv)") != 0) { -- cgit v1.2.3 From c35642d47693feb5dce6fc6b5e3e5f258b255982 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 18 Nov 2010 13:52:24 -0600 Subject: Correcting type check --- libdbusmenu-glib/client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 696f7c5..50df570 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -520,8 +520,8 @@ get_properties_callback (GObject *obj, GAsyncResult * res, gpointer user_data) GVariantIter * iter = g_variant_iter_new(g_variant_get_child_value(params, 0)); GVariant * child; while ((child = g_variant_iter_next_value(iter)) != NULL) { - if (g_strcmp0(g_variant_get_type_string(child), "ia(sv)") != 0) { - g_warning("Properties return signature is not 'ia(sv)' it is '%s'", g_variant_get_type_string(child)); + if (g_strcmp0(g_variant_get_type_string(child), "(ia{sv})") != 0) { + g_warning("Properties return signature is not '(ia{sv})' it is '%s'", g_variant_get_type_string(child)); continue; } -- cgit v1.2.3 From fc235b7eb4e7102b349fb711991e5c121a1c7a7d Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 18 Nov 2010 14:40:58 -0600 Subject: Switching to not put into a tuple --- libdbusmenu-glib/client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 50df570..0479548 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -1231,7 +1231,7 @@ dbusmenu_client_send_event (DbusmenuClient * client, gint id, const gchar * name } if (variant == NULL) { - variant = g_variant_new("(i)", 0); + variant = g_variant_new_int32(0); } event_data_t * edata = g_new0(event_data_t, 1); -- cgit v1.2.3 From c40c70c6cee475ab2bf8d7e6e5804571b25deb9c Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 18 Nov 2010 14:41:27 -0600 Subject: Protect against NULL params (which they should be) but not leak just in case --- libdbusmenu-glib/client.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 0479548..cb3377a 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -1206,10 +1206,12 @@ menuitem_call_cb (GObject * proxy, GAsyncResult * res, gpointer userdata) g_object_unref(edata->menuitem); g_free(edata); - if (error != NULL) { + if (G_UNLIKELY(error != NULL)) { g_error_free(error); } - g_variant_unref(params); + if (G_LIKELY(params != NULL)) { + g_variant_unref(params); + } return; } -- cgit v1.2.3 From caea84d6056d1ab1dd9744af5be9ac05670be8f9 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Thu, 18 Nov 2010 15:06:29 -0600 Subject: We can't really be autostarting as we don't know enough to make a judgement there. --- libdbusmenu-glib/client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index cb3377a..f283a78 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -929,7 +929,7 @@ build_proxies (DbusmenuClient * client) priv->menuproxy_cancel = g_cancellable_new(); g_dbus_proxy_new(priv->session_bus, - G_DBUS_PROXY_FLAGS_NONE, + G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START, dbusmenu_interface_info, priv->dbus_name, priv->dbus_object, -- cgit v1.2.3 From 92d355c18217c43c358ccda9d6eb74af9eed30d9 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 23 Nov 2010 13:21:52 -0600 Subject: Protect update_layout from not having an owner yet, and if we get one immediately call update_layout() --- libdbusmenu-glib/client.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index f283a78..be35dde 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -978,7 +978,11 @@ menuproxy_build_cb (GObject * object, GAsyncResult * res, gpointer user_data) g_signal_connect(priv->menuproxy, "g-signal", G_CALLBACK(menuproxy_signal_cb), client); g_signal_connect(priv->menuproxy, "notify::g-name-owner", G_CALLBACK(menuproxy_name_changed_cb), client); - update_layout(client); + gchar * name_owner = g_dbus_proxy_get_name_owner(priv->menuproxy); + if (name_owner != NULL) { + update_layout(client); + g_free(name_owner); + } return; } @@ -996,6 +1000,7 @@ menuproxy_name_changed_cb (GObject * object, GParamSpec * pspec, gpointer user_d proxy_destroyed(G_OBJECT(proxy), user_data); } else { g_free(owner); + update_layout(DBUSMENU_CLIENT(user_data)); } return; @@ -1597,6 +1602,12 @@ update_layout (DbusmenuClient * client) return; } + gchar * name_owner = g_dbus_proxy_get_name_owner(priv->menuproxy); + if (name_owner == NULL) { + return; + } + g_free(name_owner); + if (priv->layoutcall != NULL) { return; } -- cgit v1.2.3 From c661b1ec2a71c8e78e72db7f72116a205059e292 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 23 Nov 2010 13:22:40 -0600 Subject: Adding another todo about the properties... need to do that everywhere --- libdbusmenu-glib/client.c | 1 + 1 file changed, 1 insertion(+) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index be35dde..a918f43 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -591,6 +591,7 @@ get_properties_idle (gpointer user_data) /* Build up a prop list to pass */ g_variant_builder_init(&builder, g_variant_type_new("as")); + /* TODO: need to use delayed property list here */ GVariant * variant_props = g_variant_builder_end(&builder); /* Combine them into a value for the parameter */ -- cgit v1.2.3 From 7a12cdc4cff4546e911bd49fd38b6fed9511d506 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 29 Nov 2010 15:19:31 -0600 Subject: Fixing the return values from AboutToShow --- libdbusmenu-glib/client.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index a918f43..7a6d87c 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -1287,7 +1287,7 @@ about_to_show_cb (GObject * proxy, GAsyncResult * res, gpointer userdata) /* Note: we're just ensuring only the callback gets called */ need_update = FALSE; } else { - g_variant_get(params, "b", &need_update); + g_variant_get(params, "(b)", &need_update); g_variant_unref(params); } -- cgit v1.2.3 From b953ca847127fcc9698b83dbfcb8f760b7b62b30 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 1 Dec 2010 14:40:30 -0600 Subject: Removing the flush. It seems to be broken in GDBus and I can't fix it. --- libdbusmenu-glib/client.c | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) (limited to 'libdbusmenu-glib/client.c') diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 7a6d87c..454e8bb 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -549,6 +549,7 @@ get_properties_callback (GObject *obj, GAsyncResult * res, gpointer user_data) for (i = 0; i < listeners->len; i++) { properties_listener_t * listener = &g_array_index(listeners, properties_listener_t, i); if (!listener->replied) { + g_warning("Generating properties error for: %d", listener->id); if (localerror == NULL) { g_set_error_literal(&localerror, error_domain(), 0, "Error getting properties for ID"); } @@ -625,21 +626,6 @@ get_properties_idle (gpointer user_data) return FALSE; } -/* Report and error if we're unable to flush the connection, likely - to be a cause of some other issues. */ -static void -connection_flush_cb (GObject * object, GAsyncResult * result, gpointer user_data) -{ - GError * error = NULL; - - if (!g_dbus_connection_flush_finish(G_DBUS_CONNECTION(object), result, &error)) { - g_warning("Unable to flush DBus connection: %s", error->message); - g_error_free(error); - } - - return; -} - /* Forces a call out to start getting properties with the menu items that we have queued up already. */ static void @@ -656,12 +642,6 @@ get_properties_flush (DbusmenuClient * client) get_properties_idle(client); - /* I'm not sure this flush is necissary with GDBus running the - DBus connection in another thread. But, I don't think that - it'll hurt anything either, so I'm leaving it in. */ - g_return_if_fail(priv->session_bus != NULL); - g_dbus_connection_flush(priv->session_bus, NULL, connection_flush_cb, NULL); - return; } -- cgit v1.2.3