+static void
+accounts_dialog_delete_account_response_cb (GtkDialog *message_dialog,
+ gint response_id,
+ gpointer user_data)
+{
+ EmpathyAccount *account;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ GtkTreeSelection *selection;
+ EmpathyAccountsDialog *account_dialog = EMPATHY_ACCOUNTS_DIALOG (user_data);
+ EmpathyAccountsDialogPriv *priv = GET_PRIV (account_dialog);
+
+ if (response_id == GTK_RESPONSE_YES)
+ {
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->treeview));
+
+ if (!gtk_tree_selection_get_selected (selection, &model, &iter))
+ return;
+
+ gtk_tree_model_get (model, &iter, COL_ACCOUNT_POINTER, &account, -1);
+
+ if (account != NULL)
+ {
+ g_signal_handlers_disconnect_by_func (account,
+ accounts_dialog_account_display_name_changed_cb, account_dialog);
+ empathy_account_remove_async (account, NULL, NULL);
+ g_object_unref (account);
+ account = NULL;
+ }
+
+ gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
+ accounts_dialog_model_select_first (account_dialog);
+ }
+
+ gtk_widget_destroy (GTK_WIDGET (message_dialog));
+}
+
+static void
+accounts_dialog_view_delete_activated_cb (EmpathyCellRendererActivatable *cell,
+ const gchar *path_string,
+ EmpathyAccountsDialog *dialog)
+{
+ EmpathyAccount *account;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ gchar *question_dialog_primary_text;
+ EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
+
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (priv->treeview));
+
+ if (!gtk_tree_model_get_iter_from_string (model, &iter, path_string))
+ return;
+
+ gtk_tree_model_get (model, &iter, COL_ACCOUNT_POINTER, &account, -1);
+
+ if (account == NULL || !empathy_account_is_valid (account))
+ {
+ gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
+ accounts_dialog_model_select_first (dialog);
+ return;
+ }
+
+ question_dialog_primary_text = g_strdup_printf (
+ _("You are about to remove your %s account!\n"
+ "Are you sure you want to proceed?"),
+ empathy_account_get_display_name (account));
+
+ accounts_dialog_show_question_dialog (dialog, question_dialog_primary_text,
+ _("Any associated conversations and chat rooms will NOT be "
+ "removed if you decide to proceed.\n"
+ "\n"
+ "Should you decide to add the account back at a later time, "
+ "they will still be available."),
+ G_CALLBACK (accounts_dialog_delete_account_response_cb),
+ dialog,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_NO,
+ GTK_STOCK_REMOVE, GTK_RESPONSE_YES, NULL);
+
+ g_free (question_dialog_primary_text);
+
+ if (account != NULL)
+ {
+ g_object_unref (account);
+ account = NULL;
+ }
+}
+