Ted Gould has proposed merging lp:~ted/appmenu-gtk/ask-dbus into lp:appmenu-gtk.
Requested reviews:
Canonical Desktop Experience Team (canonical-dx-team)
Changes the order of operation slightly so that we're only asking Dbus for the
name once in an async way. This seems to help in cases where the registrar is
not there, we can find that out quickly.
--
https://code.launchpad.net/~ted/appmenu-gtk/ask-dbus/+merge/32814
Your team ayatana-commits is subscribed to branch lp:appmenu-gtk.
=== modified file 'src/bridge.c'
--- src/bridge.c 2010-08-12 16:45:15 +0000
+++ src/bridge.c 2010-08-16 20:31:01 +0000
@@ -62,6 +62,8 @@
GtkWidget *toplevel);
static void rebuild (AppMenuBridge *bridge,
GtkWidget *toplevel);
+static void app_menu_bridge_proxy_vanished (AppMenuBridge *bridge);
+static void app_menu_bridge_proxy_appeared (AppMenuBridge *bridge);
typedef struct _AppWindowContext AppWindowContext;
@@ -117,6 +119,25 @@
bridge->priv->online = TRUE;
}
+/* Async callback from asking DBus if the registrar
+ exists on the bus */
+static void
+has_owner_cb (DBusGProxy *proxy, gboolean has_owner, GError *error, gpointer userdata)
+{
+ if (error != NULL) {
+ g_warning("Unable to check for Registrar owner: %s", error->message);
+ return;
+ }
+
+ if (has_owner) {
+ app_menu_bridge_proxy_appeared (APP_MENU_BRIDGE(userdata));
+ } else {
+ app_menu_bridge_proxy_vanished (APP_MENU_BRIDGE(userdata));
+ }
+
+ return;
+}
+
static void
app_menu_bridge_init (AppMenuBridge *bridge)
{
@@ -124,13 +145,16 @@
bridge->priv->windows = NULL;
+ bridge->priv->appmenuproxy = NULL;
+
+ bridge->priv->online = FALSE;
+
bridge->priv->session_bus = dbus_g_bus_get(DBUS_BUS_SESSION, NULL);
- bridge->priv->dbusproxy = dbus_g_proxy_new_for_name_owner (bridge->priv->session_bus,
- DBUS_SERVICE_DBUS,
- DBUS_PATH_DBUS,
- DBUS_INTERFACE_DBUS,
- NULL);
+ bridge->priv->dbusproxy = dbus_g_proxy_new_for_name (bridge->priv->session_bus,
+ DBUS_SERVICE_DBUS,
+ DBUS_PATH_DBUS,
+ DBUS_INTERFACE_DBUS);
if (bridge->priv->dbusproxy)
{
@@ -146,9 +170,14 @@
G_CALLBACK (dbus_owner_change),
bridge,
NULL);
+
+ org_freedesktop_DBus_name_has_owner_async (bridge->priv->dbusproxy,
+ APP_MENU_DBUS_NAME,
+ has_owner_cb,
+ bridge);
}
- app_menu_bridge_setup_proxy (bridge);
+ return;
}
static void
_______________________________________________
Mailing list: https://launchpad.net/~ayatana-commits
Post to : [email protected]
Unsubscribe : https://launchpad.net/~ayatana-commits
More help : https://help.launchpad.net/ListHelp