]> git.0d.be Git - empathy.git/commitdiff
Create the EmpathyContactMonitor lazily if needed.
authorXavier Claessens <xclaesse@src.gnome.org>
Tue, 6 Jan 2009 16:49:56 +0000 (16:49 +0000)
committerXavier Claessens <xclaesse@src.gnome.org>
Tue, 6 Jan 2009 16:49:56 +0000 (16:49 +0000)
svn path=/trunk/; revision=2099

libempathy/empathy-contact-manager.c
libempathy/empathy-tp-chat.c

index 213c625a3744da2f8474da6ae028aab88fc7bcbf..a69d6d9705faf46bf6521cedb96cea6499228645 100644 (file)
@@ -191,7 +191,9 @@ contact_manager_finalize (GObject *object)
                                              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 @@ empathy_contact_manager_init (EmpathyContactManager *manager)
                                             (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 @@ contact_manager_get_monitor (EmpathyContactList *manager)
 {
        EmpathyContactManagerPriv *priv = GET_PRIV (manager);
 
+       if (priv->contact_monitor == NULL) {
+               priv->contact_monitor = empathy_contact_monitor_new_for_iface (manager);
+       }
+
        return priv->contact_monitor;
 }
 
index bda30edb48eba59f9fabeab80583de82f721fadc..8517c1c0d43b50af8dec34508573ea0757955a10 100644 (file)
@@ -259,6 +259,10 @@ tp_chat_get_monitor (EmpathyContactList *list)
 
        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 @@ tp_chat_finalize (GObject *object)
                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_tp_chat_init (EmpathyTpChat *chat)
                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