From c6371ec63c928c848cbb5474cb005af5cc414230 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Sun, 12 Dec 2010 18:51:07 +0000 Subject: Bug 637097 — Port to latest folks API changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- configure.ac | 2 +- libempathy-gtk/empathy-contact-widget.c | 10 +++++----- libempathy-gtk/empathy-individual-menu.c | 4 ++-- libempathy-gtk/empathy-individual-store.c | 27 +++++++++++++++------------ libempathy-gtk/empathy-individual-view.c | 6 +++--- libempathy-gtk/empathy-individual-widget.c | 29 +++++++++++++++++------------ libempathy-gtk/empathy-persona-store.c | 12 +++++++----- libempathy-gtk/empathy-ui-utils.c | 6 ++++-- libempathy/empathy-contact.c | 20 ++++++++++++-------- libempathy/empathy-individual-manager.c | 4 ++-- 10 files changed, 68 insertions(+), 52 deletions(-) diff --git a/configure.ac b/configure.ac index 4ed8d9e24..c3b23d6d4 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/libempathy-gtk/empathy-contact-widget.c b/libempathy-gtk/empathy-contact-widget.c index 26713ebe4..3ebaa9dee 100644 --- a/libempathy-gtk/empathy-contact-widget.c +++ b/libempathy-gtk/empathy-contact-widget.c @@ -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); } } diff --git a/libempathy-gtk/empathy-individual-menu.c b/libempathy-gtk/empathy-individual-menu.c index e3159b401..29ead4fb0 100644 --- a/libempathy-gtk/empathy-individual-menu.c +++ b/libempathy-gtk/empathy-individual-menu.c @@ -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); diff --git a/libempathy-gtk/empathy-individual-store.c b/libempathy-gtk/empathy-individual-store.c index 4b07131a6..0add70ce3 100644 --- a/libempathy-gtk/empathy-individual-store.c +++ b/libempathy-gtk/empathy-individual-store.c @@ -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); diff --git a/libempathy-gtk/empathy-individual-view.c b/libempathy-gtk/empathy-individual-view.c index ee2a3af85..30098e534 100644 --- a/libempathy-gtk/empathy-individual-view.c +++ b/libempathy-gtk/empathy-individual-view.c @@ -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_); diff --git a/libempathy-gtk/empathy-individual-widget.c b/libempathy-gtk/empathy-individual-widget.c index 138b70db9..44e7f9572 100644 --- a/libempathy-gtk/empathy-individual-widget.c +++ b/libempathy-gtk/empathy-individual-widget.c @@ -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))); } } diff --git a/libempathy-gtk/empathy-persona-store.c b/libempathy-gtk/empathy-persona-store.c index e3c24bab4..b77e34d4b 100644 --- a/libempathy-gtk/empathy-persona-store.c +++ b/libempathy-gtk/empathy-persona-store.c @@ -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. */ diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c index 4c1287424..043c03eb3 100644 --- a/libempathy-gtk/empathy-ui-utils.c +++ b/libempathy-gtk/empathy-ui-utils.c @@ -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; diff --git a/libempathy/empathy-contact.c b/libempathy/empathy-contact.c index 5383187c1..86bb9f5a8 100644 --- a/libempathy/empathy-contact.c +++ b/libempathy/empathy-contact.c @@ -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 diff --git a/libempathy/empathy-individual-manager.c b/libempathy/empathy-individual-manager.c index 82884e4d1..29470b87e 100644 --- a/libempathy/empathy-individual-manager.c +++ b/libempathy/empathy-individual-manager.c @@ -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); } -- cgit v1.2.3