]> git.0d.be Git - empathy.git/blobdiff - src/empathy-chat-chandler.c
Revert "merge git work"
[empathy.git] / src / empathy-chat-chandler.c
index dc2eb60f7fae10c45dfd836dd89b47a128a7ec42..79bbe8a35bee21fb092d12236793ffc5c50634b7 100644 (file)
 #define BUS_NAME "org.gnome.Empathy.ChatChandler"
 #define OBJECT_PATH "/org/gnome/Empathy/ChatChandler"
 
+static guint nb_chats = 0;
+
+static void
+chat_chandler_weak_notify (gpointer  data,
+                          GObject  *where_the_object_was)
+{
+       nb_chats--;
+       if (nb_chats == 0) {
+               empathy_debug (DEBUG_DOMAIN, "No more chats, leaving...");
+               gtk_main_quit ();
+       }
+}
+
 static void
 chat_chandler_new_channel_cb (EmpathyChandler *chandler,
                              TpConn          *tp_conn,
@@ -99,6 +112,8 @@ chat_chandler_new_channel_cb (EmpathyChandler *chandler,
                return;
        }
 
+       nb_chats++;
+       g_object_weak_ref (G_OBJECT (chat), chat_chandler_weak_notify, NULL);
        empathy_chat_present (chat);
 
        g_object_unref (chat);