aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-individual-store.c
diff options
context:
space:
mode:
authorJonny Lamb <jonny.lamb@collabora.co.uk>2010-09-30 23:01:20 +0800
committerEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2010-11-16 00:59:11 +0800
commit6f9a0ae2e8dc6d71bc15bdc703cffec8851367ab (patch)
tree95dfca4b432c31c83e16c73ab22a887d9d869f1d /libempathy-gtk/empathy-individual-store.c
parent33d6d9dfbdeac6050a63912a9944b54e5c50d95f (diff)
downloadgsoc2013-empathy-6f9a0ae2e8dc6d71bc15bdc703cffec8851367ab.tar
gsoc2013-empathy-6f9a0ae2e8dc6d71bc15bdc703cffec8851367ab.tar.gz
gsoc2013-empathy-6f9a0ae2e8dc6d71bc15bdc703cffec8851367ab.tar.bz2
gsoc2013-empathy-6f9a0ae2e8dc6d71bc15bdc703cffec8851367ab.tar.lz
gsoc2013-empathy-6f9a0ae2e8dc6d71bc15bdc703cffec8851367ab.tar.xz
gsoc2013-empathy-6f9a0ae2e8dc6d71bc15bdc703cffec8851367ab.tar.zst
gsoc2013-empathy-6f9a0ae2e8dc6d71bc15bdc703cffec8851367ab.zip
contact: enable showing a phone next to contacts who are on phones
The future! Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
Diffstat (limited to 'libempathy-gtk/empathy-individual-store.c')
-rw-r--r--libempathy-gtk/empathy-individual-store.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/libempathy-gtk/empathy-individual-store.c b/libempathy-gtk/empathy-individual-store.c
index 807afb2a2..abd1d02e8 100644
--- a/libempathy-gtk/empathy-individual-store.c
+++ b/libempathy-gtk/empathy-individual-store.c
@@ -154,6 +154,33 @@ individual_can_audio_video_call (FolksIndividual *individual,
*can_video_call = can_video;
}
+static const gchar * const *
+individual_get_client_types (FolksIndividual *individual)
+{
+ GList *personas, *l;
+ const gchar * const *types = NULL;
+ FolksPresenceType presence_type = FOLKS_PRESENCE_TYPE_UNSET;
+
+ personas = folks_individual_get_personas (individual);
+ for (l = personas; l != NULL; l = l->next)
+ {
+ FolksPresence *presence = FOLKS_PRESENCE (l->data);
+
+ if (folks_presence_typecmp (folks_presence_get_presence_type (presence),
+ presence_type) > 0)
+ {
+ TpContact *tp_contact;
+
+ presence_type = folks_presence_get_presence_type (presence);
+
+ tp_contact = tpf_persona_get_contact (TPF_PERSONA (l->data));
+ types = tp_contact_get_client_types (tp_contact);
+ }
+ }
+
+ return types;
+}
+
static void
add_individual_to_store (GtkTreeStore *self,
GtkTreeIter *iter,
@@ -161,10 +188,13 @@ add_individual_to_store (GtkTreeStore *self,
FolksIndividual *individual)
{
gboolean can_audio_call, can_video_call;
+ const gchar * const *types;
individual_can_audio_video_call (individual, &can_audio_call,
&can_video_call);
+ types = individual_get_client_types (individual);
+
gtk_tree_store_insert_with_values (self, iter, parent, 0,
EMPATHY_INDIVIDUAL_STORE_COL_NAME,
folks_aliasable_get_alias (FOLKS_ALIASABLE (individual)),
@@ -173,6 +203,7 @@ add_individual_to_store (GtkTreeStore *self,
EMPATHY_INDIVIDUAL_STORE_COL_IS_SEPARATOR, FALSE,
EMPATHY_INDIVIDUAL_STORE_COL_CAN_AUDIO_CALL, can_audio_call,
EMPATHY_INDIVIDUAL_STORE_COL_CAN_VIDEO_CALL, can_video_call,
+ EMPATHY_INDIVIDUAL_STORE_COL_CLIENT_TYPES, types,
-1);
}
@@ -738,10 +769,13 @@ individual_store_contact_update (EmpathyIndividualStore *self,
for (l = iters; l && set_model; l = l->next)
{
gboolean can_audio_call, can_video_call;
+ const gchar * const *types;
individual_can_audio_video_call (individual, &can_audio_call,
&can_video_call);
+ types = individual_get_client_types (individual);
+
gtk_tree_store_set (GTK_TREE_STORE (self), l->data,
EMPATHY_INDIVIDUAL_STORE_COL_ICON_STATUS, pixbuf_status,
EMPATHY_INDIVIDUAL_STORE_COL_PIXBUF_AVATAR_VISIBLE, show_avatar,
@@ -757,6 +791,7 @@ individual_store_contact_update (EmpathyIndividualStore *self,
EMPATHY_INDIVIDUAL_STORE_COL_IS_SEPARATOR, FALSE,
EMPATHY_INDIVIDUAL_STORE_COL_CAN_AUDIO_CALL, can_audio_call,
EMPATHY_INDIVIDUAL_STORE_COL_CAN_VIDEO_CALL, can_video_call,
+ EMPATHY_INDIVIDUAL_STORE_COL_CLIENT_TYPES, types,
-1);
}
@@ -859,6 +894,8 @@ individual_personas_changed_cb (FolksIndividual *individual,
g_object_set_data (G_OBJECT (contact), "individual", individual);
g_signal_connect (contact, "notify::capabilities",
(GCallback) individual_store_contact_updated_cb, self);
+ g_signal_connect (contact, "notify::client-types",
+ (GCallback) individual_store_contact_updated_cb, self);
g_object_unref (contact);
}
@@ -1494,6 +1531,7 @@ individual_store_setup (EmpathyIndividualStore *self)
G_TYPE_BOOLEAN, /* Can make audio calls */
G_TYPE_BOOLEAN, /* Can make video calls */
G_TYPE_BOOLEAN, /* Is a fake group */
+ G_TYPE_STRV, /* Client types */
};
priv = GET_PRIV (self);