diff options
author | Danielle Madeley <danielle.madeley@collabora.co.uk> | 2011-02-11 10:31:26 +0800 |
---|---|---|
committer | Chandni Verma <chandniverma2112@gmail.com> | 2011-03-08 12:04:56 +0800 |
commit | 9cf8d924a615ead7f3e74644d0b9d39532645649 (patch) | |
tree | 5937373c2c788c15ca452cdbb4c9c68d7ec746b4 /libempathy-gtk/empathy-contact-dialogs.c | |
parent | 0c363023bd77f286bc6257db3f7d90aeb4e7b0f0 (diff) | |
download | gsoc2013-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-dialogs.c')
-rw-r--r-- | libempathy-gtk/empathy-contact-dialogs.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/libempathy-gtk/empathy-contact-dialogs.c b/libempathy-gtk/empathy-contact-dialogs.c index 15f344bb8..11b608bef 100644 --- a/libempathy-gtk/empathy-contact-dialogs.c +++ b/libempathy-gtk/empathy-contact-dialogs.c @@ -17,6 +17,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * * Authors: Xavier Claessens <xclaesse@gmail.com> + * Danielle Madeley <danielle.madeley@collabora.co.uk> */ #include <config.h> @@ -487,3 +488,45 @@ empathy_new_contact_dialog_show_with_contact (GtkWindow *parent, gtk_widget_show (dialog); } +/** + * empathy_block_contact_dialog_show: + * @parent: the parent of this dialog (or %NULL) + * @contact: the contact for this dialog + * @abusive: a pointer to store the value of the abusive contact check box + * (or %NULL) + * + * Returns: %TRUE if the user wishes to block the contact + */ +gboolean +empathy_block_contact_dialog_show (GtkWindow *parent, + EmpathyContact *contact, + gboolean *abusive) +{ + GtkWidget *dialog; + int res; + + dialog = gtk_message_dialog_new (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); + + /* FIXME: support reporting abusive contacts */ + + res = gtk_dialog_run (GTK_DIALOG (dialog)); + gtk_widget_destroy (dialog); + + if (abusive != NULL) + *abusive = FALSE; + + return res == GTK_RESPONSE_REJECT; +} |