diff options
-rw-r--r-- | libindicate/Makefile.am | 4 | ||||
-rw-r--r-- | libindicate/listener-marshal.list | 2 | ||||
-rw-r--r-- | libindicate/listener.c | 33 | ||||
-rw-r--r-- | libindicate/listener.h | 4 |
4 files changed, 27 insertions, 16 deletions
diff --git a/libindicate/Makefile.am b/libindicate/Makefile.am index 3ceba08..5b43425 100644 --- a/libindicate/Makefile.am +++ b/libindicate/Makefile.am @@ -61,12 +61,12 @@ dbus-indicate-client.h: indicate-interface.xml --output=dbus-indicate-client.h \ $(srcdir)/indicate-interface.xml -listener-marshal.h: listener-marshal.list +listener-marshal.h: $(srcdir)/listener-marshal.list glib-genmarshal --header \ --prefix=indicate_listener_marshal $(srcdir)/listener-marshal.list \ > listener-marshal.h -listener-marshal.c: listener-marshal.list +listener-marshal.c: $(srcdir)/listener-marshal.list glib-genmarshal --body \ --prefix=indicate_listener_marshal $(srcdir)/listener-marshal.list \ > listener-marshal.c diff --git a/libindicate/listener-marshal.list b/libindicate/listener-marshal.list index 562d06f..b03d048 100644 --- a/libindicate/listener-marshal.list +++ b/libindicate/listener-marshal.list @@ -4,3 +4,5 @@ VOID:UINT,STRING VOID:POINTER,POINTER,STRING # Local indicator_modified VOID:POINTER,POINTER,STRING,STRING +# Local server_added and server_removed +VOID:POINTER,STRING diff --git a/libindicate/listener.c b/libindicate/listener.c index c659147..692c7eb 100644 --- a/libindicate/listener.c +++ b/libindicate/listener.c @@ -61,6 +61,7 @@ static void proxy_struct_destroy (gpointer data); static void build_todo_list_cb (DBusGProxy * proxy, char ** names, GError * error, void * data); static void todo_list_add (const gchar * name, DBusGProxy * proxy, IndicateListener * listener); static gboolean todo_idle (gpointer data); +static void proxy_server_added (DBusGProxy * proxy, const gchar * type, proxy_t * proxyt); static void proxy_indicator_added (DBusGProxy * proxy, guint id, const gchar * type, proxy_t * proxyt); static void proxy_indicator_removed (DBusGProxy * proxy, guint id, const gchar * type, proxy_t * proxyt); static void proxy_indicator_modified (DBusGProxy * proxy, guint id, const gchar * type, proxy_t * proxyt); @@ -106,15 +107,15 @@ indicate_listener_class_init (IndicateListenerClass * class) G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (IndicateListenerClass, server_added), NULL, NULL, - g_cclosure_marshal_VOID__POINTER, - G_TYPE_NONE, 1, G_TYPE_POINTER); + indicate_listener_marshal_VOID__POINTER_STRING, + G_TYPE_NONE, 1, G_TYPE_POINTER, G_TYPE_STRING); signals[SERVER_REMOVED] = g_signal_new(INDICATE_LISTENER_SIGNAL_SERVER_REMOVED, G_TYPE_FROM_CLASS (class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (IndicateListenerClass, server_removed), NULL, NULL, - g_cclosure_marshal_VOID__POINTER, - G_TYPE_NONE, 1, G_TYPE_POINTER); + indicate_listener_marshal_VOID__POINTER_STRING, + G_TYPE_NONE, 1, G_TYPE_POINTER, G_TYPE_STRING); dbus_g_object_register_marshaller(indicate_listener_marshal_VOID__UINT_STRING, G_TYPE_NONE, @@ -383,10 +384,10 @@ todo_idle (gpointer data) return TRUE; } - dbus_g_proxy_add_signal(proxyt->proxy, "IndicatorAdded", - G_TYPE_UINT, G_TYPE_STRING, G_TYPE_INVALID); - dbus_g_proxy_connect_signal(proxyt->proxy, "IndicatorAdded", - G_CALLBACK(proxy_indicator_added), proxyt, NULL); + dbus_g_proxy_add_signal(proxyt->proxy, "ServerShow", + G_TYPE_STRING, G_TYPE_INVALID); + dbus_g_proxy_connect_signal(proxyt->proxy, "ServerShow", + G_CALLBACK(proxy_server_added), proxyt, NULL); org_freedesktop_indicator_get_indicator_list_async(proxyt->proxy, proxy_get_indicator_list, proxyt); @@ -439,10 +440,8 @@ proxy_get_indicator_type (DBusGProxy * proxy, gchar * type, GError * error, gpoi } static void -proxy_indicator_added (DBusGProxy * proxy, guint id, const gchar * type, proxy_t * proxyt) +proxy_server_added (DBusGProxy * proxy, const gchar * type, proxy_t * proxyt) { - /* g_debug("Interface %s has an indicator %d of type %s", proxyt->name, id, type); */ - if (proxyt->indicators == NULL) { proxyt->indicators = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, proxy_indicators_free); @@ -451,6 +450,10 @@ proxy_indicator_added (DBusGProxy * proxy, guint id, const gchar * type, proxy_t g_hash_table_remove(priv->proxies_possible, proxyt->name); g_hash_table_insert(priv->proxies_working, proxyt->name, proxyt); + dbus_g_proxy_add_signal(proxyt->proxy, "IndicatorAdded", + G_TYPE_UINT, G_TYPE_STRING, G_TYPE_INVALID); + dbus_g_proxy_connect_signal(proxyt->proxy, "IndicatorAdded", + G_CALLBACK(proxy_indicator_removed), proxyt, NULL); dbus_g_proxy_add_signal(proxyt->proxy, "IndicatorRemoved", G_TYPE_UINT, G_TYPE_STRING, G_TYPE_INVALID); dbus_g_proxy_connect_signal(proxyt->proxy, "IndicatorRemoved", @@ -460,9 +463,15 @@ proxy_indicator_added (DBusGProxy * proxy, guint id, const gchar * type, proxy_t dbus_g_proxy_connect_signal(proxyt->proxy, "IndicatorModified", G_CALLBACK(proxy_indicator_modified), proxyt, NULL); - g_signal_emit(proxyt->listener, signals[SERVER_ADDED], 0, proxyt->name, TRUE); + g_signal_emit(proxyt->listener, signals[SERVER_ADDED], 0, proxyt->name, type, TRUE); } + return; +} + +static void +proxy_indicator_added (DBusGProxy * proxy, guint id, const gchar * type, proxy_t * proxyt) +{ GHashTable * indicators = g_hash_table_lookup(proxyt->indicators, type); if (indicators == NULL) { diff --git a/libindicate/listener.h b/libindicate/listener.h index 4cec7e4..ddf0281 100644 --- a/libindicate/listener.h +++ b/libindicate/listener.h @@ -44,8 +44,8 @@ struct _IndicateListenerClass { void (* indicator_removed) (IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * type); void (* indicator_modified) (IndicateListenerServer * server, IndicateListenerIndicator * indicator, gchar * type, gchar * property); - void (* server_added) (IndicateListenerServer * server); - void (* server_removed) (IndicateListenerServer * server); + void (* server_added) (IndicateListenerServer * server, gchar * type); + void (* server_removed) (IndicateListenerServer * server, gchar * type); }; GType indicate_listener_get_type (void) G_GNUC_CONST; |