]> git.0d.be Git - empathy.git/commitdiff
Chandlers leaves when there is no more channels to handle. Translate call window...
authorXavier Claessens <xclaesse@src.gnome.org>
Sat, 29 Dec 2007 15:49:38 +0000 (15:49 +0000)
committerXavier Claessens <xclaesse@src.gnome.org>
Sat, 29 Dec 2007 15:49:38 +0000 (15:49 +0000)
svn path=/trunk/; revision=514

libempathy-gtk/empathy-call-window.c
po/POTFILES.in
src/empathy-call-chandler.c
src/empathy-chat-chandler.c

index 9b2b46f4b73da7fcbab71d8c9a34d4db0768ce5b..a1c7bd79906927d84644982ea8f54f95b99a6599 100644 (file)
@@ -24,6 +24,7 @@
 #include "config.h"
 
 #include <gtk/gtk.h>
+#include <glib/gi18n.h>
 
 #include <libempathy/empathy-debug.h>
 
index d137ce877138b45b1bed9ee79cb0ae3ab8d76a9e..b23897d87a7d596f12c7e85b40ddf662e58b5bfa 100644 (file)
@@ -19,6 +19,7 @@ libempathy-gtk/empathy-accounts-dialog.c
 libempathy-gtk/empathy-accounts-dialog.glade
 libempathy-gtk/empathy-avatar-chooser.c
 libempathy-gtk/empathy-avatar-image.c
+libempathy-gtk/empathy-call-window.c
 libempathy-gtk/empathy-call-window.glade
 libempathy-gtk/empathy-chat.c
 libempathy-gtk/empathy-chat.glade
index 3a1b511373bf0e7acf3891036e99e7c125dab7ec..be9de117510847f117521c0352007ffc1bb286d8 100644 (file)
 #define BUS_NAME "org.gnome.Empathy.CallChandler"
 #define OBJECT_PATH "/org/gnome/Empathy/CallChandler"
 
+static guint nb_calls = 0;
+
+static void
+call_chandler_weak_notify (gpointer  data,
+                          GObject  *where_the_object_was)
+{
+       nb_calls--;
+       if (nb_calls == 0) {
+               empathy_debug (DEBUG_DOMAIN, "No more calls, leaving...");
+               gtk_main_quit ();
+       }
+}
+
 static void
 call_chandler_new_channel_cb (EmpathyChandler *chandler,
                              TpConn          *tp_conn,
@@ -50,13 +63,17 @@ call_chandler_new_channel_cb (EmpathyChandler *chandler,
 {
        EmpathyTpCall *call;
        McAccount     *account;
+       GtkWidget     *window;
 
        account = mission_control_get_account_for_connection (mc, tp_conn, NULL);
 
        call = empathy_tp_call_new (account, tp_chan);
-       empathy_call_window_show (call);
+       window = empathy_call_window_show (call);
        g_object_unref (account);
        g_object_unref (call);
+
+       nb_calls++;
+       g_object_weak_ref (G_OBJECT (window), call_chandler_weak_notify, NULL);
 }
 
 int
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);