[empathy: 7/26] empathy-idle: disconnect from connectivity signals before unreffing



commit 394527fe9f0394c41fcf980bba3668d84434040f
Author: Jonny Lamb <jonny lamb collabora co uk>
Date:   Wed Aug 19 11:51:27 2009 +0100

    empathy-idle: disconnect from connectivity signals before unreffing
    
    Signed-off-by: Jonny Lamb <jonny lamb collabora co uk>

 libempathy/empathy-idle.c |   37 +++++++++++++++++++++----------------
 1 files changed, 21 insertions(+), 16 deletions(-)
---
diff --git a/libempathy/empathy-idle.c b/libempathy/empathy-idle.c
index 7757b7b..5f38e94 100644
--- a/libempathy/empathy-idle.c
+++ b/libempathy/empathy-idle.c
@@ -258,6 +258,22 @@ idle_state_change_cb (EmpathyConnectivity *connectivity,
 }
 
 static void
+idle_use_conn_cb (GObject *object,
+		  GParamSpec *pspec,
+		  EmpathyIdle *idle)
+{
+	EmpathyIdlePriv *priv = GET_PRIV (idle);
+
+	if (!empathy_connectivity_get_use_conn (priv->connectivity)) {
+		if (priv->saved_state != TP_CONNECTION_PRESENCE_TYPE_UNSET) {
+			empathy_idle_set_state (idle, priv->saved_state);
+		}
+
+		priv->saved_state = TP_CONNECTION_PRESENCE_TYPE_UNSET;
+	}
+}
+
+static void
 idle_finalize (GObject *object)
 {
 	EmpathyIdlePriv *priv;
@@ -271,6 +287,11 @@ 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_handlers_disconnect_by_func (priv->connectivity,
+					      idle_use_conn_cb, object);
+
 	g_object_unref (priv->connectivity);
 
 	idle_ext_away_stop (EMPATHY_IDLE (object));
@@ -430,22 +451,6 @@ empathy_idle_get_actual_presence (EmpathyIdle *idle, GError **error)
 }
 
 static void
-idle_use_conn_cb (GObject *object,
-		  GParamSpec *pspec,
-		  EmpathyIdle *idle)
-{
-	EmpathyIdlePriv *priv = GET_PRIV (idle);
-
-	if (!empathy_connectivity_get_use_conn (priv->connectivity)) {
-		if (priv->saved_state != TP_CONNECTION_PRESENCE_TYPE_UNSET) {
-			empathy_idle_set_state (idle, priv->saved_state);
-		}
-
-		priv->saved_state = TP_CONNECTION_PRESENCE_TYPE_UNSET;
-	}
-}
-
-static void
 empathy_idle_init (EmpathyIdle *idle)
 {
 	GError          *error = NULL;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]