empathy r1013 - trunk/libempathy-gtk



Author: xclaesse
Date: Sun Apr 20 19:57:09 2008
New Revision: 1013
URL: http://svn.gnome.org/viewvc/empathy?rev=1013&view=rev

Log:
Rework the way chat window is resized when the contact list appear/disappear. Fixes bug #528229.


Modified:
   trunk/libempathy-gtk/empathy-chat.c
   trunk/libempathy-gtk/empathy-chat.glade

Modified: trunk/libempathy-gtk/empathy-chat.c
==============================================================================
--- trunk/libempathy-gtk/empathy-chat.c	(original)
+++ trunk/libempathy-gtk/empathy-chat.c	Sun Apr 20 19:57:09 2008
@@ -1264,6 +1264,14 @@
 	}
 }
 
+static gboolean
+chat_reset_size_request (gpointer widget)
+{
+	gtk_widget_set_size_request (widget, -1, -1);
+
+	return FALSE;
+}
+
 static void
 chat_set_show_contacts (EmpathyChat *chat, gboolean show)
 {
@@ -1275,9 +1283,19 @@
 	}
 
 	if (show) {
+		if (priv->contacts_width <= 0) {
+			/* It's the first time we show the contact list, make
+			 * sure the chat view don't get resized. Relax the
+			 * size request once it's done. */
+			gtk_widget_set_size_request (priv->vbox_left,
+						     priv->vbox_left->allocation.width,
+						     -1);
+			g_idle_add (chat_reset_size_request, priv->vbox_left);
+		} else {
+			gtk_paned_set_position (GTK_PANED (priv->hpaned),
+						priv->contacts_width);
+		}
 		gtk_widget_show (priv->scrolled_window_contacts);
-		gtk_paned_set_position (GTK_PANED (priv->hpaned),
-					priv->contacts_width);
 	} else {
 		priv->contacts_width = gtk_paned_get_position (GTK_PANED (priv->hpaned));
 		gtk_widget_hide (priv->scrolled_window_contacts);
@@ -1383,13 +1401,11 @@
 	gtk_container_add (GTK_CONTAINER (priv->scrolled_window_contacts),
 			   GTK_WIDGET (priv->view));
 	gtk_widget_show (GTK_WIDGET (priv->view));
+	chat_set_show_contacts (chat, priv->remote_contact == NULL);
 
 	/* Initialy hide the topic, will be shown if not empty */
 	gtk_widget_hide (priv->hbox_topic);
 
-	/* Show/Hide contact list */
-	chat_set_show_contacts (chat, priv->remote_contact == NULL);
-
 	/* Set widget focus order */
 	list = g_list_append (NULL, priv->scrolled_window_input);
 	gtk_container_set_focus_chain (GTK_CONTAINER (priv->vbox_left), list);
@@ -1605,6 +1621,7 @@
 	priv->is_first_char = TRUE;
 	priv->log_manager = empathy_log_manager_new ();
 	priv->default_window_height = -1;
+	priv->contacts_width = -1;
 	priv->vscroll_visible = FALSE;
 	priv->sent_messages = NULL;
 	priv->sent_messages_index = -1;

Modified: trunk/libempathy-gtk/empathy-chat.glade
==============================================================================
--- trunk/libempathy-gtk/empathy-chat.glade	(original)
+++ trunk/libempathy-gtk/empathy-chat.glade	Sun Apr 20 19:57:09 2008
@@ -57,8 +57,6 @@
             <property name="can_focus">True</property>
             <child>
               <widget class="GtkVBox" id="vbox_left">
-                <property name="width_request">600</property>
-                <property name="height_request">500</property>
                 <property name="visible">True</property>
                 <property name="spacing">6</property>
                 <child>
@@ -107,7 +105,7 @@
                 </child>
               </widget>
               <packing>
-                <property name="resize">True</property>
+                <property name="resize">False</property>
                 <property name="shrink">True</property>
               </packing>
             </child>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]