aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-06-29 20:25:39 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-07-06 17:31:00 +0800
commit7615fb3d04356ebb2155a8e335db6eb995dac66d (patch)
treeb35531178c28877f5e20d560d75a1c856374df92
parent001cd2ec66845de212ecb58c71a8f38e68834bfe (diff)
downloadgsoc2013-empathy-7615fb3d04356ebb2155a8e335db6eb995dac66d.tar
gsoc2013-empathy-7615fb3d04356ebb2155a8e335db6eb995dac66d.tar.gz
gsoc2013-empathy-7615fb3d04356ebb2155a8e335db6eb995dac66d.tar.bz2
gsoc2013-empathy-7615fb3d04356ebb2155a8e335db6eb995dac66d.tar.lz
gsoc2013-empathy-7615fb3d04356ebb2155a8e335db6eb995dac66d.tar.xz
gsoc2013-empathy-7615fb3d04356ebb2155a8e335db6eb995dac66d.tar.zst
gsoc2013-empathy-7615fb3d04356ebb2155a8e335db6eb995dac66d.zip
inline block_contact_dialog_show() into subscription-dialog.c
It's only used there now. https://bugzilla.gnome.org/show_bug.cgi?id=679136
-rw-r--r--libempathy-gtk/empathy-contact-dialogs.c73
-rw-r--r--libempathy-gtk/empathy-contact-dialogs.h4
-rw-r--r--libempathy-gtk/empathy-subscription-dialog.c74
3 files changed, 73 insertions, 78 deletions
diff --git a/libempathy-gtk/empathy-contact-dialogs.c b/libempathy-gtk/empathy-contact-dialogs.c
index 1e9f13175..5f885e854 100644
--- a/libempathy-gtk/empathy-contact-dialogs.c
+++ b/libempathy-gtk/empathy-contact-dialogs.c
@@ -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;
-}
diff --git a/libempathy-gtk/empathy-contact-dialogs.h b/libempathy-gtk/empathy-contact-dialogs.h
index 82d21639b..9938fd86f 100644
--- a/libempathy-gtk/empathy-contact-dialogs.h
+++ b/libempathy-gtk/empathy-contact-dialogs.h
@@ -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
diff --git a/libempathy-gtk/empathy-subscription-dialog.c b/libempathy-gtk/empathy-subscription-dialog.c
index 2e65685ed..73e823c45 100644
--- a/libempathy-gtk/empathy-subscription-dialog.c
+++ b/libempathy-gtk/empathy-subscription-dialog.c
@@ -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;