aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2008-04-25 15:04:50 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2008-04-25 15:04:50 +0800
commit394c54b4121f2c4e6335163067e56691cd943d57 (patch)
treeb2fac93c82452577229a39f4bf72d395ea1517b0
parentc02eecb160f12de1ebab46fbbc880617545dfe54 (diff)
downloadgsoc2013-empathy-394c54b4121f2c4e6335163067e56691cd943d57.tar
gsoc2013-empathy-394c54b4121f2c4e6335163067e56691cd943d57.tar.gz
gsoc2013-empathy-394c54b4121f2c4e6335163067e56691cd943d57.tar.bz2
gsoc2013-empathy-394c54b4121f2c4e6335163067e56691cd943d57.tar.lz
gsoc2013-empathy-394c54b4121f2c4e6335163067e56691cd943d57.tar.xz
gsoc2013-empathy-394c54b4121f2c4e6335163067e56691cd943d57.tar.zst
gsoc2013-empathy-394c54b4121f2c4e6335163067e56691cd943d57.zip
Do not create the contact list if it's not displayed.
svn path=/trunk/; revision=1042
-rw-r--r--libempathy-gtk/empathy-chat.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c
index 10bffdfc1..a168ea34b 100644
--- a/libempathy-gtk/empathy-chat.c
+++ b/libempathy-gtk/empathy-chat.c
@@ -89,8 +89,7 @@ struct _EmpathyChatPriv {
GtkWidget *scrolled_window_contacts;
GtkWidget *hbox_topic;
GtkWidget *label_topic;
- EmpathyContactListView *view;
- EmpathyContactListStore *store;
+ GtkWidget *contact_list_view;
/* Used to automatically shrink a window that has temporarily
* grown due to long input.
@@ -1285,13 +1284,13 @@ 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) {
+ if (!priv->scrolled_window_contacts) {
return;
}
if (show) {
- gint min_width;
+ EmpathyContactListStore *store;
+ gint min_width;
/* We are adding the contact list to the chat, we don't want the
* chat view to become too small. If the chat view is already
@@ -1307,10 +1306,27 @@ chat_set_show_contacts (EmpathyChat *chat, gboolean show)
gtk_paned_set_position (GTK_PANED (priv->hpaned),
priv->contacts_width);
}
+
+ store = empathy_contact_list_store_new (EMPATHY_CONTACT_LIST (priv->tp_chat));
+ priv->contact_list_view = GTK_WIDGET (empathy_contact_list_view_new (store,
+ EMPATHY_CONTACT_LIST_FEATURE_CONTACT_CHAT |
+ EMPATHY_CONTACT_LIST_FEATURE_CONTACT_CALL |
+ EMPATHY_CONTACT_LIST_FEATURE_CONTACT_LOG |
+ EMPATHY_CONTACT_LIST_FEATURE_CONTACT_FT |
+ EMPATHY_CONTACT_LIST_FEATURE_CONTACT_INVITE |
+ EMPATHY_CONTACT_LIST_FEATURE_CONTACT_INFO));
+ gtk_container_add (GTK_CONTAINER (priv->scrolled_window_contacts),
+ priv->contact_list_view);
+ gtk_widget_show (priv->contact_list_view);
gtk_widget_show (priv->scrolled_window_contacts);
+ g_object_unref (store);
} else {
priv->contacts_width = gtk_paned_get_position (GTK_PANED (priv->hpaned));
gtk_widget_hide (priv->scrolled_window_contacts);
+ if (priv->contact_list_view) {
+ gtk_widget_destroy (priv->contact_list_view);
+ priv->contact_list_view = NULL;
+ }
}
}
@@ -1414,17 +1430,6 @@ chat_create_ui (EmpathyChat *chat)
gtk_widget_show (chat->input_text_view);
/* Create contact list */
- priv->store = empathy_contact_list_store_new (EMPATHY_CONTACT_LIST (priv->tp_chat));
- priv->view = empathy_contact_list_view_new (priv->store,
- EMPATHY_CONTACT_LIST_FEATURE_CONTACT_CHAT |
- EMPATHY_CONTACT_LIST_FEATURE_CONTACT_CALL |
- EMPATHY_CONTACT_LIST_FEATURE_CONTACT_LOG |
- EMPATHY_CONTACT_LIST_FEATURE_CONTACT_FT |
- EMPATHY_CONTACT_LIST_FEATURE_CONTACT_INVITE |
- EMPATHY_CONTACT_LIST_FEATURE_CONTACT_INFO);
- 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 */
@@ -1514,7 +1519,6 @@ chat_finalize (GObject *object)
empathy_disconnect_account_status_changed (priv->token);
g_object_unref (priv->mc);
g_object_unref (priv->log_manager);
- g_object_unref (priv->store);
if (priv->tp_chat) {
g_object_unref (priv->tp_chat);