Recognize both handheld and phone clienttypes as mobile devices
Empathy currently displays a phone icon for clients which indicate that
they're phones. However some mobile clients use the "handheld" client
type instead (e.g. Xabber on android devices).
While changing things around, i've also refactored the code a bit to
ensure that the determination will stay consistent in the various
location if it's changed in future.
Sjoerd Simons
11 years ago
114 | 114 |
gboolean *can_video_call,
|
115 | 115 |
EmpathyContact **out_contact);
|
116 | 116 |
|
|
117 |
gboolean empathy_client_types_contains_mobile_device (
|
|
118 |
const GStrv types);
|
|
119 |
|
117 | 120 |
FolksIndividual * empathy_create_individual_from_tp_contact (
|
118 | 121 |
TpContact *contact);
|
119 | 122 |
|
363 | 363 |
status = empathy_presence_get_default_message (priv->presence_type);
|
364 | 364 |
}
|
365 | 365 |
|
366 | |
if (!priv->is_group && priv->types != NULL && g_strv_length (priv->types) > 0
|
367 | |
&& !tp_strdiff (priv->types[0], "phone")) {
|
|
366 |
if (!priv->is_group &&
|
|
367 |
empathy_client_types_contains_mobile_device (priv->types)) {
|
368 | 368 |
on_a_phone = TRUE;
|
369 | 369 |
/* We want the phone black. */
|
370 | 370 |
if (attr_color)
|
807 | 807 |
|
808 | 808 |
types = tp_contact_get_client_types (priv->contact);
|
809 | 809 |
|
810 | |
if (types != NULL
|
811 | |
&& g_strv_length ((gchar **) types) > 0
|
812 | |
&& !tp_strdiff (types[0], "phone"))
|
|
810 |
if (empathy_client_types_contains_mobile_device ((GStrv) types))
|
813 | 811 |
{
|
814 | 812 |
gtk_widget_show (priv->hbox_client_types);
|
815 | 813 |
}
|
172 | 172 |
update_alias (self);
|
173 | 173 |
}
|
174 | 174 |
|
175 | |
static gboolean
|
176 | |
is_phone (FolksIndividual *individual)
|
177 | |
{
|
178 | |
const gchar * const *types;
|
179 | |
|
180 | |
types = empathy_individual_get_client_types (individual);
|
181 | |
if (types == NULL)
|
182 | |
return FALSE;
|
183 | |
|
184 | |
if (g_strv_length ((GStrv) types) <= 0)
|
185 | |
return FALSE;
|
186 | |
|
187 | |
return !tp_strdiff (types[0], "phone");
|
188 | |
}
|
189 | |
|
190 | 175 |
static void
|
191 | 176 |
update_presence_msg (EmpathyRosterContact *self)
|
192 | 177 |
{
|
193 | 178 |
const gchar *msg;
|
|
179 |
GStrv types;
|
194 | 180 |
|
195 | 181 |
msg = folks_presence_details_get_presence_message (
|
196 | 182 |
FOLKS_PRESENCE_DETAILS (self->priv->individual));
|
|
232 | 218 |
gtk_widget_show (self->priv->presence_msg);
|
233 | 219 |
}
|
234 | 220 |
|
|
221 |
types = (GStrv) empathy_individual_get_client_types (self->priv->individual);
|
|
222 |
|
235 | 223 |
gtk_widget_set_visible (self->priv->phone_icon,
|
236 | |
is_phone (self->priv->individual));
|
|
224 |
empathy_client_types_contains_mobile_device (types));
|
237 | 225 |
}
|
238 | 226 |
|
239 | 227 |
static void
|
985 | 985 |
const gchar * const *types;
|
986 | 986 |
|
987 | 987 |
types = empathy_contact_get_client_types (remote_contact);
|
988 | |
if (types != NULL && !tp_strdiff (types[0], "phone"))
|
|
988 |
if (empathy_client_types_contains_mobile_device ((GStrv) types))
|
989 | 989 |
{
|
990 | |
/* I'm on a phone ! */
|
|
990 |
/* I'm on a mobile device ! */
|
991 | 991 |
gchar *tmp = name;
|
992 | 992 |
|
993 | 993 |
name = g_strdup_printf ("☎ %s", name);
|