| ... |
... |
@@ -22,7 +22,9 @@ |
|
22
|
22
|
|
|
23
|
23
|
from gajim.common import app
|
|
24
|
24
|
from gajim.common import ged
|
|
|
25
|
+from gajim.common import types
|
|
25
|
26
|
from gajim.common.const import AvatarSize
|
|
|
27
|
+from gajim.common.const import SimpleClientState
|
|
26
|
28
|
from gajim.common.events import MucDiscoUpdate
|
|
27
|
29
|
from gajim.common.i18n import _
|
|
28
|
30
|
from gajim.common.modules.contacts import GroupchatContact
|
| ... |
... |
@@ -55,6 +57,9 @@ def __init__(self, |
|
55
|
57
|
|
|
56
|
58
|
self.account = contact.account
|
|
57
|
59
|
self._client = app.get_client(contact.account)
|
|
|
60
|
+ self._client.connect_signal(
|
|
|
61
|
+ 'state-changed', self._on_client_state_changed)
|
|
|
62
|
+
|
|
58
|
63
|
self._contact = contact
|
|
59
|
64
|
self._contact.connect('avatar-update', self._on_avatar_update)
|
|
60
|
65
|
|
| ... |
... |
@@ -62,7 +67,7 @@ def __init__(self, |
|
62
|
67
|
self._ui.connect_signals(self)
|
|
63
|
68
|
|
|
64
|
69
|
self._switcher = SideBarSwitcher(width=250)
|
|
65
|
|
- self._switcher.set_stack(self._ui.main_stack)
|
|
|
70
|
+ self._switcher.set_stack(self._ui.main_stack, rows_visible=False)
|
|
66
|
71
|
self._ui.main_grid.attach(self._switcher, 0, 0, 1, 1)
|
|
67
|
72
|
self._ui.main_stack.connect('notify::visible-child-name',
|
|
68
|
73
|
self._on_stack_child_changed)
|
| ... |
... |
@@ -73,10 +78,14 @@ def __init__(self, |
|
73
|
78
|
self._add_groupchat_info()
|
|
74
|
79
|
self._add_groupchat_settings()
|
|
75
|
80
|
self._add_groupchat_encryption()
|
|
76
|
|
- self._add_groupchat_manage()
|
|
77
|
|
- self._add_affiliations()
|
|
78
|
|
- self._add_outcasts()
|
|
79
|
|
- self._add_configuration()
|
|
|
81
|
+
|
|
|
82
|
+ if self._client.state.is_available:
|
|
|
83
|
+ self._ui.edit_name_button.set_sensitive(True)
|
|
|
84
|
+ self._ui.edit_name_button.set_tooltip_text(_('Edit Name…'))
|
|
|
85
|
+ self._add_groupchat_manage()
|
|
|
86
|
+ self._add_affiliations()
|
|
|
87
|
+ self._add_outcasts()
|
|
|
88
|
+ self._add_configuration()
|
|
80
|
89
|
|
|
81
|
90
|
self._load_avatar()
|
|
82
|
91
|
self._ui.name_entry.set_text(contact.name)
|
| ... |
... |
@@ -92,6 +101,16 @@ def __init__(self, |
|
92
|
101
|
|
|
93
|
102
|
self.show_all()
|
|
94
|
103
|
|
|
|
104
|
+ def _on_client_state_changed(self,
|
|
|
105
|
+ _client: types.Client,
|
|
|
106
|
+ _signal_name: str,
|
|
|
107
|
+ state: SimpleClientState
|
|
|
108
|
+ ) -> None:
|
|
|
109
|
+
|
|
|
110
|
+ self._ui.edit_name_button.set_sensitive(state.is_connected)
|
|
|
111
|
+ self._ui.edit_name_button.set_tooltip_text(
|
|
|
112
|
+ _('Not connected') if not state.is_connected else _('Edit Name…'))
|
|
|
113
|
+
|
|
95
|
114
|
def _on_muc_disco_update(self, event: MucDiscoUpdate) -> None:
|
|
96
|
115
|
if event.jid != self._contact.jid:
|
|
97
|
116
|
return
|
| ... |
... |
@@ -138,6 +157,7 @@ def _add_groupchat_manage(self) -> None: |
|
138
|
157
|
self._groupchat_manage = GroupchatManage(self.account,
|
|
139
|
158
|
self._contact)
|
|
140
|
159
|
self._ui.manage_box.add(self._groupchat_manage)
|
|
|
160
|
+ self._switcher.set_row_visible('manage', True)
|
|
141
|
161
|
|
|
142
|
162
|
def _add_groupchat_info(self) -> None:
|
|
143
|
163
|
self._groupchat_info = GroupChatInfoScrolled(
|
| ... |
... |
@@ -148,6 +168,7 @@ def _add_groupchat_info(self) -> None: |
|
148
|
168
|
self._groupchat_info.set_from_disco_info(disco_info)
|
|
149
|
169
|
self._groupchat_info.set_subject(self._contact.subject)
|
|
150
|
170
|
self._ui.info_box.add(self._groupchat_info)
|
|
|
171
|
+ self._switcher.set_row_visible('information', True)
|
|
151
|
172
|
|
|
152
|
173
|
def _add_groupchat_settings(self) -> None:
|
|
153
|
174
|
main_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=24)
|
| ... |
... |
@@ -174,6 +195,7 @@ def _add_groupchat_settings(self) -> None: |
|
174
|
195
|
scrolled_window.add(main_box)
|
|
175
|
196
|
|
|
176
|
197
|
self._ui.settings_box.add(scrolled_window)
|
|
|
198
|
+ self._switcher.set_row_visible('settings', True)
|
|
177
|
199
|
|
|
178
|
200
|
def _add_groupchat_encryption(self) -> None:
|
|
179
|
201
|
if (self._contact.is_groupchat and
|
| ... |
... |
@@ -184,18 +206,22 @@ def _add_groupchat_encryption(self) -> None: |
|
184
|
206
|
|
|
185
|
207
|
self._ui.encryption_box.add(
|
|
186
|
208
|
OMEMOTrustManager(self._contact.account, self._contact))
|
|
|
209
|
+ self._switcher.set_row_visible('encryption-omemo', True)
|
|
187
|
210
|
|
|
188
|
211
|
def _add_affiliations(self) -> None:
|
|
189
|
212
|
affiliations = GroupchatAffiliation(self._client, self._contact)
|
|
190
|
213
|
self._ui.affiliation_box.add(affiliations)
|
|
|
214
|
+ self._switcher.set_row_visible('affiliations', True)
|
|
191
|
215
|
|
|
192
|
216
|
def _add_outcasts(self) -> None:
|
|
193
|
217
|
affiliations = GroupchatOutcasts(self._client, self._contact)
|
|
194
|
218
|
self._ui.outcasts_box.add(affiliations)
|
|
|
219
|
+ self._switcher.set_row_visible('outcasts', True)
|
|
195
|
220
|
|
|
196
|
221
|
def _add_configuration(self) -> None:
|
|
197
|
222
|
config = GroupchatConfig(self._client, self._contact)
|
|
198
|
223
|
self._ui.configuration_box.add(config)
|
|
|
224
|
+ self._switcher.set_row_visible('config', True)
|
|
199
|
225
|
|
|
200
|
226
|
def _on_key_press(self,
|
|
201
|
227
|
_widget: GroupchatDetails,
|