From 8e549e268287120c56eb2dbc25b9d70dadb895f2 Mon Sep 17 00:00:00 2001 From: Jonny Lamb Date: Wed, 19 Aug 2009 17:07:48 +0100 Subject: [PATCH] all: save the signal id and use that to disconnect from the signal Signed-off-by: Jonny Lamb --- libempathy-gtk/empathy-presence-chooser.c | 11 +++++++---- libempathy/empathy-connectivity.c | 9 ++++++--- libempathy/empathy-idle.c | 10 ++++++---- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/libempathy-gtk/empathy-presence-chooser.c b/libempathy-gtk/empathy-presence-chooser.c index 490ad898..ba36e091 100644 --- a/libempathy-gtk/empathy-presence-chooser.c +++ b/libempathy-gtk/empathy-presence-chooser.c @@ -101,6 +101,8 @@ typedef struct { EmpathyIdle *idle; EmpathyConnectivity *connectivity; + gulong state_change_signal_id; + gboolean editing_status; int block_set_editing; int block_changed; @@ -792,7 +794,8 @@ empathy_presence_chooser_init (EmpathyPresenceChooser *chooser) _("Set your presence and current status")); priv->connectivity = empathy_connectivity_dup_singleton (); - g_signal_connect (priv->connectivity, "state-change", + priv->state_change_signal_id = g_signal_connect (priv->connectivity, + "state-change", G_CALLBACK (presence_chooser_connectivity_state_change), chooser); presence_chooser_connectivity_state_change (priv->connectivity, @@ -819,9 +822,9 @@ presence_chooser_finalize (GObject *object) object); g_object_unref (priv->idle); - g_signal_handlers_disconnect_by_func (priv->connectivity, - presence_chooser_connectivity_state_change, - object); + g_signal_handler_disconnect (priv->connectivity, + priv->state_change_signal_id); + priv->state_change_signal_id = 0; g_object_unref (priv->connectivity); diff --git a/libempathy/empathy-connectivity.c b/libempathy/empathy-connectivity.c index 82ac9c9c..8cc1d26b 100644 --- a/libempathy/empathy-connectivity.c +++ b/libempathy/empathy-connectivity.c @@ -37,6 +37,7 @@ typedef struct { #ifdef HAVE_NM NMClient *nm_client; + gulong state_change_signal_id; #endif gboolean connected; @@ -116,7 +117,8 @@ empathy_connectivity_init (EmpathyConnectivity *connectivity) priv->nm_client = nm_client_new (); if (priv->nm_client != NULL) { - g_signal_connect (priv->nm_client, "notify::" NM_CLIENT_STATE, + priv->state_change_signal_id = g_signal_connect (priv->nm_client, + "notify::" NM_CLIENT_STATE, G_CALLBACK (connectivity_nm_state_change_cb), connectivity); connectivity_nm_state_change_cb (priv->nm_client, NULL, connectivity); @@ -139,8 +141,9 @@ connectivity_finalize (GObject *object) if (priv->nm_client != NULL) { - g_signal_handlers_disconnect_by_func (priv->nm_client, - connectivity_nm_state_change_cb, connectivity); + g_signal_handler_disconnect (priv->nm_client, + priv->state_change_signal_id); + priv->state_change_signal_id = 0; g_object_unref (priv->nm_client); priv->nm_client = NULL; } diff --git a/libempathy/empathy-idle.c b/libempathy/empathy-idle.c index f408cf69..ac0ca72f 100644 --- a/libempathy/empathy-idle.c +++ b/libempathy/empathy-idle.c @@ -45,6 +45,7 @@ typedef struct { MissionControl *mc; DBusGProxy *gs_proxy; EmpathyConnectivity *connectivity; + gulong state_change_signal_id; TpConnectionPresenceType state; gchar *status; @@ -270,8 +271,9 @@ idle_finalize (GObject *object) g_object_unref (priv->gs_proxy); } - g_signal_handlers_disconnect_by_func (priv->connectivity, - idle_state_change_cb, object); + g_signal_handler_disconnect (priv->connectivity, + priv->state_change_signal_id); + priv->state_change_signal_id = 0; g_object_unref (priv->connectivity); @@ -482,8 +484,8 @@ empathy_idle_init (EmpathyIdle *idle) } priv->connectivity = empathy_connectivity_dup_singleton (); - g_signal_connect (priv->connectivity, "state-change", - G_CALLBACK (idle_state_change_cb), idle); + priv->state_change_signal_id = g_signal_connect (priv->connectivity, + "state-change", G_CALLBACK (idle_state_change_cb), idle); } EmpathyIdle * -- 2.39.2