aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>2009-09-13 22:34:55 +0800
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>2009-09-14 00:45:01 +0800
commitc558a5ee937d50332885003c87a1b8c8520a412a (patch)
tree45994ee20642a35a8a963a78cf70d5fb702545b0 /libempathy-gtk
parentcbe0d0b4ecbffe71334fa7c25ff49612c521cf3d (diff)
downloadgsoc2013-empathy-c558a5ee937d50332885003c87a1b8c8520a412a.tar
gsoc2013-empathy-c558a5ee937d50332885003c87a1b8c8520a412a.tar.gz
gsoc2013-empathy-c558a5ee937d50332885003c87a1b8c8520a412a.tar.bz2
gsoc2013-empathy-c558a5ee937d50332885003c87a1b8c8520a412a.tar.lz
gsoc2013-empathy-c558a5ee937d50332885003c87a1b8c8520a412a.tar.xz
gsoc2013-empathy-c558a5ee937d50332885003c87a1b8c8520a412a.tar.zst
gsoc2013-empathy-c558a5ee937d50332885003c87a1b8c8520a412a.zip
Ensure we don't add the same contact twice at the top-level
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-contact-list-store.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/libempathy-gtk/empathy-contact-list-store.c b/libempathy-gtk/empathy-contact-list-store.c
index ea386e14a..5edcded95 100644
--- a/libempathy-gtk/empathy-contact-list-store.c
+++ b/libempathy-gtk/empathy-contact-list-store.c
@@ -878,6 +878,24 @@ contact_list_store_add_contact (EmpathyContactListStore *store,
}
/* If no groups just add it at the top level. */
if (!groups) {
+ GtkTreeIter iter;
+ GtkTreeModel *model = GTK_TREE_MODEL (store);
+
+ if (gtk_tree_model_get_iter_first (model, &iter)) do {
+ EmpathyContact *c;
+
+ gtk_tree_model_get (model, &iter,
+ EMPATHY_CONTACT_LIST_STORE_COL_CONTACT, &c,
+ -1);
+
+ if (c == contact) {
+ g_object_unref (c);
+ return;
+ }
+ if (c != NULL)
+ g_object_unref (c);
+ } while (gtk_tree_model_iter_next (model, &iter));
+
gtk_tree_store_append (GTK_TREE_STORE (store), &iter, NULL);
gtk_tree_store_set (GTK_TREE_STORE (store), &iter,
EMPATHY_CONTACT_LIST_STORE_COL_NAME, empathy_contact_get_name (contact),