static void contact_list_view_remove_activate_cb (GtkMenuItem *menuitem, EmpathyContactListView *view) { EmpathyContactListViewPriv *priv = GET_PRIV (view); EmpathyContact *contact; contact = empathy_contact_list_view_get_selected (view); if (contact) { gchar *text; GtkWindow *parent; parent = empathy_get_toplevel_window (GTK_WIDGET (view)); text = g_strdup_printf (_("Do you really want to remove the contact '%s'?"), empathy_contact_get_name (contact)); if (contact_list_view_remove_dialog_show (parent, _("Removing contact"), text)) { EmpathyContactList *list; list = empathy_contact_list_store_get_list_iface (priv->store); empathy_contact_list_remove (list, contact, _("Sorry, I don't want you in my contact list anymore.")); } g_free (text); g_object_unref (contact); } }
static void contact_manager_remove (EmpathyContactList *manager, EmpathyContact *contact, const gchar *message) { EmpathyContactManagerPriv *priv = GET_PRIV (manager); EmpathyContactList *list; TpConnection *connection; g_return_if_fail (EMPATHY_IS_CONTACT_MANAGER (manager)); connection = empathy_contact_get_connection (contact); list = g_hash_table_lookup (priv->lists, connection); if (list) { empathy_contact_list_remove (list, contact, message); } }
static void subscription_dialog_response_cb (GtkDialog *dialog, gint response, GtkWidget *contact_widget) { EmpathyContactManager *manager; EmpathyContact *contact; manager = empathy_contact_manager_dup_singleton (); contact = empathy_contact_widget_get_contact (contact_widget); if (response == GTK_RESPONSE_YES) { empathy_contact_list_add (EMPATHY_CONTACT_LIST (manager), contact, ""); } else if (response == GTK_RESPONSE_NO) { empathy_contact_list_remove (EMPATHY_CONTACT_LIST (manager), contact, ""); } subscription_dialogs = g_list_remove (subscription_dialogs, dialog); gtk_widget_destroy (GTK_WIDGET (dialog)); g_object_unref (manager); }