]> git.0d.be Git - empathy.git/commitdiff
inline block_contact_dialog_show() into subscription-dialog.c
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Fri, 29 Jun 2012 12:25:39 +0000 (14:25 +0200)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Fri, 6 Jul 2012 09:31:00 +0000 (11:31 +0200)
It's only used there now.

https://bugzilla.gnome.org/show_bug.cgi?id=679136

libempathy-gtk/empathy-contact-dialogs.c
libempathy-gtk/empathy-contact-dialogs.h
libempathy-gtk/empathy-subscription-dialog.c

index 1e9f1317594f781046ba7173b7bee976ff12df3d..5f885e8545a60e833a883392bc27bfd36adc206e 100644 (file)
@@ -232,76 +232,3 @@ 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,
-                                  GdkPixbuf      *avatar,
-                                  gboolean       *abusive)
-{
-       GtkWidget *dialog;
-       GtkWidget *abusive_check = NULL;
-       int res;
-       TpConnection *conn;
-
-       dialog = gtk_message_dialog_new (parent,
-                       GTK_DIALOG_MODAL,
-                       GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE,
-                       _("Block %s?"),
-                       empathy_contact_get_alias (contact));
-
-       gtk_message_dialog_format_secondary_text (
-                       GTK_MESSAGE_DIALOG (dialog),
-                       _("Are you sure you want to block '%s' from "
-                         "contacting you again?"),
-                       empathy_contact_get_alias (contact));
-       gtk_dialog_add_buttons (GTK_DIALOG (dialog),
-                       GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-                       _("_Block"), GTK_RESPONSE_REJECT,
-                       NULL);
-
-       if (avatar != NULL) {
-               GtkWidget *image = gtk_image_new_from_pixbuf (avatar);
-               gtk_message_dialog_set_image (GTK_MESSAGE_DIALOG (dialog), image);
-               gtk_widget_show (image);
-       }
-
-       conn = empathy_contact_get_connection (contact);
-
-       /* ask the user if they want to also report the contact as abusive */
-       if (tp_connection_can_report_abusive (conn)) {
-               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));
-       if (abusive != NULL) {
-               if (abusive_check != NULL) {
-                       *abusive = gtk_toggle_button_get_active (
-                                       GTK_TOGGLE_BUTTON (abusive_check));
-               } else {
-                       *abusive = FALSE;
-               }
-       }
-
-       gtk_widget_destroy (dialog);
-
-       return res == GTK_RESPONSE_REJECT;
-}
index 82d21639b6b9a4b88f5e06bfae364a92b60c5ddf..9938fd86f3f9f5602f1c5d920d753ee94ae4c422 100644 (file)
@@ -33,10 +33,6 @@ void empathy_contact_information_dialog_show (EmpathyContact *contact,
 void empathy_new_contact_dialog_show         (GtkWindow     *parent);
 void empathy_new_contact_dialog_show_with_contact (GtkWindow     *parent,
                                                    EmpathyContact *contact);
-gboolean empathy_block_contact_dialog_show (GtkWindow      *parent,
-                                           EmpathyContact *contact,
-                                           GdkPixbuf      *avatar,
-                                           gboolean       *abusive);
 
 G_END_DECLS
 
index 2e65685edd5d937acb8ac1eae200a206a469f5a0..73e823c453c1cac8eed277775a63e1f421f74e60 100644 (file)
@@ -98,6 +98,78 @@ empathy_subscription_dialog_set_property (GObject *object,
     }
 }
 
+/**
+ * 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
+ */
+static gboolean
+block_contact_dialog_show (GtkWindow *parent,
+    EmpathyContact *contact,
+    GdkPixbuf *avatar,
+    gboolean *abusive)
+{
+  GtkWidget *dialog;
+  GtkWidget *abusive_check = NULL;
+  int res;
+  TpConnection *conn;
+
+  dialog = gtk_message_dialog_new (parent, GTK_DIALOG_MODAL,
+      GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE, _("Block %s?"),
+      empathy_contact_get_alias (contact));
+
+  gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+      _("Are you sure you want to block '%s' from contacting you again?"),
+      empathy_contact_get_alias (contact));
+
+  gtk_dialog_add_buttons (GTK_DIALOG (dialog),
+      GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+      _("_Block"), GTK_RESPONSE_REJECT,
+      NULL);
+
+  if (avatar != NULL)
+    {
+      GtkWidget *image = gtk_image_new_from_pixbuf (avatar);
+      gtk_message_dialog_set_image (GTK_MESSAGE_DIALOG (dialog), image);
+      gtk_widget_show (image);
+    }
+
+  conn = empathy_contact_get_connection (contact);
+
+  /* ask the user if they want to also report the contact as abusive */
+  if (tp_connection_can_report_abusive (conn))
+    {
+      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));
+  if (abusive != NULL)
+    {
+      if (abusive_check != NULL)
+        *abusive = gtk_toggle_button_get_active (
+            GTK_TOGGLE_BUTTON (abusive_check));
+      else
+        *abusive = FALSE;
+    }
+
+  gtk_widget_destroy (dialog);
+
+  return res == GTK_RESPONSE_REJECT;
+}
+
 static void
 response_cb (GtkDialog *dialog,
     gint reponse,
@@ -120,7 +192,7 @@ response_cb (GtkDialog *dialog,
       gboolean abusive;
 
       /* confirm the blocking */
-      if (empathy_block_contact_dialog_show (GTK_WINDOW (dialog), contact,
+      if (block_contact_dialog_show (GTK_WINDOW (dialog), contact,
             NULL, &abusive))
         {
           TpContact *tp_contact;