Commit c6371ec6 authored by Philip Withnall's avatar Philip Withnall

Bug 637097 — Port to latest folks API changes

Catch up with three interface renamings which have happened in folks master.
This bumps Empathy's folks dependency to 0.3.3. Closes: bgo#637097
parent 92ab3451
......@@ -31,7 +31,7 @@ AC_COPYRIGHT([
# Minimal version required
# Hardp deps
FOLKS_REQUIRED=0.3.2
FOLKS_REQUIRED=0.3.3
GLIB_REQUIRED=2.27.2
GNUTLS_REQUIRED=2.8.5
GTK_REQUIRED=2.91.3
......
......@@ -1345,10 +1345,10 @@ contact_widget_contact_update (EmpathyContactWidget *information)
FolksPersona *persona = empathy_contact_get_persona (
information->contact);
if (persona != NULL && FOLKS_IS_FAVOURITE (persona))
if (persona != NULL && FOLKS_IS_FAVOURITABLE (persona))
{
gboolean is_favourite = folks_favourite_get_is_favourite (
FOLKS_FAVOURITE (persona));
gboolean is_favourite = folks_favouritable_get_is_favourite (
FOLKS_FAVOURITABLE (persona));
contact_widget_favourites_changed_cb (information->manager,
information->contact, is_favourite, information);
}
......@@ -1479,10 +1479,10 @@ favourite_toggled_cb (GtkToggleButton *button,
{
FolksPersona *persona = empathy_contact_get_persona (information->contact);
if (persona != NULL && FOLKS_IS_FAVOURITE (persona))
if (persona != NULL && FOLKS_IS_FAVOURITABLE (persona))
{
gboolean active = gtk_toggle_button_get_active (button);
folks_favourite_set_is_favourite (FOLKS_FAVOURITE (persona), active);
folks_favouritable_set_is_favourite (FOLKS_FAVOURITABLE (persona), active);
}
}
......
......@@ -749,7 +749,7 @@ static void
favourite_menu_item_toggled_cb (GtkCheckMenuItem *item,
FolksIndividual *individual)
{
folks_favourite_set_is_favourite (FOLKS_FAVOURITE (individual),
folks_favouritable_set_is_favourite (FOLKS_FAVOURITABLE (individual),
gtk_check_menu_item_get_active (item));
}
......@@ -761,7 +761,7 @@ empathy_individual_favourite_menu_item_new (FolksIndividual *individual)
item = gtk_check_menu_item_new_with_label (_("Favorite"));
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item),
folks_favourite_get_is_favourite (FOLKS_FAVOURITE (individual)));
folks_favouritable_get_is_favourite (FOLKS_FAVOURITABLE (individual)));
g_signal_connect (item, "toggled",
G_CALLBACK (favourite_menu_item_toggled_cb), individual);
......
......@@ -164,20 +164,21 @@ individual_get_client_types (FolksIndividual *individual)
personas = folks_individual_get_personas (individual);
for (l = personas; l != NULL; l = l->next)
{
FolksPresence *presence;
FolksHasPresence *presence;
/* We only want personas which implement FolksPresence */
if (!FOLKS_IS_PRESENCE (l->data))
/* We only want personas which implement FolksHasPresence */
if (!FOLKS_IS_HAS_PRESENCE (l->data))
continue;
presence = FOLKS_PRESENCE (l->data);
presence = FOLKS_HAS_PRESENCE (l->data);
if (folks_presence_typecmp (folks_presence_get_presence_type (presence),
if (folks_has_presence_typecmp (
folks_has_presence_get_presence_type (presence),
presence_type) > 0)
{
TpContact *tp_contact;
presence_type = folks_presence_get_presence_type (presence);
presence_type = folks_has_presence_get_presence_type (presence);
tp_contact = tpf_persona_get_contact (TPF_PERSONA (l->data));
types = tp_contact_get_client_types (tp_contact);
......@@ -477,7 +478,7 @@ individual_store_add_individual (EmpathyIndividualStore *self,
g_list_free (groups);
if (priv->show_groups &&
folks_favourite_get_is_favourite (FOLKS_FAVOURITE (individual)))
folks_favouritable_get_is_favourite (FOLKS_FAVOURITABLE (individual)))
{
/* Add contact to the fake 'Favorites' group */
GtkTreeIter iter_group;
......@@ -705,7 +706,7 @@ individual_store_contact_update (EmpathyIndividualStore *self,
}
/* Get online state now. */
now_online = folks_presence_is_online (FOLKS_PRESENCE (individual));
now_online = folks_has_presence_is_online (FOLKS_HAS_PRESENCE (individual));
if (!in_list)
{
......@@ -795,9 +796,11 @@ individual_store_contact_update (EmpathyIndividualStore *self,
EMPATHY_INDIVIDUAL_STORE_COL_NAME,
folks_aliasable_get_alias (FOLKS_ALIASABLE (individual)),
EMPATHY_INDIVIDUAL_STORE_COL_PRESENCE_TYPE,
folks_presence_get_presence_type (FOLKS_PRESENCE (individual)),
folks_has_presence_get_presence_type (
FOLKS_HAS_PRESENCE (individual)),
EMPATHY_INDIVIDUAL_STORE_COL_STATUS,
folks_presence_get_presence_message (FOLKS_PRESENCE (individual)),
folks_has_presence_get_presence_message (
FOLKS_HAS_PRESENCE (individual)),
EMPATHY_INDIVIDUAL_STORE_COL_COMPACT, priv->is_compact,
EMPATHY_INDIVIDUAL_STORE_COL_IS_GROUP, FALSE,
EMPATHY_INDIVIDUAL_STORE_COL_IS_ONLINE, now_online,
......@@ -1464,9 +1467,9 @@ individual_store_state_sort_func (GtkTreeModel *model,
* the presences.
*/
folks_presence_type_a =
folks_presence_get_presence_type (FOLKS_PRESENCE (individual_a));
folks_has_presence_get_presence_type (FOLKS_HAS_PRESENCE (individual_a));
folks_presence_type_b =
folks_presence_get_presence_type (FOLKS_PRESENCE (individual_b));
folks_has_presence_get_presence_type (FOLKS_HAS_PRESENCE (individual_b));
tp_presence_a = empathy_folks_presence_type_to_tp (folks_presence_type_a);
tp_presence_b = empathy_folks_presence_type_to_tp (folks_presence_type_b);
......
......@@ -377,14 +377,14 @@ real_drag_individual_received_cb (EmpathyIndividualView *self,
if (!tp_strdiff (new_group, EMPATHY_INDIVIDUAL_STORE_FAVORITE))
{
/* Mark contact as favourite */
folks_favourite_set_is_favourite (FOLKS_FAVOURITE (individual), TRUE);
folks_favouritable_set_is_favourite (FOLKS_FAVOURITABLE (individual), TRUE);
return;
}
if (!tp_strdiff (old_group, EMPATHY_INDIVIDUAL_STORE_FAVORITE))
{
/* Remove contact as favourite */
folks_favourite_set_is_favourite (FOLKS_FAVOURITE (individual), FALSE);
folks_favouritable_set_is_favourite (FOLKS_FAVOURITABLE (individual), FALSE);
/* Don't try to remove it */
old_group = NULL;
......@@ -681,7 +681,7 @@ individual_view_drag_motion (GtkWidget *widget,
}
if (individual != NULL &&
folks_presence_is_online (FOLKS_PRESENCE (individual)) &&
folks_has_presence_is_online (FOLKS_HAS_PRESENCE (individual)) &&
(caps & EMPATHY_CAPABILITIES_FT))
{
gdk_drag_status (context, GDK_ACTION_COPY, time_);
......
......@@ -220,19 +220,20 @@ update_weak_contact (EmpathyIndividualWidget *self)
personas = folks_individual_get_personas (priv->individual);
for (l = personas; l != NULL; l = l->next)
{
FolksPresence *presence;
FolksHasPresence *presence;
/* We only want personas which implement FolksPresence */
if (!FOLKS_IS_PRESENCE (l->data))
if (!FOLKS_IS_HAS_PRESENCE (l->data))
continue;
presence = FOLKS_PRESENCE (l->data);
presence = FOLKS_HAS_PRESENCE (l->data);
if (folks_presence_typecmp (folks_presence_get_presence_type (presence),
if (folks_has_presence_typecmp (
folks_has_presence_get_presence_type (presence),
presence_type) > 0
&& TPF_IS_PERSONA (presence))
{
presence_type = folks_presence_get_presence_type (presence);
presence_type = folks_has_presence_get_presence_type (presence);
tp_contact = tpf_persona_get_contact (TPF_PERSONA (l->data));
}
}
......@@ -896,7 +897,7 @@ individual_dup_avatar (FolksIndividual *individual)
/* FIXME: We just choose the first Persona which has an avatar, and save that.
* The avatar handling in EmpathyContact needs to be moved into libfolks as
* much as possible, and this code rewritten to use FolksAvatar.
* much as possible, and this code rewritten to use FolksHasAvatar.
* (bgo#627401) */
personas = folks_individual_get_personas (individual);
for (l = personas; l != NULL; l = l->next)
......@@ -1150,8 +1151,8 @@ favourite_toggled_cb (GtkToggleButton *button,
EmpathyIndividualWidget *self)
{
gboolean active = gtk_toggle_button_get_active (button);
folks_favourite_set_is_favourite (
FOLKS_FAVOURITE (GET_PRIV (self)->individual), active);
folks_favouritable_set_is_favourite (
FOLKS_FAVOURITABLE (GET_PRIV (self)->individual), active);
}
static void
......@@ -1247,11 +1248,13 @@ notify_presence_cb (gpointer folks_object,
state_image = g_object_get_data (table, "state-image");
/* FIXME: Default messages should be moved into libfolks (bgo#627403) */
message = folks_presence_get_presence_message (FOLKS_PRESENCE (folks_object));
message = folks_has_presence_get_presence_message (
FOLKS_HAS_PRESENCE (folks_object));
if (EMP_STR_EMPTY (message))
{
message = empathy_presence_get_default_message (
folks_presence_get_presence_type (FOLKS_PRESENCE (folks_object)));
folks_has_presence_get_presence_type (
FOLKS_HAS_PRESENCE (folks_object)));
}
if (message != NULL)
......@@ -1261,7 +1264,8 @@ notify_presence_cb (gpointer folks_object,
gtk_image_set_from_icon_name (GTK_IMAGE (state_image),
empathy_icon_name_for_presence (
folks_presence_get_presence_type (FOLKS_PRESENCE (folks_object))),
folks_has_presence_get_presence_type (
FOLKS_HAS_PRESENCE (folks_object))),
GTK_ICON_SIZE_BUTTON);
gtk_widget_show (state_image);
}
......@@ -1290,7 +1294,8 @@ notify_is_favourite_cb (gpointer folks_object,
if (GTK_IS_TOGGLE_BUTTON (favourite_widget))
{
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (favourite_widget),
folks_favourite_get_is_favourite (FOLKS_FAVOURITE (folks_object)));
folks_favouritable_get_is_favourite (
FOLKS_FAVOURITABLE (folks_object)));
}
}
......
......@@ -438,7 +438,7 @@ update_persona (EmpathyPersonaStore *self,
gtk_tree_path_free (path);
/* Get online state now. */
now_online = folks_presence_is_online (FOLKS_PRESENCE (persona));
now_online = folks_has_presence_is_online (FOLKS_HAS_PRESENCE (persona));
/* Get online state before. */
gtk_tree_model_get (GTK_TREE_MODEL (self), &iter,
......@@ -484,9 +484,11 @@ update_persona (EmpathyPersonaStore *self,
EMPATHY_PERSONA_STORE_COL_DISPLAY_ID,
folks_persona_get_display_id (persona),
EMPATHY_PERSONA_STORE_COL_PRESENCE_TYPE,
folks_presence_get_presence_type (FOLKS_PRESENCE (persona)),
folks_has_presence_get_presence_type (
FOLKS_HAS_PRESENCE (persona)),
EMPATHY_PERSONA_STORE_COL_STATUS,
folks_presence_get_presence_message (FOLKS_PRESENCE (persona)),
folks_has_presence_get_presence_message (
FOLKS_HAS_PRESENCE (persona)),
EMPATHY_PERSONA_STORE_COL_IS_ONLINE, now_online,
EMPATHY_PERSONA_STORE_COL_CAN_AUDIO_CALL,
empathy_contact_get_capabilities (contact) &
......@@ -626,8 +628,8 @@ state_sort_func (GtkTreeModel *model,
* the presences.
*/
ret_val = -tp_connection_presence_type_cmp_availability (
folks_presence_get_presence_type (FOLKS_PRESENCE (persona_a)),
folks_presence_get_presence_type (FOLKS_PRESENCE (persona_b)));
folks_has_presence_get_presence_type (FOLKS_HAS_PRESENCE (persona_a)),
folks_has_presence_get_presence_type (FOLKS_HAS_PRESENCE (persona_b)));
if (ret_val == 0) {
/* Fallback: compare by name et al. */
......
......@@ -232,7 +232,8 @@ empathy_icon_name_for_individual (FolksIndividual *individual)
TpConnectionPresenceType presence;
folks_presence =
folks_presence_get_presence_type (FOLKS_PRESENCE (individual));
folks_has_presence_get_presence_type (
FOLKS_HAS_PRESENCE (individual));
presence = empathy_folks_presence_type_to_tp (folks_presence);
return empathy_icon_name_for_presence (presence);
......@@ -632,7 +633,8 @@ empathy_pixbuf_avatar_from_individual_scaled_async (
callback, user_data,
empathy_pixbuf_avatar_from_individual_scaled_async);
avatar_file = folks_avatar_get_avatar (FOLKS_AVATAR (individual));
avatar_file =
folks_has_avatar_get_avatar (FOLKS_HAS_AVATAR (individual));
if (avatar_file == NULL)
goto out;
......
......@@ -510,8 +510,8 @@ empathy_contact_set_presence_message (EmpathyContact *contact,
if (priv->persona != NULL)
{
folks_presence_set_presence_message (FOLKS_PRESENCE (priv->persona),
message);
folks_has_presence_set_presence_message (
FOLKS_HAS_PRESENCE (priv->persona), message);
}
}
......@@ -991,7 +991,10 @@ empathy_contact_get_presence_message (EmpathyContact *contact)
priv = GET_PRIV (contact);
if (priv->persona != NULL)
return folks_presence_get_presence_message (FOLKS_PRESENCE (priv->persona));
{
return folks_has_presence_get_presence_message (
FOLKS_HAS_PRESENCE (priv->persona));
}
return NULL;
}
......@@ -1791,15 +1794,16 @@ static int
presence_cmp_func (EmpathyContact *a,
EmpathyContact *b)
{
FolksPresence *presence_a, *presence_b;
FolksHasPresence *presence_a, *presence_b;
presence_a = FOLKS_PRESENCE (empathy_contact_get_persona (a));
presence_b = FOLKS_PRESENCE (empathy_contact_get_persona (b));
presence_a = FOLKS_HAS_PRESENCE (empathy_contact_get_persona (a));
presence_b = FOLKS_HAS_PRESENCE (empathy_contact_get_persona (b));
/* We negate the result because we're sorting in reverse order (i.e. such that
* the Personas with the highest presence are at the beginning of the list. */
return -folks_presence_typecmp (folks_presence_get_presence_type (presence_a),
folks_presence_get_presence_type (presence_b));
return -folks_has_presence_typecmp (
folks_has_presence_get_presence_type (presence_a),
folks_has_presence_get_presence_type (presence_b));
}
static gint
......
......@@ -82,8 +82,8 @@ individual_notify_is_favourite_cb (FolksIndividual *individual,
GParamSpec *pspec,
EmpathyIndividualManager *self)
{
gboolean is_favourite = folks_favourite_get_is_favourite (
FOLKS_FAVOURITE (individual));
gboolean is_favourite = folks_favouritable_get_is_favourite (
FOLKS_FAVOURITABLE (individual));
g_signal_emit (self, signals[FAVOURITES_CHANGED], 0, individual,
is_favourite);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment