Philipp Hörist pushed to branch master at gajim / gajim
Commits:
-
e83a2467
by Daniel Brötzmann at 2019-04-02T17:49:57Z
5 changed files:
- gajim/data/gui/subscription_request_window.ui
- gajim/dialogs.py
- + gajim/gtk/subscription_request.py
- gajim/gui_interface.py
- gajim/roster_window.py
Changes:
| 1 | 1 |
<?xml version="1.0" encoding="UTF-8"?>
|
| 2 |
-<!-- Generated with glade 3.20.1 -->
|
|
| 2 |
+<!-- Generated with glade 3.22.1 -->
|
|
| 3 | 3 |
<interface>
|
| 4 |
- <requires lib="gtk+" version="3.12"/>
|
|
| 5 |
- <object class="GtkMenu" id="subscription_request_popup_menu">
|
|
| 4 |
+ <requires lib="gtk+" version="3.20"/>
|
|
| 5 |
+ <object class="GtkImage" id="image1">
|
|
| 6 | 6 |
<property name="visible">True</property>
|
| 7 | 7 |
<property name="can_focus">False</property>
|
| 8 |
- <child>
|
|
| 9 |
- <object class="GtkMenuItem" id="start_chat_menuitem">
|
|
| 10 |
- <property name="visible">True</property>
|
|
| 11 |
- <property name="can_focus">False</property>
|
|
| 12 |
- <property name="label" translatable="yes">_Start Chat</property>
|
|
| 13 |
- <property name="use_underline">True</property>
|
|
| 14 |
- <signal name="activate" handler="on_start_chat_activate" swapped="no"/>
|
|
| 15 |
- </object>
|
|
| 16 |
- </child>
|
|
| 17 |
- <child>
|
|
| 18 |
- <object class="GtkMenuItem" id="information_menuitem">
|
|
| 19 |
- <property name="visible">True</property>
|
|
| 20 |
- <property name="can_focus">False</property>
|
|
| 21 |
- <property name="label">_Information</property>
|
|
| 22 |
- <property name="use_underline">True</property>
|
|
| 23 |
- <signal name="activate" handler="on_contact_info_activate" swapped="no"/>
|
|
| 24 |
- </object>
|
|
| 25 |
- </child>
|
|
| 8 |
+ <property name="icon_name">user-available-symbolic</property>
|
|
| 9 |
+ </object>
|
|
| 10 |
+ <object class="GtkImage" id="image2">
|
|
| 11 |
+ <property name="visible">True</property>
|
|
| 12 |
+ <property name="can_focus">False</property>
|
|
| 13 |
+ <property name="icon_name">user-info-symbolic</property>
|
|
| 26 | 14 |
</object>
|
| 27 | 15 |
<object class="GtkBox" id="subscription_box">
|
| 28 | 16 |
<property name="visible">True</property>
|
| 29 | 17 |
<property name="can_focus">False</property>
|
| 30 |
- <property name="margin_left">18</property>
|
|
| 31 |
- <property name="margin_right">18</property>
|
|
| 32 |
- <property name="margin_top">18</property>
|
|
| 33 |
- <property name="margin_bottom">18</property>
|
|
| 18 |
+ <property name="halign">start</property>
|
|
| 19 |
+ <property name="border_width">18</property>
|
|
| 34 | 20 |
<property name="orientation">vertical</property>
|
| 35 |
- <property name="spacing">5</property>
|
|
| 21 |
+ <property name="spacing">6</property>
|
|
| 36 | 22 |
<child>
|
| 37 |
- <object class="GtkLabel" id="from_label">
|
|
| 23 |
+ <object class="GtkGrid">
|
|
| 38 | 24 |
<property name="visible">True</property>
|
| 39 | 25 |
<property name="can_focus">False</property>
|
| 26 |
+ <property name="row_spacing">6</property>
|
|
| 27 |
+ <property name="column_spacing">12</property>
|
|
| 28 |
+ <child>
|
|
| 29 |
+ <object class="GtkLabel" id="jid_label">
|
|
| 30 |
+ <property name="visible">True</property>
|
|
| 31 |
+ <property name="can_focus">False</property>
|
|
| 32 |
+ <property name="halign">start</property>
|
|
| 33 |
+ <property name="label"><XMPP address></property>
|
|
| 34 |
+ <property name="xalign">0</property>
|
|
| 35 |
+ <style>
|
|
| 36 |
+ <class name="large-header"/>
|
|
| 37 |
+ </style>
|
|
| 38 |
+ </object>
|
|
| 39 |
+ <packing>
|
|
| 40 |
+ <property name="left_attach">1</property>
|
|
| 41 |
+ <property name="top_attach">0</property>
|
|
| 42 |
+ </packing>
|
|
| 43 |
+ </child>
|
|
| 44 |
+ <child>
|
|
| 45 |
+ <object class="GtkLabel" id="request_label">
|
|
| 46 |
+ <property name="visible">True</property>
|
|
| 47 |
+ <property name="can_focus">False</property>
|
|
| 48 |
+ <property name="halign">start</property>
|
|
| 49 |
+ <property name="label"><subscription request></property>
|
|
| 50 |
+ <property name="wrap">True</property>
|
|
| 51 |
+ <property name="xalign">0</property>
|
|
| 52 |
+ <style>
|
|
| 53 |
+ <class name="dim-label"/>
|
|
| 54 |
+ </style>
|
|
| 55 |
+ </object>
|
|
| 56 |
+ <packing>
|
|
| 57 |
+ <property name="left_attach">1</property>
|
|
| 58 |
+ <property name="top_attach">1</property>
|
|
| 59 |
+ </packing>
|
|
| 60 |
+ </child>
|
|
| 61 |
+ <child>
|
|
| 62 |
+ <object class="GtkLabel" id="subscription_text">
|
|
| 63 |
+ <property name="visible">True</property>
|
|
| 64 |
+ <property name="can_focus">False</property>
|
|
| 65 |
+ <property name="halign">start</property>
|
|
| 66 |
+ <property name="margin_top">6</property>
|
|
| 67 |
+ <property name="label"><subscription text>
|
|
| 68 |
+</property>
|
|
| 69 |
+ <property name="wrap">True</property>
|
|
| 70 |
+ <property name="xalign">0</property>
|
|
| 71 |
+ <property name="yalign">0</property>
|
|
| 72 |
+ <attributes>
|
|
| 73 |
+ <attribute name="style" value="italic"/>
|
|
| 74 |
+ </attributes>
|
|
| 75 |
+ </object>
|
|
| 76 |
+ <packing>
|
|
| 77 |
+ <property name="left_attach">1</property>
|
|
| 78 |
+ <property name="top_attach">2</property>
|
|
| 79 |
+ </packing>
|
|
| 80 |
+ </child>
|
|
| 81 |
+ <child>
|
|
| 82 |
+ <object class="GtkButton" id="contact_info_button">
|
|
| 83 |
+ <property name="visible">True</property>
|
|
| 84 |
+ <property name="can_focus">True</property>
|
|
| 85 |
+ <property name="receives_default">True</property>
|
|
| 86 |
+ <property name="tooltip_text" translatable="yes">Contact Information</property>
|
|
| 87 |
+ <property name="valign">center</property>
|
|
| 88 |
+ <property name="image">image2</property>
|
|
| 89 |
+ <signal name="clicked" handler="on_contact_info_button_clicked" swapped="no"/>
|
|
| 90 |
+ </object>
|
|
| 91 |
+ <packing>
|
|
| 92 |
+ <property name="left_attach">0</property>
|
|
| 93 |
+ <property name="top_attach">0</property>
|
|
| 94 |
+ </packing>
|
|
| 95 |
+ </child>
|
|
| 96 |
+ <child>
|
|
| 97 |
+ <object class="GtkButton" id="start_chat_button">
|
|
| 98 |
+ <property name="visible">True</property>
|
|
| 99 |
+ <property name="can_focus">True</property>
|
|
| 100 |
+ <property name="receives_default">True</property>
|
|
| 101 |
+ <property name="tooltip_text" translatable="yes">Start Chat</property>
|
|
| 102 |
+ <property name="valign">center</property>
|
|
| 103 |
+ <property name="image">image1</property>
|
|
| 104 |
+ <signal name="clicked" handler="on_start_chat_button_clicked" swapped="no"/>
|
|
| 105 |
+ </object>
|
|
| 106 |
+ <packing>
|
|
| 107 |
+ <property name="left_attach">0</property>
|
|
| 108 |
+ <property name="top_attach">2</property>
|
|
| 109 |
+ </packing>
|
|
| 110 |
+ </child>
|
|
| 111 |
+ <child>
|
|
| 112 |
+ <placeholder/>
|
|
| 113 |
+ </child>
|
|
| 40 | 114 |
</object>
|
| 41 | 115 |
<packing>
|
| 42 | 116 |
<property name="expand">False</property>
|
| 43 |
- <property name="fill">False</property>
|
|
| 117 |
+ <property name="fill">True</property>
|
|
| 44 | 118 |
<property name="position">0</property>
|
| 45 | 119 |
</packing>
|
| 46 | 120 |
</child>
|
| 47 | 121 |
<child>
|
| 48 |
- <object class="GtkScrolledWindow" id="scrolledwindow8">
|
|
| 49 |
- <property name="height_request">100</property>
|
|
| 122 |
+ <object class="GtkSeparator">
|
|
| 50 | 123 |
<property name="visible">True</property>
|
| 51 |
- <property name="can_focus">True</property>
|
|
| 52 |
- <property name="border_width">5</property>
|
|
| 53 |
- <property name="shadow_type">in</property>
|
|
| 54 |
- <child>
|
|
| 55 |
- <object class="GtkTextView" id="message_textview">
|
|
| 56 |
- <property name="visible">True</property>
|
|
| 57 |
- <property name="can_focus">True</property>
|
|
| 58 |
- <property name="editable">False</property>
|
|
| 59 |
- <property name="wrap_mode">word</property>
|
|
| 60 |
- <property name="cursor_visible">False</property>
|
|
| 61 |
- </object>
|
|
| 62 |
- </child>
|
|
| 124 |
+ <property name="can_focus">False</property>
|
|
| 125 |
+ <property name="margin_top">12</property>
|
|
| 63 | 126 |
</object>
|
| 64 | 127 |
<packing>
|
| 65 |
- <property name="expand">True</property>
|
|
| 128 |
+ <property name="expand">False</property>
|
|
| 66 | 129 |
<property name="fill">True</property>
|
| 67 |
- <property name="position">1</property>
|
|
| 130 |
+ <property name="position">2</property>
|
|
| 68 | 131 |
</packing>
|
| 69 | 132 |
</child>
|
| 70 | 133 |
<child>
|
| 71 |
- <object class="GtkButtonBox" id="hbuttonbox3">
|
|
| 134 |
+ <object class="GtkBox">
|
|
| 72 | 135 |
<property name="visible">True</property>
|
| 73 | 136 |
<property name="can_focus">False</property>
|
| 74 |
- <property name="border_width">5</property>
|
|
| 137 |
+ <property name="halign">baseline</property>
|
|
| 138 |
+ <property name="margin_top">12</property>
|
|
| 75 | 139 |
<property name="spacing">12</property>
|
| 76 |
- <property name="layout_style">end</property>
|
|
| 77 |
- <child>
|
|
| 78 |
- <object class="GtkButton" id="close_button">
|
|
| 79 |
- <property name="label">_Close</property>
|
|
| 80 |
- <property name="visible">True</property>
|
|
| 81 |
- <property name="can_focus">True</property>
|
|
| 82 |
- <property name="can_default">True</property>
|
|
| 83 |
- <property name="receives_default">False</property>
|
|
| 84 |
- <property name="use_underline">True</property>
|
|
| 85 |
- <signal name="clicked" handler="on_close_button_clicked" swapped="no"/>
|
|
| 86 |
- </object>
|
|
| 87 |
- <packing>
|
|
| 88 |
- <property name="expand">False</property>
|
|
| 89 |
- <property name="fill">False</property>
|
|
| 90 |
- <property name="position">0</property>
|
|
| 91 |
- </packing>
|
|
| 92 |
- </child>
|
|
| 140 |
+ <property name="homogeneous">True</property>
|
|
| 93 | 141 |
<child>
|
| 94 | 142 |
<object class="GtkButton" id="deny_button">
|
| 95 | 143 |
<property name="label" translatable="yes">_Deny</property>
|
| ... | ... | @@ -97,59 +145,45 @@ |
| 97 | 145 |
<property name="can_focus">True</property>
|
| 98 | 146 |
<property name="can_default">True</property>
|
| 99 | 147 |
<property name="receives_default">False</property>
|
| 100 |
- <property name="tooltip_text" translatable="yes">Deny authorization from contact so he or she cannot know when you're connected</property>
|
|
| 148 |
+ <property name="tooltip_text" translatable="yes">Deny authorization from contact so the contact cannot know if you are connected</property>
|
|
| 101 | 149 |
<property name="use_underline">True</property>
|
| 102 | 150 |
<signal name="clicked" handler="on_deny_button_clicked" swapped="no"/>
|
| 151 |
+ <style>
|
|
| 152 |
+ <class name="destructive-action"/>
|
|
| 153 |
+ </style>
|
|
| 103 | 154 |
</object>
|
| 104 | 155 |
<packing>
|
| 105 | 156 |
<property name="expand">False</property>
|
| 106 |
- <property name="fill">False</property>
|
|
| 107 |
- <property name="position">1</property>
|
|
| 108 |
- </packing>
|
|
| 109 |
- </child>
|
|
| 110 |
- <child>
|
|
| 111 |
- <object class="GtkMenuButton">
|
|
| 112 |
- <property name="visible">True</property>
|
|
| 113 |
- <property name="can_focus">True</property>
|
|
| 114 |
- <property name="receives_default">True</property>
|
|
| 115 |
- <property name="popup">subscription_request_popup_menu</property>
|
|
| 116 |
- <property name="use_popover">False</property>
|
|
| 117 |
- <child>
|
|
| 118 |
- <object class="GtkImage">
|
|
| 119 |
- <property name="visible">True</property>
|
|
| 120 |
- <property name="can_focus">False</property>
|
|
| 121 |
- <property name="icon_name">applications-system-symbolic</property>
|
|
| 122 |
- </object>
|
|
| 123 |
- </child>
|
|
| 124 |
- </object>
|
|
| 125 |
- <packing>
|
|
| 126 |
- <property name="expand">True</property>
|
|
| 127 | 157 |
<property name="fill">True</property>
|
| 128 |
- <property name="position">2</property>
|
|
| 158 |
+ <property name="position">0</property>
|
|
| 129 | 159 |
</packing>
|
| 130 | 160 |
</child>
|
| 131 | 161 |
<child>
|
| 132 | 162 |
<object class="GtkButton" id="authorize_button">
|
| 133 |
- <property name="label" translatable="yes">Au_thorize</property>
|
|
| 163 |
+ <property name="label" translatable="yes">Ac_cept</property>
|
|
| 134 | 164 |
<property name="visible">True</property>
|
| 135 | 165 |
<property name="can_focus">True</property>
|
| 136 | 166 |
<property name="can_default">True</property>
|
| 167 |
+ <property name="has_default">True</property>
|
|
| 137 | 168 |
<property name="receives_default">False</property>
|
| 138 |
- <property name="tooltip_text" translatable="yes">Authorize contact so he or she can know when you're connected</property>
|
|
| 169 |
+ <property name="tooltip_text" translatable="yes">Authorize contact so the contact can know if you are connected</property>
|
|
| 139 | 170 |
<property name="use_underline">True</property>
|
| 140 | 171 |
<signal name="clicked" handler="on_authorize_button_clicked" swapped="no"/>
|
| 172 |
+ <style>
|
|
| 173 |
+ <class name="suggested-action"/>
|
|
| 174 |
+ </style>
|
|
| 141 | 175 |
</object>
|
| 142 | 176 |
<packing>
|
| 143 | 177 |
<property name="expand">False</property>
|
| 144 |
- <property name="fill">False</property>
|
|
| 145 |
- <property name="position">3</property>
|
|
| 178 |
+ <property name="fill">True</property>
|
|
| 179 |
+ <property name="position">1</property>
|
|
| 146 | 180 |
</packing>
|
| 147 | 181 |
</child>
|
| 148 | 182 |
</object>
|
| 149 | 183 |
<packing>
|
| 150 | 184 |
<property name="expand">False</property>
|
| 151 |
- <property name="fill">False</property>
|
|
| 152 |
- <property name="position">2</property>
|
|
| 185 |
+ <property name="fill">True</property>
|
|
| 186 |
+ <property name="position">3</property>
|
|
| 153 | 187 |
</packing>
|
| 154 | 188 |
</child>
|
| 155 | 189 |
</object>
|
| ... | ... | @@ -37,7 +37,6 @@ from gi.repository import Gtk |
| 37 | 37 |
from gi.repository import Gdk
|
| 38 | 38 |
from gi.repository import GLib
|
| 39 | 39 |
|
| 40 |
-from gajim import vcard
|
|
| 41 | 40 |
from gajim import dataforms_widget
|
| 42 | 41 |
|
| 43 | 42 |
from gajim.common import ged
|
| ... | ... | @@ -53,7 +52,6 @@ from gajim.common.exceptions import GajimGeneralException |
| 53 | 52 |
|
| 54 | 53 |
# Compat with Gajim 1.0.3 for plugins
|
| 55 | 54 |
from gajim.gtk.dialogs import *
|
| 56 |
-from gajim.gtk.add_contact import AddNewContactWindow
|
|
| 57 | 55 |
from gajim.gtk.util import get_icon_name
|
| 58 | 56 |
from gajim.gtk.util import resize_window
|
| 59 | 57 |
from gajim.gtk.util import get_builder
|
| ... | ... | @@ -842,89 +840,6 @@ class ChangeStatusMessageDialog(TimeoutDialog): |
| 842 | 840 |
self.pep_dict['mood_text'])
|
| 843 | 841 |
|
| 844 | 842 |
|
| 845 |
-class SubscriptionRequestWindow(Gtk.ApplicationWindow):
|
|
| 846 |
- def __init__(self, jid, text, account, user_nick=None):
|
|
| 847 |
- Gtk.ApplicationWindow.__init__(self)
|
|
| 848 |
- self.set_name('SubscriptionRequest')
|
|
| 849 |
- self.set_application(app.app)
|
|
| 850 |
- self.set_show_menubar(False)
|
|
| 851 |
- self.set_resizable(False)
|
|
| 852 |
- self.set_position(Gtk.WindowPosition.CENTER)
|
|
| 853 |
- self.set_title(_('Subscription Request'))
|
|
| 854 |
- |
|
| 855 |
- xml = get_builder('subscription_request_window.ui')
|
|
| 856 |
- self.add(xml.get_object('subscription_box'))
|
|
| 857 |
- self.jid = jid
|
|
| 858 |
- self.account = account
|
|
| 859 |
- self.user_nick = user_nick
|
|
| 860 |
- if len(app.connections) >= 2:
|
|
| 861 |
- prompt_text = \
|
|
| 862 |
- _('Subscription request for account %(account)s from %(jid)s')\
|
|
| 863 |
- % {'account': account, 'jid': self.jid}
|
|
| 864 |
- else:
|
|
| 865 |
- prompt_text = _('Subscription request from %s') % self.jid
|
|
| 866 |
- |
|
| 867 |
- from_label = xml.get_object('from_label')
|
|
| 868 |
- from_label.set_text(prompt_text)
|
|
| 869 |
- |
|
| 870 |
- textview = xml.get_object('message_textview')
|
|
| 871 |
- textview.get_buffer().set_text(text)
|
|
| 872 |
- |
|
| 873 |
- self.set_default(xml.get_object('authorize_button'))
|
|
| 874 |
- xml.connect_signals(self)
|
|
| 875 |
- self.show_all()
|
|
| 876 |
- |
|
| 877 |
- def on_subscription_request_window_destroy(self, widget):
|
|
| 878 |
- """
|
|
| 879 |
- Close window
|
|
| 880 |
- """
|
|
| 881 |
- if self.jid in app.interface.instances[self.account]['sub_request']:
|
|
| 882 |
- # remove us from open windows
|
|
| 883 |
- del app.interface.instances[self.account]['sub_request'][self.jid]
|
|
| 884 |
- |
|
| 885 |
- def on_close_button_clicked(self, widget):
|
|
| 886 |
- self.destroy()
|
|
| 887 |
- |
|
| 888 |
- def on_authorize_button_clicked(self, widget):
|
|
| 889 |
- """
|
|
| 890 |
- Accept the request
|
|
| 891 |
- """
|
|
| 892 |
- app.connections[self.account].get_module('Presence').subscribed(self.jid)
|
|
| 893 |
- self.destroy()
|
|
| 894 |
- contact = app.contacts.get_contact(self.account, self.jid)
|
|
| 895 |
- if not contact or _('Not in Roster') in contact.groups:
|
|
| 896 |
- AddNewContactWindow(self.account, self.jid, self.user_nick)
|
|
| 897 |
- |
|
| 898 |
- def on_contact_info_activate(self, widget):
|
|
| 899 |
- """
|
|
| 900 |
- Ask vcard
|
|
| 901 |
- """
|
|
| 902 |
- if self.jid in app.interface.instances[self.account]['infos']:
|
|
| 903 |
- app.interface.instances[self.account]['infos'][self.jid].window.present()
|
|
| 904 |
- else:
|
|
| 905 |
- contact = app.contacts.create_contact(jid=self.jid, account=self.account)
|
|
| 906 |
- app.interface.instances[self.account]['infos'][self.jid] = \
|
|
| 907 |
- vcard.VcardWindow(contact, self.account)
|
|
| 908 |
- # Remove jabber page
|
|
| 909 |
- app.interface.instances[self.account]['infos'][self.jid].xml.\
|
|
| 910 |
- get_object('information_notebook').remove_page(0)
|
|
| 911 |
- |
|
| 912 |
- def on_start_chat_activate(self, widget):
|
|
| 913 |
- """
|
|
| 914 |
- Open chat
|
|
| 915 |
- """
|
|
| 916 |
- app.interface.new_chat_from_jid(self.account, self.jid)
|
|
| 917 |
- |
|
| 918 |
- def on_deny_button_clicked(self, widget):
|
|
| 919 |
- """
|
|
| 920 |
- Refuse the request
|
|
| 921 |
- """
|
|
| 922 |
- app.connections[self.account].get_module('Presence').unsubscribed(self.jid)
|
|
| 923 |
- contact = app.contacts.get_contact(self.account, self.jid)
|
|
| 924 |
- if contact and _('Not in Roster') in contact.get_shown_groups():
|
|
| 925 |
- app.interface.roster.remove_contact(self.jid, self.account)
|
|
| 926 |
- self.destroy()
|
|
| 927 |
- |
|
| 928 | 843 |
class SynchroniseSelectAccountDialog:
|
| 929 | 844 |
def __init__(self, account):
|
| 930 | 845 |
# 'account' can be None if we are about to create our first one
|
| 1 |
+# This file is part of Gajim.
|
|
| 2 |
+#
|
|
| 3 |
+# Gajim is free software; you can redistribute it and/or modify
|
|
| 4 |
+# it under the terms of the GNU General Public License as published
|
|
| 5 |
+# by the Free Software Foundation; version 3 only.
|
|
| 6 |
+#
|
|
| 7 |
+# Gajim is distributed in the hope that it will be useful,
|
|
| 8 |
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
| 9 |
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
| 10 |
+# GNU General Public License for more details.
|
|
| 11 |
+#
|
|
| 12 |
+# You should have received a copy of the GNU General Public License
|
|
| 13 |
+# along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
|
| 14 |
+ |
|
| 15 |
+from gi.repository import Gtk
|
|
| 16 |
+ |
|
| 17 |
+from gajim import vcard
|
|
| 18 |
+ |
|
| 19 |
+from gajim.common import app
|
|
| 20 |
+from gajim.common.i18n import _
|
|
| 21 |
+ |
|
| 22 |
+from gajim.gtk.add_contact import AddNewContactWindow
|
|
| 23 |
+from gajim.gtk.util import get_builder
|
|
| 24 |
+ |
|
| 25 |
+ |
|
| 26 |
+class SubscriptionRequestWindow(Gtk.ApplicationWindow):
|
|
| 27 |
+ def __init__(self, jid, text, account, user_nick=None):
|
|
| 28 |
+ Gtk.ApplicationWindow.__init__(self)
|
|
| 29 |
+ self.set_name('SubscriptionRequest')
|
|
| 30 |
+ self.set_application(app.app)
|
|
| 31 |
+ self.set_show_menubar(False)
|
|
| 32 |
+ self.set_resizable(False)
|
|
| 33 |
+ self.set_position(Gtk.WindowPosition.CENTER)
|
|
| 34 |
+ self.set_title(_('Subscription Request'))
|
|
| 35 |
+ |
|
| 36 |
+ self._ui = get_builder('subscription_request_window.ui')
|
|
| 37 |
+ self.add(self._ui.subscription_box)
|
|
| 38 |
+ self.jid = jid
|
|
| 39 |
+ self.account = account
|
|
| 40 |
+ self.user_nick = user_nick
|
|
| 41 |
+ self._ui.jid_label.set_text(self.jid)
|
|
| 42 |
+ if len(app.connections) >= 2:
|
|
| 43 |
+ prompt_text = \
|
|
| 44 |
+ _('Subscription request for account %(account)s from %(jid)s')\
|
|
| 45 |
+ % {'account': account, 'jid': self.jid}
|
|
| 46 |
+ else:
|
|
| 47 |
+ prompt_text = _('Subscription request from %s') % self.jid
|
|
| 48 |
+ |
|
| 49 |
+ self._ui.request_label.set_text(prompt_text)
|
|
| 50 |
+ self._ui.subscription_text.set_text(text)
|
|
| 51 |
+ |
|
| 52 |
+ self._ui.connect_signals(self)
|
|
| 53 |
+ self.show_all()
|
|
| 54 |
+ |
|
| 55 |
+ def on_subscription_request_window_destroy(self, widget):
|
|
| 56 |
+ """
|
|
| 57 |
+ Close window
|
|
| 58 |
+ """
|
|
| 59 |
+ if self.jid in app.interface.instances[self.account]['sub_request']:
|
|
| 60 |
+ # Remove us from open windows
|
|
| 61 |
+ del app.interface.instances[self.account]['sub_request'][self.jid]
|
|
| 62 |
+ |
|
| 63 |
+ def on_authorize_button_clicked(self, widget):
|
|
| 64 |
+ """
|
|
| 65 |
+ Accept the request
|
|
| 66 |
+ """
|
|
| 67 |
+ app.connections[self.account].get_module('Presence').subscribed(self.jid)
|
|
| 68 |
+ self.destroy()
|
|
| 69 |
+ contact = app.contacts.get_contact(self.account, self.jid)
|
|
| 70 |
+ if not contact or _('Not in Roster') in contact.groups:
|
|
| 71 |
+ AddNewContactWindow(self.account, self.jid, self.user_nick)
|
|
| 72 |
+ |
|
| 73 |
+ def on_contact_info_button_clicked(self, widget):
|
|
| 74 |
+ """
|
|
| 75 |
+ Ask for vCard
|
|
| 76 |
+ """
|
|
| 77 |
+ if self.jid in app.interface.instances[self.account]['infos']:
|
|
| 78 |
+ app.interface.instances[self.account]['infos'][self.jid].window.present()
|
|
| 79 |
+ else:
|
|
| 80 |
+ contact = app.contacts.create_contact(jid=self.jid, account=self.account)
|
|
| 81 |
+ app.interface.instances[self.account]['infos'][self.jid] = \
|
|
| 82 |
+ vcard.VcardWindow(contact, self.account)
|
|
| 83 |
+ # Remove xmpp page
|
|
| 84 |
+ app.interface.instances[self.account]['infos'][self.jid].xml.\
|
|
| 85 |
+ get_object('information_notebook').remove_page(0)
|
|
| 86 |
+ |
|
| 87 |
+ def on_start_chat_button_clicked(self, widget):
|
|
| 88 |
+ """
|
|
| 89 |
+ Open chat
|
|
| 90 |
+ """
|
|
| 91 |
+ app.interface.new_chat_from_jid(self.account, self.jid)
|
|
| 92 |
+ |
|
| 93 |
+ def on_deny_button_clicked(self, widget):
|
|
| 94 |
+ """
|
|
| 95 |
+ Refuse the request
|
|
| 96 |
+ """
|
|
| 97 |
+ app.connections[self.account].get_module('Presence').unsubscribed(self.jid)
|
|
| 98 |
+ contact = app.contacts.get_contact(self.account, self.jid)
|
|
| 99 |
+ if contact and _('Not in Roster') in contact.get_shown_groups():
|
|
| 100 |
+ app.interface.roster.remove_contact(self.jid, self.account)
|
|
| 101 |
+ self.destroy()
|
| ... | ... | @@ -119,6 +119,7 @@ from gajim.gtk.emoji_data import emoji_data |
| 119 | 119 |
from gajim.gtk.emoji_data import emoji_ascii_data
|
| 120 | 120 |
from gajim.gtk.groupchat_config import GroupchatConfig
|
| 121 | 121 |
from gajim.gtk.filetransfer import FileTransfersWindow
|
| 122 |
+from gajim.gtk.subscription_request import SubscriptionRequestWindow
|
|
| 122 | 123 |
from gajim.gtk.util import get_show_in_roster
|
| 123 | 124 |
from gajim.gtk.util import get_show_in_systray
|
| 124 | 125 |
|
| ... | ... | @@ -414,8 +415,8 @@ class Interface: |
| 414 | 415 |
if obj.jid in self.instances[account]['sub_request']:
|
| 415 | 416 |
self.instances[account]['sub_request'][obj.jid].destroy()
|
| 416 | 417 |
self.instances[account]['sub_request'][obj.jid] = \
|
| 417 |
- dialogs.SubscriptionRequestWindow(obj.jid, obj.status, account,
|
|
| 418 |
- obj.user_nick)
|
|
| 418 |
+ SubscriptionRequestWindow(obj.jid, obj.status, account,
|
|
| 419 |
+ obj.user_nick)
|
|
| 419 | 420 |
return
|
| 420 | 421 |
|
| 421 | 422 |
event = events.SubscriptionRequestEvent(obj.status, obj.user_nick)
|
| ... | ... | @@ -1473,8 +1474,7 @@ class Interface: |
| 1473 | 1474 |
event = app.events.get_first_event(account, jid, type_)
|
| 1474 | 1475 |
if event is None:
|
| 1475 | 1476 |
return
|
| 1476 |
- dialogs.SubscriptionRequestWindow(jid, event.text, account,
|
|
| 1477 |
- event.nick)
|
|
| 1477 |
+ SubscriptionRequestWindow(jid, event.text, account, event.nick)
|
|
| 1478 | 1478 |
app.events.remove_events(account, jid, event)
|
| 1479 | 1479 |
self.roster.draw_contact(jid, account)
|
| 1480 | 1480 |
elif type_ == 'unsubscribed':
|
| ... | ... | @@ -84,6 +84,7 @@ from gajim.gtk.discovery import ServiceDiscoveryWindow |
| 84 | 84 |
from gajim.gtk.accounts import AccountsWindow
|
| 85 | 85 |
from gajim.gtk.tooltips import RosterTooltip
|
| 86 | 86 |
from gajim.gtk.adhoc_commands import CommandWindow
|
| 87 |
+from gajim.gtk.subscription_request import SubscriptionRequestWindow
|
|
| 87 | 88 |
from gajim.gtk.util import get_icon_name
|
| 88 | 89 |
from gajim.gtk.util import resize_window
|
| 89 | 90 |
from gajim.gtk.util import restore_roster_position
|
| ... | ... | @@ -1981,8 +1982,7 @@ class RosterWindow: |
| 1981 | 1982 |
return True
|
| 1982 | 1983 |
|
| 1983 | 1984 |
if event.type_ == 'subscription_request':
|
| 1984 |
- dialogs.SubscriptionRequestWindow(jid, event.text, account,
|
|
| 1985 |
- event.nick)
|
|
| 1985 |
+ SubscriptionRequestWindow(jid, event.text, account, event.nick)
|
|
| 1986 | 1986 |
app.events.remove_events(account, jid, event)
|
| 1987 | 1987 |
return True
|
| 1988 | 1988 |
|