[empathy] factor out create_individual_from_persona()



commit a26b2e0ceff25839270eb5e4b7bfea58ee13ca6f
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Wed Mar 28 15:54:17 2012 +0200

    factor out create_individual_from_persona()

 libempathy/empathy-utils.c |   32 +++++++++++++++++++++-----------
 1 files changed, 21 insertions(+), 11 deletions(-)
---
diff --git a/libempathy/empathy-utils.c b/libempathy/empathy-utils.c
index 2f4c9ed..5730ed5 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;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]