diff options
author | Ted Gould <ted@gould.cx> | 2012-01-30 23:20:48 -0600 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2012-01-30 23:20:48 -0600 |
commit | 9332359a3cad3a5f23e7ff0c4bae14159818d026 (patch) | |
tree | 372281b1a4a4c9abe902f2726277df5ddda18027 /libdbusmenu-glib/server.c | |
parent | f966667e6e1af74f06c65d8cfca78d0b861d5621 (diff) | |
parent | 8d7a4ec5cbf30119b0ec553174853556a480228a (diff) | |
download | libdbusmenu-9332359a3cad3a5f23e7ff0c4bae14159818d026.tar.gz libdbusmenu-9332359a3cad3a5f23e7ff0c4bae14159818d026.tar.bz2 libdbusmenu-9332359a3cad3a5f23e7ff0c4bae14159818d026.zip |
Import upstream version 0.5.90
Diffstat (limited to 'libdbusmenu-glib/server.c')
-rw-r--r-- | libdbusmenu-glib/server.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/libdbusmenu-glib/server.c b/libdbusmenu-glib/server.c index 9c085f7..4890d37 100644 --- a/libdbusmenu-glib/server.c +++ b/libdbusmenu-glib/server.c @@ -54,6 +54,7 @@ struct _DbusmenuServerPrivate guint layout_idle; GDBusConnection * bus; + guint find_server_signal; GCancellable * bus_lookup; guint dbus_registration; @@ -191,6 +192,14 @@ static void bus_event (DbusmenuServer * server, static void bus_about_to_show (DbusmenuServer * server, GVariant * params, GDBusMethodInvocation * invocation); +static void find_servers_cb (GDBusConnection * connection, + const gchar * sender, + const gchar * path, + const gchar * interface, + const gchar * signal, + GVariant * params, + gpointer user_data); +static gboolean layout_update_idle (gpointer user_data); /* Globals */ static GDBusNodeInfo * dbusmenu_node_info = NULL; @@ -366,6 +375,7 @@ dbusmenu_server_init (DbusmenuServer *self) priv->layout_idle = 0; priv->bus = NULL; priv->bus_lookup = NULL; + priv->find_server_signal = 0; priv->dbus_registration = 0; default_text_direction(self); @@ -405,6 +415,11 @@ dbusmenu_server_dispose (GObject *object) priv->dbus_registration = 0; } + if (priv->find_server_signal != 0) { + g_dbus_connection_signal_unsubscribe(priv->bus, priv->find_server_signal); + priv->find_server_signal = 0; + } + if (priv->bus != NULL) { g_object_unref(priv->bus); priv->bus = NULL; @@ -706,12 +721,32 @@ bus_got_cb (GObject * obj, GAsyncResult * result, gpointer user_data) DbusmenuServerPrivate * priv = DBUSMENU_SERVER_GET_PRIVATE(user_data); priv->bus = bus; + priv->find_server_signal = g_dbus_connection_signal_subscribe(priv->bus, + NULL, /* sender */ + "com.canonical.dbusmenu", /* interface */ + "FindServers", /* member */ + NULL, /* object path */ + NULL, /* arg0 */ + G_DBUS_SIGNAL_FLAGS_NONE, /* flags */ + find_servers_cb, /* cb */ + user_data, /* data */ + NULL); /* free func */ + register_object(DBUSMENU_SERVER(user_data)); g_object_unref(G_OBJECT(user_data)); return; } +/* Respond to the find servers signal by sending an update + to the bus */ +static void +find_servers_cb (GDBusConnection * connection, const gchar * sender, const gchar * path, const gchar * interface, const gchar * signal, GVariant * params, gpointer user_data) +{ + layout_update_idle(user_data); + return; +} + /* Function for the GDBus vtable to handle all method calls and dish them out the appropriate functions */ static void |