aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libempathy-gtk/empathy-chat.c6
-rw-r--r--libempathy-gtk/empathy-contact-list-store.c50
-rw-r--r--libempathy-gtk/empathy-contact-list-view.c4
-rw-r--r--libempathy-gtk/empathy-contact-menu.c11
-rw-r--r--libempathy-gtk/empathy-contact-menu.h3
5 files changed, 48 insertions, 26 deletions
diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c
index 36b4136ee..90272007a 100644
--- a/libempathy-gtk/empathy-chat.c
+++ b/libempathy-gtk/empathy-chat.c
@@ -2090,7 +2090,11 @@ chat_update_contacts_visibility (EmpathyChat *chat,
priv->contacts_width);
}
- store = empathy_contact_list_store_new (EMPATHY_CONTACT_LIST (priv->tp_chat));
+ store = empathy_contact_list_store_new (
+ EMPATHY_CONTACT_LIST (priv->tp_chat));
+ empathy_contact_list_store_set_show_groups (
+ EMPATHY_CONTACT_LIST_STORE (store), FALSE);
+
priv->contact_list_view = GTK_WIDGET (empathy_contact_list_view_new (store,
EMPATHY_CONTACT_LIST_FEATURE_CONTACT_TOOLTIP,
EMPATHY_CONTACT_FEATURE_CHAT |
diff --git a/libempathy-gtk/empathy-contact-list-store.c b/libempathy-gtk/empathy-contact-list-store.c
index dbcb9c81b..16169347b 100644
--- a/libempathy-gtk/empathy-contact-list-store.c
+++ b/libempathy-gtk/empathy-contact-list-store.c
@@ -604,7 +604,6 @@ empathy_contact_list_store_set_show_groups (EmpathyContactListStore *store,
gboolean show_groups)
{
EmpathyContactListStorePriv *priv;
- GList *contacts, *l;
g_return_if_fail (EMPATHY_IS_CONTACT_LIST_STORE (store));
@@ -616,19 +615,28 @@ empathy_contact_list_store_set_show_groups (EmpathyContactListStore *store,
priv->show_groups = show_groups;
- /* Remove all contacts and add them back, not optimized but that's the
- * easy way :) */
- gtk_tree_store_clear (GTK_TREE_STORE (store));
- contacts = empathy_contact_list_get_members (priv->list);
- for (l = contacts; l; l = l->next) {
- contact_list_store_members_changed_cb (priv->list, l->data,
- NULL, 0, NULL,
- TRUE,
- store);
-
- g_object_unref (l->data);
+ if (priv->setup_idle_id == 0) {
+ /* Remove all contacts and add them back, not optimized but
+ * that's the easy way :)
+ *
+ * This is only done if there's not a pending setup idle
+ * callback, otherwise it will race and the contacts will get
+ * added twice */
+ GList *contacts, *l;
+
+ gtk_tree_store_clear (GTK_TREE_STORE (store));
+ contacts = empathy_contact_list_get_members (priv->list);
+ for (l = contacts; l; l = l->next) {
+ contact_list_store_members_changed_cb (priv->list,
+ l->data,
+ NULL, 0, NULL,
+ TRUE,
+ store);
+
+ g_object_unref (l->data);
+ }
+ g_list_free (contacts);
}
- g_list_free (contacts);
g_object_notify (G_OBJECT (store), "show-groups");
}
@@ -1060,9 +1068,13 @@ contact_list_store_add_contact (EmpathyContactListStore *store,
tp_connection_parse_object_path (connection, &protocol_name, NULL);
if (!groups) {
- GtkTreeIter iter_group;
+ GtkTreeIter iter_group, *parent;
- if (!tp_strdiff (protocol_name, "local-xmpp")) {
+ parent = &iter_group;
+
+ if (!priv->show_groups) {
+ parent = NULL;
+ } else if (!tp_strdiff (protocol_name, "local-xmpp")) {
/* these are People Nearby */
contact_list_store_get_group (store,
EMPATHY_CONTACT_LIST_STORE_PEOPLE_NEARBY,
@@ -1074,9 +1086,10 @@ contact_list_store_add_contact (EmpathyContactListStore *store,
}
gtk_tree_store_insert_after (GTK_TREE_STORE (store), &iter,
- &iter_group, NULL);
+ parent, NULL);
- add_contact_to_store (GTK_TREE_STORE (store), &iter, contact, flags);
+ add_contact_to_store (GTK_TREE_STORE (store), &iter,
+ contact, flags);
}
g_free (protocol_name);
@@ -1096,7 +1109,8 @@ contact_list_store_add_contact (EmpathyContactListStore *store,
g_list_free (groups);
#ifdef HAVE_FAVOURITE_CONTACTS
- if (empathy_contact_list_is_favourite (priv->list, contact)) {
+ if (priv->show_groups &&
+ empathy_contact_list_is_favourite (priv->list, contact)) {
/* Add contact to the fake 'Favorites' group */
GtkTreeIter iter_group;
diff --git a/libempathy-gtk/empathy-contact-list-view.c b/libempathy-gtk/empathy-contact-list-view.c
index 05823435a..15df212ce 100644
--- a/libempathy-gtk/empathy-contact-list-view.c
+++ b/libempathy-gtk/empathy-contact-list-view.c
@@ -1437,7 +1437,7 @@ empathy_contact_list_view_class_init (EmpathyContactListViewClass *klass)
PROP_LIST_FEATURES,
g_param_spec_flags ("list-features",
"Features of the view",
- "Falgs for all enabled features",
+ "Flags for all enabled features",
EMPATHY_TYPE_CONTACT_LIST_FEATURE_FLAGS,
EMPATHY_CONTACT_LIST_FEATURE_NONE,
G_PARAM_READWRITE));
@@ -1445,7 +1445,7 @@ empathy_contact_list_view_class_init (EmpathyContactListViewClass *klass)
PROP_CONTACT_FEATURES,
g_param_spec_flags ("contact-features",
"Features of the contact menu",
- "Falgs for all enabled features for the menu",
+ "Flags for all enabled features for the menu",
EMPATHY_TYPE_CONTACT_FEATURE_FLAGS,
EMPATHY_CONTACT_FEATURE_NONE,
G_PARAM_READWRITE));
diff --git a/libempathy-gtk/empathy-contact-menu.c b/libempathy-gtk/empathy-contact-menu.c
index 23522d40e..fbcd8dc8a 100644
--- a/libempathy-gtk/empathy-contact-menu.c
+++ b/libempathy-gtk/empathy-contact-menu.c
@@ -114,7 +114,8 @@ empathy_contact_menu_new (EmpathyContact *contact,
/* Separator */
if (features & (EMPATHY_CONTACT_FEATURE_EDIT |
- EMPATHY_CONTACT_FEATURE_INFO)) {
+ EMPATHY_CONTACT_FEATURE_INFO |
+ EMPATHY_CONTACT_FEATURE_FAVOURITE)) {
item = gtk_separator_menu_item_new ();
gtk_menu_shell_append (shell, item);
gtk_widget_show (item);
@@ -136,9 +137,11 @@ empathy_contact_menu_new (EmpathyContact *contact,
#if HAVE_FAVOURITE_CONTACTS
/* Favorite checkbox */
- item = empathy_contact_favourite_menu_item_new (contact);
- gtk_menu_shell_append (shell, item);
- gtk_widget_show (item);
+ if (features & EMPATHY_CONTACT_FEATURE_FAVOURITE) {
+ item = empathy_contact_favourite_menu_item_new (contact);
+ gtk_menu_shell_append (shell, item);
+ gtk_widget_show (item);
+ }
#endif
return menu;
diff --git a/libempathy-gtk/empathy-contact-menu.h b/libempathy-gtk/empathy-contact-menu.h
index 25f18e03f..4c6d62f9d 100644
--- a/libempathy-gtk/empathy-contact-menu.h
+++ b/libempathy-gtk/empathy-contact-menu.h
@@ -35,7 +35,8 @@ typedef enum {
EMPATHY_CONTACT_FEATURE_LOG = 1 << 2,
EMPATHY_CONTACT_FEATURE_EDIT = 1 << 3,
EMPATHY_CONTACT_FEATURE_INFO = 1 << 4,
- EMPATHY_CONTACT_FEATURE_ALL = (1 << 5) - 1,
+ EMPATHY_CONTACT_FEATURE_FAVOURITE = 1 << 5,
+ EMPATHY_CONTACT_FEATURE_ALL = (1 << 6) - 1,
} EmpathyContactFeatureFlags;
GtkWidget * empathy_contact_menu_new (EmpathyContact *contact,