aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanielle Madeley <danielle.madeley@collabora.co.uk>2011-02-10 12:45:17 +0800
committerDanielle Madeley <danielle.madeley@collabora.co.uk>2011-02-10 12:45:17 +0800
commitbbd1ebc8ae5c785b6a4c5458155c90a05981000e (patch)
treea3c3a1923a918cade224a9b70a92256e3387cb8c
parent9b421ab4f0806be9bfb841286fa991204aaa4780 (diff)
downloadgsoc2013-empathy-bbd1ebc8ae5c785b6a4c5458155c90a05981000e.tar
gsoc2013-empathy-bbd1ebc8ae5c785b6a4c5458155c90a05981000e.tar.gz
gsoc2013-empathy-bbd1ebc8ae5c785b6a4c5458155c90a05981000e.tar.bz2
gsoc2013-empathy-bbd1ebc8ae5c785b6a4c5458155c90a05981000e.tar.lz
gsoc2013-empathy-bbd1ebc8ae5c785b6a4c5458155c90a05981000e.tar.xz
gsoc2013-empathy-bbd1ebc8ae5c785b6a4c5458155c90a05981000e.tar.zst
gsoc2013-empathy-bbd1ebc8ae5c785b6a4c5458155c90a05981000e.zip
Add Block button to the subscription authorization dialog
-rw-r--r--libempathy-gtk/empathy-contact-dialogs.c21
-rw-r--r--libempathy-gtk/empathy-contact-dialogs.ui54
2 files changed, 61 insertions, 14 deletions
diff --git a/libempathy-gtk/empathy-contact-dialogs.c b/libempathy-gtk/empathy-contact-dialogs.c
index 7aba1fd7c..b51ce18c8 100644
--- a/libempathy-gtk/empathy-contact-dialogs.c
+++ b/libempathy-gtk/empathy-contact-dialogs.c
@@ -79,9 +79,15 @@ subscription_dialog_response_cb (GtkDialog *dialog,
empathy_contact_set_alias (contact,
empathy_contact_widget_get_alias (contact_widget));
}
- else if (response == GTK_RESPONSE_NO) {
+ else if (response == GTK_RESPONSE_NO ||
+ response == GTK_RESPONSE_REJECT) {
empathy_contact_list_remove (EMPATHY_CONTACT_LIST (manager),
contact, "");
+
+ if (response == GTK_RESPONSE_REJECT) {
+ empathy_contact_list_set_blocked (
+ EMPATHY_CONTACT_LIST (manager), contact, TRUE);
+ }
}
subscription_dialogs = g_list_remove (subscription_dialogs, dialog);
@@ -97,8 +103,13 @@ empathy_subscription_dialog_show (EmpathyContact *contact,
GtkWidget *dialog;
GtkWidget *hbox_subscription;
GtkWidget *contact_widget;
+ GtkWidget *block_user_button;
GList *l;
gchar *filename;
+ EmpathyContactManager *manager;
+ EmpathyContactListFlags flags;
+
+ manager = empathy_contact_manager_dup_singleton ();
g_return_if_fail (EMPATHY_IS_CONTACT (contact));
@@ -115,6 +126,7 @@ empathy_subscription_dialog_show (EmpathyContact *contact,
gui = empathy_builder_get_file (filename,
"subscription_request_dialog", &dialog,
"hbox_subscription", &hbox_subscription,
+ "block-user-button", &block_user_button,
NULL);
g_free (filename);
g_object_unref (gui);
@@ -137,10 +149,17 @@ empathy_subscription_dialog_show (EmpathyContact *contact,
G_CALLBACK (subscription_dialog_response_cb),
contact_widget);
+ flags = empathy_contact_manager_get_flags_for_connection (manager,
+ empathy_contact_get_connection (contact));
+
+ if (flags & EMPATHY_CONTACT_LIST_CAN_BLOCK)
+ gtk_widget_show (block_user_button);
+
if (parent) {
gtk_window_set_transient_for (GTK_WINDOW (dialog), parent);
}
+ g_object_unref (manager);
gtk_widget_show (dialog);
}
diff --git a/libempathy-gtk/empathy-contact-dialogs.ui b/libempathy-gtk/empathy-contact-dialogs.ui
index 0986de1f5..ecafddb69 100644
--- a/libempathy-gtk/empathy-contact-dialogs.ui
+++ b/libempathy-gtk/empathy-contact-dialogs.ui
@@ -1,14 +1,14 @@
-<?xml version="1.0"?>
-<!--*- mode: xml -*-->
+<?xml version="1.0" encoding="UTF-8"?>
<interface>
+ <!-- interface-requires gtk+ 2.12 -->
+ <!-- interface-naming-policy toplevel-contextual -->
<object class="GtkDialog" id="subscription_request_dialog">
<property name="border_width">5</property>
<property name="title" translatable="yes">Subscription Request</property>
<property name="role">subscription_request</property>
<property name="resizable">False</property>
- <property name="window_position">GTK_WIN_POS_CENTER_ON_PARENT</property>
- <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
- <property name="has_separator">False</property>
+ <property name="window_position">center-on-parent</property>
+ <property name="type_hint">dialog</property>
<child internal-child="vbox">
<object class="GtkVBox" id="dialog-vbox4">
<property name="visible">True</property>
@@ -23,11 +23,12 @@
<property name="visible">True</property>
<property name="yalign">0</property>
<property name="stock">gtk-dialog-question</property>
- <property name="icon_size">6</property>
+ <property name="icon-size">6</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
+ <property name="position">0</property>
</packing>
</child>
<child>
@@ -41,50 +42,77 @@
<child internal-child="action_area">
<object class="GtkHButtonBox" id="dialog-action_area4">
<property name="visible">True</property>
- <property name="layout_style">GTK_BUTTONBOX_END</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="block-user-button">
+ <property name="label" translatable="yes">_Block User</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
<child>
<object class="GtkButton" id="button19">
+ <property name="label" translatable="yes">Decide _Later</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
- <property name="label" translatable="yes">Decide _Later</property>
+ <property name="receives_default">False</property>
<property name="use_underline">True</property>
</object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
</child>
<child>
<object class="GtkButton" id="button20">
+ <property name="label">gtk-no</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
- <property name="label">gtk-no</property>
+ <property name="receives_default">False</property>
<property name="use_stock">True</property>
</object>
<packing>
- <property name="position">1</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button21">
+ <property name="label">gtk-yes</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
<property name="has_default">True</property>
- <property name="label">gtk-yes</property>
+ <property name="receives_default">False</property>
<property name="use_stock">True</property>
</object>
<packing>
- <property name="position">2</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
- <property name="pack_type">GTK_PACK_END</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
</packing>
</child>
</object>
</child>
<action-widgets>
+ <action-widget response="-2">block-user-button</action-widget>
<action-widget response="-6">button19</action-widget>
<action-widget response="-9">button20</action-widget>
<action-widget response="-8">button21</action-widget>