aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-individual-view.c
diff options
context:
space:
mode:
authorDanielle Madeley <danielle.madeley@collabora.co.uk>2011-02-09 14:29:18 +0800
committerDanielle Madeley <danielle.madeley@collabora.co.uk>2011-02-09 14:29:18 +0800
commitbe7fff958c4327450dcc170e6387cdc2a284f065 (patch)
tree87091d4bd5242ab7829468d3d765c4dff01d2f2c /libempathy-gtk/empathy-individual-view.c
parente0bc8ed3281f53e526823affb01396546c5e36b1 (diff)
downloadgsoc2013-empathy-be7fff958c4327450dcc170e6387cdc2a284f065.tar
gsoc2013-empathy-be7fff958c4327450dcc170e6387cdc2a284f065.tar.gz
gsoc2013-empathy-be7fff958c4327450dcc170e6387cdc2a284f065.tar.bz2
gsoc2013-empathy-be7fff958c4327450dcc170e6387cdc2a284f065.tar.lz
gsoc2013-empathy-be7fff958c4327450dcc170e6387cdc2a284f065.tar.xz
gsoc2013-empathy-be7fff958c4327450dcc170e6387cdc2a284f065.tar.zst
gsoc2013-empathy-be7fff958c4327450dcc170e6387cdc2a284f065.zip
Add 'Delete and Block' as an option to the Remove Contact dialog
Diffstat (limited to 'libempathy-gtk/empathy-individual-view.c')
-rw-r--r--libempathy-gtk/empathy-individual-view.c38
1 files changed, 26 insertions, 12 deletions
diff --git a/libempathy-gtk/empathy-individual-view.c b/libempathy-gtk/empathy-individual-view.c
index 06a06bcc9..8da849503 100644
--- a/libempathy-gtk/empathy-individual-view.c
+++ b/libempathy-gtk/empathy-individual-view.c
@@ -2207,16 +2207,22 @@ empathy_individual_view_get_selected_group (EmpathyIndividualView *view,
return name;
}
-static gboolean
+static int
individual_view_remove_dialog_show (GtkWindow *parent,
const gchar *message,
- const gchar *secondary_text)
+ const gchar *secondary_text,
+ gboolean block_button)
{
GtkWidget *dialog;
gboolean res;
dialog = gtk_message_dialog_new (parent, GTK_DIALOG_MODAL,
GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, "%s", message);
+
+ if (block_button)
+ gtk_dialog_add_button (GTK_DIALOG (dialog),
+ _("Delete and Block"), GTK_RESPONSE_REJECT);
+
gtk_dialog_add_buttons (GTK_DIALOG (dialog),
GTK_STOCK_CANCEL, GTK_RESPONSE_NO,
GTK_STOCK_DELETE, GTK_RESPONSE_YES, NULL);
@@ -2228,7 +2234,7 @@ individual_view_remove_dialog_show (GtkWindow *parent,
res = gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_destroy (dialog);
- return (res == GTK_RESPONSE_YES);
+ return res;
}
static void
@@ -2248,7 +2254,7 @@ individual_view_group_remove_activate_cb (GtkMenuItem *menuitem,
group);
parent = empathy_get_toplevel_window (GTK_WIDGET (view));
if (individual_view_remove_dialog_show (parent, _("Removing group"),
- text))
+ text, FALSE) == GTK_RESPONSE_YES)
{
EmpathyIndividualManager *manager =
empathy_individual_manager_dup_singleton ();
@@ -2327,26 +2333,34 @@ individual_view_remove_activate_cb (GtkMenuItem *menuitem,
if (individual != NULL)
{
+ EmpathyIndividualManager *manager;
gchar *text;
GtkWindow *parent;
+ gboolean can_block;
+ int res;
+
+ manager = empathy_individual_manager_dup_singleton ();
+ can_block = empathy_individual_manager_supports_blocking (manager,
+ individual);
parent = empathy_get_toplevel_window (GTK_WIDGET (view));
text =
- g_strdup_printf (_
- ("Do you really want to remove the contact '%s'?"),
+ 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))
+ res = individual_view_remove_dialog_show (parent, _("Removing contact"),
+ text, can_block);
+ if (res == GTK_RESPONSE_YES || res == GTK_RESPONSE_REJECT)
{
- EmpathyIndividualManager *manager;
-
- manager = empathy_individual_manager_dup_singleton ();
empathy_individual_manager_remove (manager, individual, "");
- g_object_unref (G_OBJECT (manager));
+
+ if (res == GTK_RESPONSE_REJECT)
+ empathy_individual_manager_set_blocked (manager, individual, TRUE);
}
g_free (text);
g_object_unref (individual);
+ g_object_unref (manager);
}
}