aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-contact-menu.c
diff options
context:
space:
mode:
authorDanielle Madeley <danielle.madeley@collabora.co.uk>2011-02-11 10:31:26 +0800
committerChandni Verma <chandniverma2112@gmail.com>2011-03-08 12:04:56 +0800
commit9cf8d924a615ead7f3e74644d0b9d39532645649 (patch)
tree5937373c2c788c15ca452cdbb4c9c68d7ec746b4 /libempathy-gtk/empathy-contact-menu.c
parent0c363023bd77f286bc6257db3f7d90aeb4e7b0f0 (diff)
downloadgsoc2013-empathy-9cf8d924a615ead7f3e74644d0b9d39532645649.tar
gsoc2013-empathy-9cf8d924a615ead7f3e74644d0b9d39532645649.tar.gz
gsoc2013-empathy-9cf8d924a615ead7f3e74644d0b9d39532645649.tar.bz2
gsoc2013-empathy-9cf8d924a615ead7f3e74644d0b9d39532645649.tar.lz
gsoc2013-empathy-9cf8d924a615ead7f3e74644d0b9d39532645649.tar.xz
gsoc2013-empathy-9cf8d924a615ead7f3e74644d0b9d39532645649.tar.zst
gsoc2013-empathy-9cf8d924a615ead7f3e74644d0b9d39532645649.zip
Factor out common blocking confirmation dialog
Diffstat (limited to 'libempathy-gtk/empathy-contact-menu.c')
-rw-r--r--libempathy-gtk/empathy-contact-menu.c33
1 files changed, 7 insertions, 26 deletions
diff --git a/libempathy-gtk/empathy-contact-menu.c b/libempathy-gtk/empathy-contact-menu.c
index e03444ac9..64825b43c 100644
--- a/libempathy-gtk/empathy-contact-menu.c
+++ b/libempathy-gtk/empathy-contact-menu.c
@@ -239,51 +239,32 @@ empathy_contact_block_menu_item_toggled (GtkCheckMenuItem *item,
if (block_signal > 0)
return;
- manager = empathy_contact_manager_dup_singleton ();
blocked = gtk_check_menu_item_get_active (item);
if (blocked) {
/* confirm the user really wishes to block the contact */
- int res;
- GtkWidget *parent, *dialog;
+ GtkWidget *parent;
/* gtk_menu_get_attach_widget() doesn't behave properly here
* for some reason */
parent = g_object_get_data (
G_OBJECT (gtk_widget_get_parent (GTK_WIDGET (item))),
"window");
- dialog = gtk_message_dialog_new (GTK_WINDOW (parent),
- GTK_DIALOG_MODAL,
- GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE,
- _("Block %s?"),
- empathy_contact_get_id (contact));
-
- gtk_message_dialog_format_secondary_text (
- GTK_MESSAGE_DIALOG (dialog),
- _("Are you sure you want to block the contact %s?"),
- empathy_contact_get_id (contact));
- gtk_dialog_add_buttons (GTK_DIALOG (dialog),
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- _("Block"), GTK_RESPONSE_REJECT,
- NULL);
-
- res = gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
-
- if (res != GTK_RESPONSE_REJECT)
- goto finally;
+
+ if (!empathy_block_contact_dialog_show (GTK_WINDOW (parent),
+ contact, NULL))
+ return;
}
+ manager = empathy_contact_manager_dup_singleton ();
empathy_contact_list_set_blocked (EMPATHY_CONTACT_LIST (manager),
contact, blocked);
+ g_object_unref (manager);
/* update the toggle with the blocked status */
block_signal++;
gtk_check_menu_item_set_active (item, blocked);
block_signal--;
-
-finally:
- g_object_unref (manager);
}
static GtkWidget *