aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorDanielle Madeley <danielle.madeley@collabora.co.uk>2011-02-10 12:45:17 +0800
committerChandni Verma <chandniverma2112@gmail.com>2011-03-08 12:04:28 +0800
commit9968dc5978d6eb12ccc1f1cc76ca08fc0a739e85 (patch)
treef7d13b110293cc7ff036f231c5828e3fa6055d61 /libempathy-gtk
parent8e95ee8c1455390b18126d2280bcd218777379a8 (diff)
downloadgsoc2013-empathy-9968dc5978d6eb12ccc1f1cc76ca08fc0a739e85.tar
gsoc2013-empathy-9968dc5978d6eb12ccc1f1cc76ca08fc0a739e85.tar.gz
gsoc2013-empathy-9968dc5978d6eb12ccc1f1cc76ca08fc0a739e85.tar.bz2
gsoc2013-empathy-9968dc5978d6eb12ccc1f1cc76ca08fc0a739e85.tar.lz
gsoc2013-empathy-9968dc5978d6eb12ccc1f1cc76ca08fc0a739e85.tar.xz
gsoc2013-empathy-9968dc5978d6eb12ccc1f1cc76ca08fc0a739e85.tar.zst
gsoc2013-empathy-9968dc5978d6eb12ccc1f1cc76ca08fc0a739e85.zip
Add Block button to the subscription authorization dialog
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-contact-dialogs.c21
-rw-r--r--libempathy-gtk/empathy-contact-dialogs.ui53
2 files changed, 61 insertions, 13 deletions
diff --git a/libempathy-gtk/empathy-contact-dialogs.c b/libempathy-gtk/empathy-contact-dialogs.c
index fb67c41cc..15f344bb8 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);
@@ -99,8 +105,13 @@ empathy_subscription_dialog_show (EmpathyContact *contact,
GtkWidget *hbox_subscription;
GtkWidget *vbox;
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));
@@ -117,6 +128,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);
@@ -161,10 +173,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 c18bfabb4..ecafddb69 100644
--- a/libempathy-gtk/empathy-contact-dialogs.ui
+++ b/libempathy-gtk/empathy-contact-dialogs.ui
@@ -1,13 +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="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>
@@ -22,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>
@@ -40,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>