]> git.0d.be Git - empathy.git/commitdiff
Show/Hide contact list if we have/haven't a remote_contact.
authorXavier Claessens <xclaesse@src.gnome.org>
Mon, 14 Apr 2008 14:00:18 +0000 (14:00 +0000)
committerXavier Claessens <xclaesse@src.gnome.org>
Mon, 14 Apr 2008 14:00:18 +0000 (14:00 +0000)
svn path=/trunk/; revision=940

libempathy-gtk/empathy-chat.c

index 3dbda9aea0eb2cf90797a4ab3dbe1cfff701fec1..34bd398314b51a60e9e1714fed46db132ead9e9f 100644 (file)
@@ -79,6 +79,7 @@ struct _EmpathyChatPriv {
        guint              block_events_timeout_id;
        TpHandleType       handle_type;
        gpointer           token;
+       gint               contacts_width;
 
        GtkWidget         *widget;
        GtkWidget         *hpaned;
@@ -275,6 +276,7 @@ chat_destroy_cb (EmpathyTpChat *tp_chat,
        if (priv->tp_chat) {
                g_object_unref (priv->tp_chat);
                priv->tp_chat = NULL;
+               g_object_notify (G_OBJECT (chat), "tp-chat");
        }
 
        empathy_chat_view_append_event (chat->view, _("Disconnected"));
@@ -1255,6 +1257,26 @@ chat_members_changed_cb (EmpathyTpChat  *tp_chat,
        }
 }
 
+static void
+chat_set_show_contacts (EmpathyChat *chat, gboolean show)
+{
+       EmpathyChatPriv *priv = GET_PRIV (chat);
+
+       if (!priv->scrolled_window_contacts ||
+           GTK_WIDGET_VISIBLE (priv->scrolled_window_contacts) == show) {
+               return;
+       }
+
+       if (show) {
+               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);
+       }
+}
+
 static void
 chat_remote_contact_changed_cb (EmpathyChat *chat)
 {
@@ -1270,6 +1292,8 @@ chat_remote_contact_changed_cb (EmpathyChat *chat)
                g_object_ref (priv->remote_contact);
        }
 
+       chat_set_show_contacts (chat, priv->remote_contact == NULL);
+
        g_object_notify (G_OBJECT (chat), "remote-contact");
 }
 
@@ -1356,6 +1380,9 @@ chat_create_ui (EmpathyChat *chat)
        /* 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);