empathy r940 - trunk/libempathy-gtk



Author: xclaesse
Date: Mon Apr 14 15:00:18 2008
New Revision: 940
URL: http://svn.gnome.org/viewvc/empathy?rev=940&view=rev

Log:
Show/Hide contact list if we have/haven't a remote_contact.


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

Modified: trunk/libempathy-gtk/empathy-chat.c
==============================================================================
--- trunk/libempathy-gtk/empathy-chat.c	(original)
+++ trunk/libempathy-gtk/empathy-chat.c	Mon Apr 14 15:00:18 2008
@@ -79,6 +79,7 @@
 	guint              block_events_timeout_id;
 	TpHandleType       handle_type;
 	gpointer           token;
+	gint               contacts_width;
 
 	GtkWidget         *widget;
 	GtkWidget         *hpaned;
@@ -275,6 +276,7 @@
 	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"));
@@ -1256,6 +1258,26 @@
 }
 
 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)
 {
 	EmpathyChatPriv *priv = GET_PRIV (chat);
@@ -1270,6 +1292,8 @@
 		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 @@
 	/* 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);



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