From bde9fd0d6c2fa922f52ab8f048929f96039fa4be Mon Sep 17 00:00:00 2001 From: xclaesse Date: Sun, 20 Apr 2008 19:57:09 +0000 Subject: Rework the way chat window is resized when the contact list appear/disappear. Fixes bug #528229. git-svn-id: svn+ssh://svn.gnome.org/svn/empathy/trunk@1013 4ee84921-47dd-4033-b63a-18d7a039a3e4 --- libempathy-gtk/empathy-chat.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'libempathy-gtk/empathy-chat.c') diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c index c40548b19..6bb983a5f 100644 --- a/libempathy-gtk/empathy-chat.c +++ b/libempathy-gtk/empathy-chat.c @@ -1264,6 +1264,14 @@ chat_members_changed_cb (EmpathyTpChat *tp_chat, } } +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 @@ chat_set_show_contacts (EmpathyChat *chat, gboolean show) } 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 @@ chat_create_ui (EmpathyChat *chat) 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 @@ empathy_chat_init (EmpathyChat *chat) 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; -- cgit v1.2.3