diff options
author | Ted Gould <ted@gould.cx> | 2010-06-10 21:22:01 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-06-10 21:22:01 -0500 |
commit | 0b76a4bfbb7ba2f589ed535c7f66095a42b299ed (patch) | |
tree | c26458e1253fe4aa7cbf460657ec647c4ea444be /libdbusmenu-glib | |
parent | 72092852cfed8a150fd463cc750ac678de1feea0 (diff) | |
parent | 4fbdf12b5671ebcc68ce2d41018cd2a567298be8 (diff) | |
download | libdbusmenu-0b76a4bfbb7ba2f589ed535c7f66095a42b299ed.tar.gz libdbusmenu-0b76a4bfbb7ba2f589ed535c7f66095a42b299ed.tar.bz2 libdbusmenu-0b76a4bfbb7ba2f589ed535c7f66095a42b299ed.zip |
Do an extra check for the name to fix some Hudson tests.
Diffstat (limited to 'libdbusmenu-glib')
-rw-r--r-- | libdbusmenu-glib/client.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index c0d3b7a..fa233a4 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -30,6 +30,8 @@ License version 3 and version 2.1 along with this program. If not, see #include "config.h" #endif +#include <dbus/dbus-glib-bindings.h> + #include <libxml/parser.h> #include <libxml/tree.h> @@ -397,6 +399,25 @@ dbus_owner_change (DBusGProxy * proxy, const gchar * name, const gchar * prev, c 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 (DBusGProxy *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 @@ -426,6 +447,13 @@ build_dbus_proxy (DbusmenuClient * client) dbus_g_proxy_connect_signal(priv->dbusproxy, "NameOwnerChanged", G_CALLBACK(dbus_owner_change), client, NULL); + /* 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); + return; } |