diff options
Diffstat (limited to 'libempathy-gtk')
-rw-r--r-- | libempathy-gtk/empathy-contact-widget.c | 10 | ||||
-rw-r--r-- | libempathy-gtk/empathy-individual-menu.c | 4 | ||||
-rw-r--r-- | libempathy-gtk/empathy-individual-store.c | 27 | ||||
-rw-r--r-- | libempathy-gtk/empathy-individual-view.c | 47 | ||||
-rw-r--r-- | libempathy-gtk/empathy-individual-widget.c | 37 | ||||
-rw-r--r-- | libempathy-gtk/empathy-linking-dialog.c | 10 | ||||
-rw-r--r-- | libempathy-gtk/empathy-persona-store.c | 19 | ||||
-rw-r--r-- | libempathy-gtk/empathy-ui-utils.c | 6 |
8 files changed, 108 insertions, 52 deletions
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 39dc3b34b..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_); @@ -2345,12 +2345,45 @@ individual_view_remove_activate_cb (GtkMenuItem *menuitem, { gchar *text; GtkWindow *parent; + GList *l, *personas; + guint persona_count = 0; + + personas = folks_individual_get_personas (individual); + + /* If we have more than one TpfPersona, display a different message + * ensuring the user knows that *all* of the meta-contacts' personas will + * be removed. */ + for (l = personas; l != NULL; l = l->next) + { + if (!TPF_IS_PERSONA (l->data)) + continue; + + persona_count++; + if (persona_count >= 2) + break; + } + + if (persona_count < 2) + { + /* Not a meta-contact */ + text = + g_strdup_printf ( + _("Do you really want to remove the contact '%s'?"), + folks_aliasable_get_alias (FOLKS_ALIASABLE (individual))); + } + else + { + /* Meta-contact */ + text = + g_strdup_printf ( + _("Do you really want to remove the linked contact '%s'? " + "Note that this will remove all the contacts which make up " + "this linked contact."), + folks_aliasable_get_alias (FOLKS_ALIASABLE (individual))); + } parent = empathy_get_toplevel_window (GTK_WIDGET (view)); - text = - g_strdup_printf (_ - ("Do you really want to remove the contact '%s'?"), - folks_aliasable_get_alias (FOLKS_ALIASABLE (individual))); + if (individual_view_remove_dialog_show (parent, _("Removing contact"), text)) { diff --git a/libempathy-gtk/empathy-individual-widget.c b/libempathy-gtk/empathy-individual-widget.c index 863ce021e..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))); } } @@ -1646,8 +1651,12 @@ individual_table_set_up (EmpathyIndividualWidget *self) num_personas++; } - message = g_strdup_printf (ngettext ("Meta-contact containing %u contact", - "Meta-contact containing %u contacts", num_personas), num_personas); + /* Translators: the plurality applies to both instances of the word + * "contact" */ + message = g_strdup_printf ( + ngettext ("Linked contact containing %u contact", + "Linked contacts containing %u contacts", num_personas), + num_personas); label = gtk_label_new (message); gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); g_free (message); diff --git a/libempathy-gtk/empathy-linking-dialog.c b/libempathy-gtk/empathy-linking-dialog.c index 323ec4e03..e6d408fb4 100644 --- a/libempathy-gtk/empathy-linking-dialog.c +++ b/libempathy-gtk/empathy-linking-dialog.c @@ -119,7 +119,7 @@ empathy_linking_dialog_init (EmpathyLinkingDialog *self) button = gtk_button_new_with_mnemonic ( C_("Unlink individual (button)", "_Unlinkā¦")); gtk_widget_set_tooltip_text (button, _("Completely split the displayed " - "meta-contact into the contacts it contains.")); + "linked contacts into the separate contacts.")); gtk_dialog_add_action_widget (dialog, button, RESPONSE_UNLINK); gtk_widget_show (button); @@ -179,12 +179,12 @@ linking_response_cb (EmpathyLinkingDialog *self, /* Show a confirmation dialogue first */ dialog = gtk_message_dialog_new (GTK_WINDOW (self), GTK_DIALOG_MODAL, - GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE, _("Unlink meta-contact '%s'?"), + GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE, + _("Unlink linked contacts '%s'?"), folks_aliasable_get_alias (FOLKS_ALIASABLE (individual))); gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), - _("Are you sure you want to unlink this meta-contact? This will " - "completely split the meta-contact into the contacts it " - "contains.")); + _("Are you sure you want to unlink these linked contacts? This will " + "completely split the linked contacts into separate contacts.")); gtk_dialog_add_buttons (GTK_DIALOG (dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, C_("Unlink individual (button)", "_Unlink"), GTK_RESPONSE_OK, diff --git a/libempathy-gtk/empathy-persona-store.c b/libempathy-gtk/empathy-persona-store.c index fbeeb6991..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) & @@ -532,6 +534,11 @@ individual_personas_changed_cb (GObject *object, { GList *l; + /* One of the personas' row references might hold the last reference to the + * PersonaStore, so we need to keep a reference ourselves so we don't get + * finalised. */ + g_object_ref (self); + /* Remove the old personas. */ for (l = removed; l != NULL; l = l->next) remove_persona_and_disconnect (self, FOLKS_PERSONA (l->data)); @@ -539,6 +546,8 @@ individual_personas_changed_cb (GObject *object, /* Add each of the new personas to the tree model */ for (l = added; l != NULL; l = l->next) add_persona_and_connect (self, FOLKS_PERSONA (l->data)); + + g_object_unref (self); } static gint @@ -619,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; |