From a26b2e0ceff25839270eb5e4b7bfea58ee13ca6f Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Wed, 28 Mar 2012 15:54:17 +0200 Subject: factor out create_individual_from_persona() --- libempathy/empathy-utils.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) (limited to 'libempathy/empathy-utils.c') diff --git a/libempathy/empathy-utils.c b/libempathy/empathy-utils.c index 2f4c9edde..5730ed555 100644 --- a/libempathy/empathy-utils.c +++ b/libempathy/empathy-utils.c @@ -1167,10 +1167,28 @@ empathy_sasl_channel_supports_mechanism (TpChannel *channel, return tp_strv_contains (available_mechanisms, mechanism); } +static FolksIndividual * +create_individual_from_persona (FolksPersona *persona) +{ + GeeSet *personas; + FolksIndividual *individual; + + personas = GEE_SET ( + gee_hash_set_new (FOLKS_TYPE_PERSONA, g_object_ref, g_object_unref, + g_direct_hash, g_direct_equal)); + + gee_collection_add (GEE_COLLECTION (personas), persona); + + individual = folks_individual_new (personas); + + g_clear_object (&personas); + + return individual; +} + FolksIndividual * empathy_create_individual_from_tp_contact (TpContact *contact) { - GeeSet *personas; TpfPersona *persona; FolksIndividual *individual; @@ -1182,17 +1200,9 @@ empathy_create_individual_from_tp_contact (TpContact *contact) return NULL; } - personas = GEE_SET ( - gee_hash_set_new (FOLKS_TYPE_PERSONA, g_object_ref, g_object_unref, - g_direct_hash, g_direct_equal)); - - gee_collection_add (GEE_COLLECTION (personas), persona); - - individual = folks_individual_new (personas); - - g_clear_object (&persona); - g_clear_object (&personas); + individual = create_individual_from_persona (FOLKS_PERSONA (persona)); + g_object_unref (persona); return individual; } -- cgit v1.2.3