empathy r2099 - trunk/libempathy



Author: xclaesse
Date: Tue Jan  6 16:49:56 2009
New Revision: 2099
URL: http://svn.gnome.org/viewvc/empathy?rev=2099&view=rev

Log:
Create the EmpathyContactMonitor lazily if needed.

Modified:
   trunk/libempathy/empathy-contact-manager.c
   trunk/libempathy/empathy-tp-chat.c

Modified: trunk/libempathy/empathy-contact-manager.c
==============================================================================
--- trunk/libempathy/empathy-contact-manager.c	(original)
+++ trunk/libempathy/empathy-contact-manager.c	Tue Jan  6 16:49:56 2009
@@ -191,7 +191,9 @@
 					      object);
 	g_object_unref (priv->account_manager);
 
-	g_object_unref (priv->contact_monitor);
+	if (priv->contact_monitor) {
+		g_object_unref (priv->contact_monitor);
+	}
 }
 
 static void
@@ -218,7 +220,7 @@
 					     (GDestroyNotify) g_object_unref,
 					     (GDestroyNotify) g_object_unref);
 	priv->account_manager = empathy_account_manager_dup_singleton ();
-	priv->contact_monitor = empathy_contact_monitor_new_for_proxy (EMPATHY_CONTACT_LIST (manager));
+	priv->contact_monitor = NULL;
 
 	g_signal_connect (priv->account_manager,
 			  "account-connection-changed",
@@ -333,6 +335,10 @@
 {
 	EmpathyContactManagerPriv *priv = GET_PRIV (manager);
 
+	if (priv->contact_monitor == NULL) {
+		priv->contact_monitor = empathy_contact_monitor_new_for_iface (manager);
+	}
+
 	return priv->contact_monitor;
 }
 

Modified: trunk/libempathy/empathy-tp-chat.c
==============================================================================
--- trunk/libempathy/empathy-tp-chat.c	(original)
+++ trunk/libempathy/empathy-tp-chat.c	Tue Jan  6 16:49:56 2009
@@ -259,6 +259,10 @@
 
 	priv = GET_PRIV (list);
 
+	if (priv->contact_monitor == NULL) {
+		priv->contact_monitor = empathy_contact_monitor_new_for_iface (list);
+	}
+
 	return priv->contact_monitor;
 }
 
@@ -908,7 +912,10 @@
 		g_object_unref (priv->group);
 	}
 
-	g_object_unref (priv->contact_monitor);
+	if (priv->contact_monitor) {
+		g_object_unref (priv->contact_monitor);
+	}
+
 	g_object_unref (priv->factory);
 	g_object_unref (priv->user);
 	g_object_unref (priv->account);
@@ -1112,7 +1119,7 @@
 		EMPATHY_TYPE_TP_CHAT, EmpathyTpChatPriv);
 
 	chat->priv = priv;
-	priv->contact_monitor = empathy_contact_monitor_new_for_proxy (EMPATHY_CONTACT_LIST (chat));
+	priv->contact_monitor = NULL;
 }
 
 static void



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