From a15866686e0851f4951144f0d7a6118e963b605d Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Tue, 9 Mar 2010 15:02:58 +0100 Subject: [PATCH] factor out add_contact_to_store --- libempathy-gtk/empathy-contact-list-store.c | 50 ++++++++++----------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/libempathy-gtk/empathy-contact-list-store.c b/libempathy-gtk/empathy-contact-list-store.c index f3e9a4b9..21593932 100644 --- a/libempathy-gtk/empathy-contact-list-store.c +++ b/libempathy-gtk/empathy-contact-list-store.c @@ -1019,6 +1019,27 @@ contact_list_store_groups_changed_cb (EmpathyContactList *list_iface, priv->show_active = show_active; } +static void +add_contact_to_store (GtkTreeStore *store, + GtkTreeIter *iter, + EmpathyContact *contact, + EmpathyContactListFlags flags) +{ + gtk_tree_store_set (store, iter, + EMPATHY_CONTACT_LIST_STORE_COL_NAME, empathy_contact_get_name (contact), + EMPATHY_CONTACT_LIST_STORE_COL_CONTACT, contact, + EMPATHY_CONTACT_LIST_STORE_COL_IS_GROUP, FALSE, + EMPATHY_CONTACT_LIST_STORE_COL_IS_SEPARATOR, FALSE, + EMPATHY_CONTACT_LIST_STORE_COL_CAN_AUDIO_CALL, + empathy_contact_get_capabilities (contact) & + EMPATHY_CAPABILITIES_AUDIO, + EMPATHY_CONTACT_LIST_STORE_COL_CAN_VIDEO_CALL, + empathy_contact_get_capabilities (contact) & + EMPATHY_CAPABILITIES_VIDEO, + EMPATHY_CONTACT_LIST_STORE_COL_FLAGS, flags, + -1); +} + static void contact_list_store_add_contact (EmpathyContactListStore *store, EmpathyContact *contact) @@ -1077,19 +1098,7 @@ contact_list_store_add_contact (EmpathyContactListStore *store, gtk_tree_store_append (GTK_TREE_STORE (store), &iter, NULL); #endif - gtk_tree_store_set (GTK_TREE_STORE (store), &iter, - EMPATHY_CONTACT_LIST_STORE_COL_NAME, empathy_contact_get_name (contact), - EMPATHY_CONTACT_LIST_STORE_COL_CONTACT, contact, - EMPATHY_CONTACT_LIST_STORE_COL_IS_GROUP, FALSE, - EMPATHY_CONTACT_LIST_STORE_COL_IS_SEPARATOR, FALSE, - EMPATHY_CONTACT_LIST_STORE_COL_CAN_AUDIO_CALL, - empathy_contact_get_capabilities (contact) & - EMPATHY_CAPABILITIES_AUDIO, - EMPATHY_CONTACT_LIST_STORE_COL_CAN_VIDEO_CALL, - empathy_contact_get_capabilities (contact) & - EMPATHY_CAPABILITIES_VIDEO, - EMPATHY_CONTACT_LIST_STORE_COL_FLAGS, flags, - -1); + add_contact_to_store (GTK_TREE_STORE (store), &iter, contact, flags); } /* Else add to each group. */ @@ -1100,19 +1109,8 @@ contact_list_store_add_contact (EmpathyContactListStore *store, gtk_tree_store_insert_after (GTK_TREE_STORE (store), &iter, &iter_group, NULL); - gtk_tree_store_set (GTK_TREE_STORE (store), &iter, - EMPATHY_CONTACT_LIST_STORE_COL_NAME, empathy_contact_get_name (contact), - EMPATHY_CONTACT_LIST_STORE_COL_CONTACT, contact, - EMPATHY_CONTACT_LIST_STORE_COL_IS_GROUP, FALSE, - EMPATHY_CONTACT_LIST_STORE_COL_IS_SEPARATOR, FALSE, - EMPATHY_CONTACT_LIST_STORE_COL_CAN_AUDIO_CALL, - empathy_contact_get_capabilities (contact) & - EMPATHY_CAPABILITIES_AUDIO, - EMPATHY_CONTACT_LIST_STORE_COL_CAN_VIDEO_CALL, - empathy_contact_get_capabilities (contact) & - EMPATHY_CAPABILITIES_VIDEO, - EMPATHY_CONTACT_LIST_STORE_COL_FLAGS, flags, - -1); + + add_contact_to_store (GTK_TREE_STORE (store), &iter, contact, flags); g_free (l->data); } g_list_free (groups); -- 2.39.2