From cdb76a5ad9845785bc29fe67533201489f2adbea Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Fri, 25 May 2012 14:57:14 +0200 Subject: factor out add_roster_contact() --- libempathy-gtk/empathy-roster-view.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-roster-view.c b/libempathy-gtk/empathy-roster-view.c index 5e550e064..09d59517f 100644 --- a/libempathy-gtk/empathy-roster-view.c +++ b/libempathy-gtk/empathy-roster-view.c @@ -94,16 +94,12 @@ roster_contact_changed_cb (GtkWidget *child, egg_list_box_child_changed (EGG_LIST_BOX (self), child); } -static void -individual_added (EmpathyRosterView *self, +static GtkWidget * +add_roster_contact (EmpathyRosterView *self, FolksIndividual *individual) { GtkWidget *contact; - contact = g_hash_table_lookup (self->priv->roster_contacts, individual); - if (contact != NULL) - return; - contact = empathy_roster_contact_new (individual); /* Need to refilter if online is changed */ @@ -117,6 +113,21 @@ individual_added (EmpathyRosterView *self, gtk_widget_show (contact); gtk_container_add (GTK_CONTAINER (self), contact); + return contact; +} + +static void +individual_added (EmpathyRosterView *self, + FolksIndividual *individual) +{ + GtkWidget *contact; + + contact = g_hash_table_lookup (self->priv->roster_contacts, individual); + if (contact != NULL) + return; + + contact = add_roster_contact (self, individual); + g_hash_table_insert (self->priv->roster_contacts, individual, contact); } -- cgit v1.2.3