aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy/empathy-utils.c
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-03-28 21:54:17 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-04-02 15:28:47 +0800
commita26b2e0ceff25839270eb5e4b7bfea58ee13ca6f (patch)
tree25b6b8f58b2bd83e5534bb7a669f781f69fb4cc7 /libempathy/empathy-utils.c
parent851f9eea18a264e4f38964720c1368df25300980 (diff)
downloadgsoc2013-empathy-a26b2e0ceff25839270eb5e4b7bfea58ee13ca6f.tar.gz
gsoc2013-empathy-a26b2e0ceff25839270eb5e4b7bfea58ee13ca6f.tar.zst
gsoc2013-empathy-a26b2e0ceff25839270eb5e4b7bfea58ee13ca6f.zip
factor out create_individual_from_persona()
Diffstat (limited to 'libempathy/empathy-utils.c')
-rw-r--r--libempathy/empathy-utils.c32
1 files changed, 21 insertions, 11 deletions
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;
}