]> git.0d.be Git - empathy.git/commitdiff
Add UI to blocking confirmation dialog for future "report as abusive" function
authorDanielle Madeley <danielle.madeley@collabora.co.uk>
Fri, 11 Feb 2011 02:46:07 +0000 (13:46 +1100)
committerChandni Verma <chandniverma2112@gmail.com>
Tue, 8 Mar 2011 04:04:56 +0000 (09:34 +0530)
libempathy-gtk/empathy-contact-dialogs.c
libempathy/empathy-contact-list.h

index 11b608bef051beeed665e896d91b7137bcf5b376..8408ed6ca69109364027f195580730d9af711841 100644 (file)
@@ -502,9 +502,16 @@ empathy_block_contact_dialog_show (GtkWindow      *parent,
                                   EmpathyContact *contact,
                                   gboolean       *abusive)
 {
+       EmpathyContactManager *manager;
+       EmpathyContactListFlags flags;
        GtkWidget *dialog;
+       GtkWidget *abusive_check = NULL;
        int res;
 
+       manager = empathy_contact_manager_dup_singleton ();
+       flags = empathy_contact_manager_get_flags_for_connection (manager,
+                       empathy_contact_get_connection (contact));
+
        dialog = gtk_message_dialog_new (parent,
                        GTK_DIALOG_MODAL,
                        GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE,
@@ -520,13 +527,33 @@ empathy_block_contact_dialog_show (GtkWindow      *parent,
                        _("_Block"), GTK_RESPONSE_REJECT,
                        NULL);
 
-       /* FIXME: support reporting abusive contacts */
+       /* ask the user if they want to also report the contact as abusive */
+       if (flags & EMPATHY_CONTACT_LIST_CAN_REPORT_ABUSIVE) {
+               GtkWidget *vbox;
+
+               vbox = gtk_message_dialog_get_message_area (
+                               GTK_MESSAGE_DIALOG (dialog));
+               abusive_check = gtk_check_button_new_with_mnemonic (
+                               _("_Report this contact as abusive"));
+
+               gtk_box_pack_start (GTK_BOX (vbox), abusive_check,
+                                   FALSE, TRUE, 0);
+               gtk_widget_show (abusive_check);
+       }
 
        res = gtk_dialog_run (GTK_DIALOG (dialog));
        gtk_widget_destroy (dialog);
 
-       if (abusive != NULL)
-               *abusive = FALSE;
+       if (abusive != NULL) {
+               if (abusive_check != NULL) {
+                       *abusive = gtk_toggle_button_get_active (
+                                       GTK_TOGGLE_BUTTON (abusive_check));
+               } else {
+                       *abusive = FALSE;
+               }
+       }
+
+       g_object_unref (manager);
 
        return res == GTK_RESPONSE_REJECT;
 }
index 683974906e30226e342a8dd16a2fbe95784ce5e8..8be93baf96d9e72742454a0b00665604b4d657d1 100644 (file)
@@ -40,6 +40,7 @@ typedef enum {
        EMPATHY_CONTACT_LIST_CAN_ALIAS          = 1 << 2,
        EMPATHY_CONTACT_LIST_CAN_GROUP          = 1 << 3,
        EMPATHY_CONTACT_LIST_CAN_BLOCK          = 1 << 4,
+       EMPATHY_CONTACT_LIST_CAN_REPORT_ABUSIVE = 1 << 5,
 } EmpathyContactListFlags;
 
 typedef struct _EmpathyContactListIface EmpathyContactListIface;