]> git.0d.be Git - empathy.git/commitdiff
change empathy_chat_window_get_nb_rooms to get_chats_type
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Mon, 7 Dec 2009 16:52:26 +0000 (16:52 +0000)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Mon, 7 Dec 2009 16:59:34 +0000 (16:59 +0000)
That way we can implement the semantic we meant to. Muc and 1-1 chat are
handled the same way.

src/empathy-chat-window.c
src/empathy-chat-window.h

index 903f18fbf502ca9aef3dd0dfcb5b951a98cb764b..3f12b6393b6fb6c90fae4c5d3f2b2602127aa808 100644 (file)
@@ -1852,7 +1852,6 @@ empathy_chat_window_get_default (gboolean room)
 {
        GList    *l;
        gboolean  separate_windows = TRUE;
-       guint nb_rooms;
 
        empathy_conf_get_bool (empathy_conf_get (),
                              EMPATHY_PREFS_UI_SEPARATE_CHAT_WINDOWS,
@@ -1873,14 +1872,15 @@ empathy_chat_window_get_default (gboolean room)
 
                dialog = empathy_chat_window_get_dialog (chat_window);
                if (empathy_window_get_is_visible (GTK_WINDOW (dialog))) {
-                       nb_rooms = empathy_chat_window_get_nb_rooms (chat_window);
+                       guint nb_rooms, nb_private;
+                       empathy_chat_window_get_nb_chats (chat_window, &nb_rooms, &nb_private);
 
                        /* Skip the window if there aren't any rooms in it */
                        if (room && nb_rooms == 0)
                                continue;
 
                        /* Skip the window if there aren't any 1-1 chats in it */
-                       if (!room && nb_rooms > 0)
+                       if (!room && nb_private == 0)
                                continue;
 
                        /* Found a visible window on this desktop */
@@ -2114,17 +2114,24 @@ empathy_chat_window_present_chat (EmpathyChat *chat)
        gtk_widget_grab_focus (chat->input_text_view);
 }
 
-guint
-empathy_chat_window_get_nb_rooms (EmpathyChatWindow *self)
+void
+empathy_chat_window_get_nb_chats (EmpathyChatWindow *self,
+                              guint *nb_rooms,
+                              guint *nb_private)
 {
        EmpathyChatWindowPriv *priv = GET_PRIV (self);
        GList *l;
-       guint nb = 0;
+       guint _nb_rooms = 0, _nb_private = 0;
 
        for (l = priv->chats; l != NULL; l = g_list_next (l)) {
                if (empathy_chat_is_room (EMPATHY_CHAT (l->data)))
-                       nb++;
+                       _nb_rooms++;
+               else
+                       _nb_private++;
        }
 
-       return nb;
+       if (nb_rooms != NULL)
+               *nb_rooms = _nb_rooms;
+       if (nb_private != NULL)
+               *nb_private = _nb_private;
 }
index a347352a95473d93d5c5072f5169c96f706ddca8..93ffcc53a9a1377bf5744ceb079089fa7d5f314d 100644 (file)
@@ -74,7 +74,9 @@ EmpathyChat *      empathy_chat_window_find_chat      (TpAccount        *account
                                                       const gchar      *id);
 void               empathy_chat_window_present_chat   (EmpathyChat      *chat);
 
-guint              empathy_chat_window_get_nb_rooms (EmpathyChatWindow *window);
+void               empathy_chat_window_get_nb_chats   (EmpathyChatWindow *window,
+                                                      guint *nb_rooms,
+                                                      guint *nb_private);
 
 G_END_DECLS