aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy/empathy-contact.c
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-09-17 18:36:20 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-09-27 21:20:19 +0800
commit362d847a53dfa9c344781065c3b1af5952a405e3 (patch)
treef4dc6c6f98c35ed6cef154dec5f000434db50b21 /libempathy/empathy-contact.c
parent23fc6264db524d903b3592f302dbcedae0edfab5 (diff)
downloadgsoc2013-empathy-362d847a53dfa9c344781065c3b1af5952a405e3.tar
gsoc2013-empathy-362d847a53dfa9c344781065c3b1af5952a405e3.tar.gz
gsoc2013-empathy-362d847a53dfa9c344781065c3b1af5952a405e3.tar.bz2
gsoc2013-empathy-362d847a53dfa9c344781065c3b1af5952a405e3.tar.lz
gsoc2013-empathy-362d847a53dfa9c344781065c3b1af5952a405e3.tar.xz
gsoc2013-empathy-362d847a53dfa9c344781065c3b1af5952a405e3.tar.zst
gsoc2013-empathy-362d847a53dfa9c344781065c3b1af5952a405e3.zip
rename presence_sort_func to presence_cmp_func
cmp_func() compare one feature (presence in this case) while sort_func() uses different cmp_func() to implement a feature specific sort.
Diffstat (limited to 'libempathy/empathy-contact.c')
-rw-r--r--libempathy/empathy-contact.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/libempathy/empathy-contact.c b/libempathy/empathy-contact.c
index ec5d83ab6..ab3fba538 100644
--- a/libempathy/empathy-contact.c
+++ b/libempathy/empathy-contact.c
@@ -1737,7 +1737,8 @@ empathy_contact_dup_from_tp_contact (TpContact *tp_contact)
}
static int
-presence_sort_func (EmpathyContact *a, EmpathyContact *b)
+presence_cmp_func (EmpathyContact *a,
+ EmpathyContact *b)
{
FolksPresence *presence_a, *presence_b;
@@ -1750,17 +1751,11 @@ presence_sort_func (EmpathyContact *a, EmpathyContact *b)
folks_presence_get_presence_type (presence_b));
}
-/* Sort by presence as with presence_sort_func(), but if the two contacts have
- * the same presence, prefer the one which can do both audio *and* video calls,
- * over the one which can only do one of the two. */
-static int
-voip_sort_func (EmpathyContact *a, EmpathyContact *b)
+static gint
+voip_cmp_func (EmpathyContact *a,
+ EmpathyContact *b)
{
gboolean has_audio_video_a, has_audio_video_b;
- gint presence_sort = presence_sort_func (a, b);
-
- if (presence_sort != 0)
- return presence_sort;
has_audio_video_a = empathy_contact_can_voip_audio (a) &&
empathy_contact_can_voip_video (a);
@@ -1775,6 +1770,20 @@ voip_sort_func (EmpathyContact *a, EmpathyContact *b)
return 0;
}
+/* Sort by presence as with presence_cmp_func(), but if the two contacts have
+ * the same presence, prefer the one which can do both audio *and* video calls,
+ * over the one which can only do one of the two. */
+static int
+voip_sort_func (EmpathyContact *a, EmpathyContact *b)
+{
+ gint presence_sort = presence_cmp_func (a, b);
+
+ if (presence_sort != 0)
+ return presence_sort;
+
+ return voip_cmp_func (a, b);
+}
+
static GCompareFunc
get_sort_func_for_action (EmpathyActionType action_type)
{
@@ -1788,7 +1797,7 @@ get_sort_func_for_action (EmpathyActionType action_type)
case EMPATHY_ACTION_SEND_FILE:
case EMPATHY_ACTION_SHARE_MY_DESKTOP:
default:
- return (GCompareFunc) presence_sort_func;
+ return (GCompareFunc) presence_cmp_func;
}
}