]> git.0d.be Git - empathy.git/commitdiff
Remember correctly the window position and size when using tabs in the chat window...
authorXavier Claessens <xclaesse@src.gnome.org>
Sat, 8 Mar 2008 14:58:58 +0000 (14:58 +0000)
committerXavier Claessens <xclaesse@src.gnome.org>
Sat, 8 Mar 2008 14:58:58 +0000 (14:58 +0000)
svn path=/trunk/; revision=705

libempathy-gtk/empathy-chat-window.c
libempathy-gtk/empathy-chat.c

index 64311f698fbce1077a6942577910e8d0686aa794..5e5a854c52d035eda7e909cd3283e57d6b4c8c98 100644 (file)
@@ -934,11 +934,6 @@ chat_window_configure_event_cb (GtkWidget         *widget,
 
        priv = GET_PRIV (window);
 
-       /* Only save geometry information if there is ONE chat visible. */
-       if (g_list_length (priv->chats) > 1) {
-               return FALSE;
-       }
-
        if (priv->save_geometry_id != 0) {
                g_source_remove (priv->save_geometry_id);
        }
@@ -1731,8 +1726,9 @@ empathy_chat_window_add_chat (EmpathyChatWindow *window,
                              EmpathyChat       *chat)
 {
        EmpathyChatWindowPriv *priv;
-       GtkWidget            *label;
-       GtkWidget            *child;
+       GtkWidget             *label;
+       GtkWidget             *child;
+       gint                   x, y, w, h;
 
        g_return_if_fail (window != NULL);
        g_return_if_fail (EMPATHY_IS_CHAT (chat));
@@ -1745,24 +1741,20 @@ empathy_chat_window_add_chat (EmpathyChatWindow *window,
        /* Set the chat window */
        empathy_chat_set_window (chat, window);
 
-       if (g_list_length (priv->chats) == 0) {
-               gint x, y, w, h;
+       empathy_chat_load_geometry (chat, &x, &y, &w, &h);
 
-               empathy_chat_load_geometry (chat, &x, &y, &w, &h);
-
-               if (x >= 0 && y >= 0) {
-                       /* Let the window manager position it if we don't have
-                        * good x, y coordinates.
-                        */
-                       gtk_window_move (GTK_WINDOW (priv->dialog), x, y);
-               }
+       if (x >= 0 && y >= 0) {
+               /* Let the window manager position it if we don't have
+                * good x, y coordinates.
+                */
+               gtk_window_move (GTK_WINDOW (priv->dialog), x, y);
+       }
 
-               if (w > 0 && h > 0) {
-                       /* Use the defaults from the glade file if we don't have
-                        * good w, h geometry.
-                        */
-                       gtk_window_resize (GTK_WINDOW (priv->dialog), w, h);
-               }
+       if (w > 0 && h > 0) {
+               /* Use the defaults from the glade file if we don't have
+                * good w, h geometry.
+                */
+               gtk_window_resize (GTK_WINDOW (priv->dialog), w, h);
        }
 
        child = empathy_chat_get_widget (chat);
index 550bd94b2d4e3dd78fd0b04714ab98929c2edfac..93aa4514cee5a94fc36c740e9a613d73079adefb 100644 (file)
@@ -1443,6 +1443,22 @@ empathy_chat_is_connected (EmpathyChat *chat)
        return (priv->tp_chat != NULL);
 }
 
+static const gchar *
+chat_get_window_id_for_geometry (EmpathyChat *chat)
+{
+       gboolean separate_windows;
+
+       empathy_conf_get_bool (empathy_conf_get (),
+                              EMPATHY_PREFS_UI_SEPARATE_CHAT_WINDOWS,
+                              &separate_windows);
+
+       if (separate_windows) {
+               return empathy_chat_get_id (chat);
+       } else {
+               return "chat-window";
+       }
+}
+
 void
 empathy_chat_save_geometry (EmpathyChat *chat,
                           gint        x,
@@ -1450,7 +1466,7 @@ empathy_chat_save_geometry (EmpathyChat *chat,
                           gint        w,
                           gint        h)
 {
-       empathy_geometry_save (empathy_chat_get_id (chat), x, y, w, h);
+       empathy_geometry_save (chat_get_window_id_for_geometry (chat), x, y, w, h);
 }
 
 void
@@ -1460,7 +1476,7 @@ empathy_chat_load_geometry (EmpathyChat *chat,
                           gint       *w,
                           gint       *h)
 {
-       empathy_geometry_load (empathy_chat_get_id (chat), x, y, w, h);
+       empathy_geometry_load (chat_get_window_id_for_geometry (chat), x, y, w, h);
 }
 
 static gboolean