[Telepathy-commits] [telepathy-mission-control/master] Abort the connection when the account is removed

Alberto Mardegan alberto.mardegan at nokia.com
Fri Jan 9 05:24:41 PST 2009


This, on turn, drops the reference on the account, therefore allowing it to get
disposed.
---
 src/mcd-connection.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/src/mcd-connection.c b/src/mcd-connection.c
index c42a846..4dcd7e6 100644
--- a/src/mcd-connection.c
+++ b/src/mcd-connection.c
@@ -1604,6 +1604,14 @@ _mcd_connection_release_tp_connection (McdConnection *connection)
 }
 
 static void
+on_account_removed (McdAccount *account, McdConnection *connection)
+{
+    g_debug ("Account %s removed, aborting connection",
+             mcd_account_get_unique_name (account));
+    mcd_mission_abort (MCD_MISSION (connection));
+}
+
+static void
 _mcd_connection_dispose (GObject * object)
 {
     McdConnection *connection = MCD_CONNECTION (object);
@@ -1638,6 +1646,9 @@ _mcd_connection_dispose (GObject * object)
 	g_signal_handlers_disconnect_by_func (priv->account,
 					      G_CALLBACK (on_account_alias_changed),
 					      object);
+        g_signal_handlers_disconnect_by_func (priv->account,
+                                              G_CALLBACK (on_account_removed),
+                                              object);
 	g_object_unref (priv->account);
 	priv->account = NULL;
     }
@@ -1713,6 +1724,9 @@ _mcd_connection_set_property (GObject * obj, guint prop_id,
 	g_signal_connect (priv->account,
 			  "alias-changed",
 			  G_CALLBACK (on_account_alias_changed), obj);
+        g_signal_connect (priv->account, "removed",
+                          G_CALLBACK (on_account_removed),
+                          obj);
 	break;
     default:
 	G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
-- 
1.5.6.5




More information about the Telepathy-commits mailing list