| ... |
... |
@@ -21,6 +21,7 @@ |
|
21
|
21
|
from gajim.common import helpers
|
|
22
|
22
|
from gajim.common.i18n import _
|
|
23
|
23
|
|
|
|
24
|
+from .service_registration import ServiceRegistration
|
|
24
|
25
|
from .dialogs import ErrorDialog
|
|
25
|
26
|
from .util import get_builder
|
|
26
|
27
|
from .util import EventHelper
|
| ... |
... |
@@ -58,27 +59,18 @@ def __init__(self, account=None, contact_jid=None, user_nick=None, group=None): |
|
58
|
59
|
if not account:
|
|
59
|
60
|
self.account = accounts[0][0]
|
|
60
|
61
|
|
|
61
|
|
- self.xml = get_builder('add_new_contact_window.ui')
|
|
62
|
|
- self.add(self.xml.get_object('add_contact_box'))
|
|
63
|
|
- self.xml.connect_signals(self)
|
|
|
62
|
+ self._ui = get_builder('add_new_contact_window.ui')
|
|
|
63
|
+ self.add(self._ui.add_contact_box)
|
|
|
64
|
+ self._ui.connect_signals(self)
|
|
64
|
65
|
|
|
65
|
|
- for w in ('account_combobox', 'account_label', 'prompt_label',
|
|
66
|
|
- 'uid_label', 'uid_entry', 'show_contact_info_button',
|
|
67
|
|
- 'protocol_combobox', 'protocol_jid_combobox',
|
|
68
|
|
- 'protocol_label', 'nickname_entry',
|
|
69
|
|
- 'message_scrolledwindow', 'save_message_checkbutton',
|
|
70
|
|
- 'register_hbox', 'add_button', 'message_textview',
|
|
71
|
|
- 'connected_label', 'group_comboboxentry',
|
|
72
|
|
- 'auto_authorize_checkbutton', 'save_message_revealer',
|
|
73
|
|
- 'nickname_label', 'group_label'):
|
|
74
|
|
- self.__dict__[w] = self.xml.get_object(w)
|
|
|
66
|
+ self.subscription_table = [
|
|
|
67
|
+ self._ui.uid_label, self._ui.uid_entry,
|
|
|
68
|
+ self._ui.show_contact_info_button,
|
|
|
69
|
+ self._ui.nickname_label, self._ui.nickname_entry,
|
|
|
70
|
+ self._ui.group_label, self._ui.group_comboboxentry
|
|
|
71
|
+ ]
|
|
75
|
72
|
|
|
76
|
|
- self.subscription_table = [self.uid_label, self.uid_entry,
|
|
77
|
|
- self.show_contact_info_button,
|
|
78
|
|
- self.nickname_label, self.nickname_entry,
|
|
79
|
|
- self.group_label, self.group_comboboxentry]
|
|
80
|
|
-
|
|
81
|
|
- self.add_button.grab_default()
|
|
|
73
|
+ self._ui.add_button.grab_default()
|
|
82
|
74
|
|
|
83
|
75
|
self.agents = {'jabber': []}
|
|
84
|
76
|
self.gateway_prompt = {}
|
| ... |
... |
@@ -110,7 +102,7 @@ def __init__(self, account=None, contact_jid=None, user_nick=None, group=None): |
|
110
|
102
|
|
|
111
|
103
|
uf_type = {'jabber': 'XMPP', 'gadu-gadu': 'Gadu Gadu', 'icq': 'ICQ'}
|
|
112
|
104
|
# Jabber as first
|
|
113
|
|
- liststore = self.protocol_combobox.get_model()
|
|
|
105
|
+ liststore = self._ui.protocol_combobox.get_model()
|
|
114
|
106
|
liststore.append(['XMPP', 'xmpp', 'jabber'])
|
|
115
|
107
|
for type_ in self.agents:
|
|
116
|
108
|
if type_ == 'jabber':
|
| ... |
... |
@@ -124,8 +116,8 @@ def __init__(self, account=None, contact_jid=None, user_nick=None, group=None): |
|
124
|
116
|
for service in self.agents[type_]:
|
|
125
|
117
|
con = app.connections[account]
|
|
126
|
118
|
con.get_module('Gateway').request_gateway_prompt(service)
|
|
127
|
|
- self.protocol_combobox.set_active(0)
|
|
128
|
|
- self.auto_authorize_checkbutton.show()
|
|
|
119
|
+ self._ui.protocol_combobox.set_active(0)
|
|
|
120
|
+ self._ui.auto_authorize_checkbutton.show()
|
|
129
|
121
|
|
|
130
|
122
|
if contact_jid:
|
|
131
|
123
|
self.jid_escaped = True
|
| ... |
... |
@@ -133,42 +125,42 @@ def __init__(self, account=None, contact_jid=None, user_nick=None, group=None): |
|
133
|
125
|
if not type_:
|
|
134
|
126
|
type_ = 'jabber'
|
|
135
|
127
|
if type_ == 'jabber':
|
|
136
|
|
- self.uid_entry.set_text(contact_jid)
|
|
|
128
|
+ self._ui.uid_entry.set_text(contact_jid)
|
|
137
|
129
|
transport = None
|
|
138
|
130
|
else:
|
|
139
|
131
|
uid, transport = app.get_name_and_server_from_jid(contact_jid)
|
|
140
|
|
- self.uid_entry.set_text(uid.replace('%', '@', 1))
|
|
|
132
|
+ self._ui.uid_entry.set_text(uid.replace('%', '@', 1))
|
|
141
|
133
|
|
|
142
|
|
- self.show_contact_info_button.set_sensitive(True)
|
|
|
134
|
+ self._ui.show_contact_info_button.set_sensitive(True)
|
|
143
|
135
|
|
|
144
|
136
|
# set protocol_combobox
|
|
145
|
|
- model = self.protocol_combobox.get_model()
|
|
|
137
|
+ model = self._ui.protocol_combobox.get_model()
|
|
146
|
138
|
iter_ = model.get_iter_first()
|
|
147
|
139
|
i = 0
|
|
148
|
140
|
while iter_:
|
|
149
|
141
|
if model[iter_][2] == type_:
|
|
150
|
|
- self.protocol_combobox.set_active(i)
|
|
|
142
|
+ self._ui.protocol_combobox.set_active(i)
|
|
151
|
143
|
break
|
|
152
|
144
|
iter_ = model.iter_next(iter_)
|
|
153
|
145
|
i += 1
|
|
154
|
146
|
|
|
155
|
147
|
# set protocol_jid_combobox
|
|
156
|
|
- self.protocol_jid_combobox.set_active(0)
|
|
157
|
|
- model = self.protocol_jid_combobox.get_model()
|
|
|
148
|
+ self._ui.protocol_jid_combobox.set_active(0)
|
|
|
149
|
+ model = self._ui.protocol_jid_combobox.get_model()
|
|
158
|
150
|
iter_ = model.get_iter_first()
|
|
159
|
151
|
i = 0
|
|
160
|
152
|
while iter_:
|
|
161
|
153
|
if model[iter_][0] == transport:
|
|
162
|
|
- self.protocol_jid_combobox.set_active(i)
|
|
|
154
|
+ self._ui.protocol_jid_combobox.set_active(i)
|
|
163
|
155
|
break
|
|
164
|
156
|
iter_ = model.iter_next(iter_)
|
|
165
|
157
|
i += 1
|
|
166
|
158
|
if user_nick:
|
|
167
|
|
- self.nickname_entry.set_text(user_nick)
|
|
168
|
|
- self.nickname_entry.grab_focus()
|
|
|
159
|
+ self._ui.nickname_entry.set_text(user_nick)
|
|
|
160
|
+ self._ui.nickname_entry.grab_focus()
|
|
169
|
161
|
else:
|
|
170
|
162
|
self.jid_escaped = False
|
|
171
|
|
- self.uid_entry.grab_focus()
|
|
|
163
|
+ self._ui.uid_entry.grab_focus()
|
|
172
|
164
|
group_names = []
|
|
173
|
165
|
for acct in accounts:
|
|
174
|
166
|
for g in app.groups[acct[0]].keys():
|
| ... |
... |
@@ -177,31 +169,31 @@ def __init__(self, account=None, contact_jid=None, user_nick=None, group=None): |
|
177
|
169
|
group_names.sort()
|
|
178
|
170
|
i = 0
|
|
179
|
171
|
for g in group_names:
|
|
180
|
|
- self.group_comboboxentry.append_text(g)
|
|
|
172
|
+ self._ui.group_comboboxentry.append_text(g)
|
|
181
|
173
|
if group == g:
|
|
182
|
|
- self.group_comboboxentry.set_active(i)
|
|
|
174
|
+ self._ui.group_comboboxentry.set_active(i)
|
|
183
|
175
|
i += 1
|
|
184
|
176
|
|
|
185
|
177
|
if len(accounts) > 1:
|
|
186
|
|
- liststore = self.account_combobox.get_model()
|
|
|
178
|
+ liststore = self._ui.account_combobox.get_model()
|
|
187
|
179
|
for acc in accounts:
|
|
188
|
180
|
liststore.append(acc)
|
|
189
|
181
|
|
|
190
|
|
- self.account_combobox.set_active_id(self.account)
|
|
191
|
|
- self.account_label.show()
|
|
192
|
|
- self.account_combobox.show()
|
|
|
182
|
+ self._ui.account_combobox.set_active_id(self.account)
|
|
|
183
|
+ self._ui.account_label.show()
|
|
|
184
|
+ self._ui.account_combobox.show()
|
|
193
|
185
|
|
|
194
|
186
|
if len(self.agents) > 1:
|
|
195
|
|
- self.protocol_label.show()
|
|
196
|
|
- self.protocol_combobox.show()
|
|
|
187
|
+ self._ui.protocol_label.show()
|
|
|
188
|
+ self._ui.protocol_combobox.show()
|
|
197
|
189
|
|
|
198
|
190
|
if self.account:
|
|
199
|
|
- message_buffer = self.message_textview.get_buffer()
|
|
|
191
|
+ message_buffer = self._ui.message_textview.get_buffer()
|
|
200
|
192
|
msg = helpers.from_one_line(helpers.get_subscription_request_msg(
|
|
201
|
193
|
self.account))
|
|
202
|
194
|
message_buffer.set_text(msg)
|
|
203
|
195
|
|
|
204
|
|
- self.uid_entry.connect('changed', self.on_uid_entry_changed)
|
|
|
196
|
+ self._ui.uid_entry.connect('changed', self.on_uid_entry_changed)
|
|
205
|
197
|
self.show_all()
|
|
206
|
198
|
|
|
207
|
199
|
self.register_events([
|
| ... |
... |
@@ -210,14 +202,14 @@ def __init__(self, account=None, contact_jid=None, user_nick=None, group=None): |
|
210
|
202
|
])
|
|
211
|
203
|
|
|
212
|
204
|
def on_uid_entry_changed(self, widget):
|
|
213
|
|
- is_empty = bool(not self.uid_entry.get_text() == '')
|
|
214
|
|
- self.show_contact_info_button.set_sensitive(is_empty)
|
|
|
205
|
+ is_empty = bool(not self._ui.uid_entry.get_text() == '')
|
|
|
206
|
+ self._ui.show_contact_info_button.set_sensitive(is_empty)
|
|
215
|
207
|
|
|
216
|
208
|
def on_show_contact_info_button_clicked(self, widget):
|
|
217
|
209
|
"""
|
|
218
|
210
|
Ask for vCard
|
|
219
|
211
|
"""
|
|
220
|
|
- jid = self.uid_entry.get_text().strip()
|
|
|
212
|
+ jid = self._ui.uid_entry.get_text().strip()
|
|
221
|
213
|
|
|
222
|
214
|
if jid in app.interface.instances[self.account]['infos']:
|
|
223
|
215
|
app.interface.instances[self.account]['infos'][jid].window.present()
|
| ... |
... |
@@ -230,10 +222,9 @@ def on_show_contact_info_button_clicked(self, widget): |
|
230
|
222
|
get_object('information_notebook').remove_page(0)
|
|
231
|
223
|
|
|
232
|
224
|
def on_register_button_clicked(self, widget):
|
|
233
|
|
- model = self.protocol_jid_combobox.get_model()
|
|
234
|
|
- row = self.protocol_jid_combobox.get_active()
|
|
|
225
|
+ model = self._ui.protocol_jid_combobox.get_model()
|
|
|
226
|
+ row = self._ui.protocol_jid_combobox.get_active()
|
|
235
|
227
|
jid = model[row][0]
|
|
236
|
|
- from .service_registration import ServiceRegistration
|
|
237
|
228
|
ServiceRegistration(self.account, jid)
|
|
238
|
229
|
|
|
239
|
230
|
def _on_key_press(self, widget, event):
|
| ... |
... |
@@ -247,28 +238,28 @@ def on_cancel_button_clicked(self, widget): |
|
247
|
238
|
self.destroy()
|
|
248
|
239
|
|
|
249
|
240
|
def on_message_textbuffer_changed(self, widget):
|
|
250
|
|
- self.save_message_revealer.show()
|
|
251
|
|
- self.save_message_revealer.set_reveal_child(True)
|
|
|
241
|
+ self._ui.save_message_revealer.show()
|
|
|
242
|
+ self._ui.save_message_revealer.set_reveal_child(True)
|
|
252
|
243
|
|
|
253
|
244
|
def on_add_button_clicked(self, widget):
|
|
254
|
245
|
"""
|
|
255
|
246
|
When Subscribe button is clicked
|
|
256
|
247
|
"""
|
|
257
|
|
- jid = self.uid_entry.get_text().strip()
|
|
|
248
|
+ jid = self._ui.uid_entry.get_text().strip()
|
|
258
|
249
|
if not jid:
|
|
259
|
250
|
ErrorDialog(
|
|
260
|
|
- _('%s Missing') % self.uid_label.get_text(),
|
|
|
251
|
+ _('%s Missing') % self._ui.uid_label.get_text(),
|
|
261
|
252
|
(_('You must supply the %s of the new contact.') %
|
|
262
|
|
- self.uid_label.get_text())
|
|
|
253
|
+ self._ui.uid_label.get_text())
|
|
263
|
254
|
)
|
|
264
|
255
|
return
|
|
265
|
256
|
|
|
266
|
|
- model = self.protocol_combobox.get_model()
|
|
267
|
|
- row = self.protocol_combobox.get_active_iter()
|
|
|
257
|
+ model = self._ui.protocol_combobox.get_model()
|
|
|
258
|
+ row = self._ui.protocol_combobox.get_active_iter()
|
|
268
|
259
|
type_ = model[row][2]
|
|
269
|
260
|
if type_ != 'jabber':
|
|
270
|
|
- model = self.protocol_jid_combobox.get_model()
|
|
271
|
|
- row = self.protocol_jid_combobox.get_active()
|
|
|
261
|
+ model = self._ui.protocol_jid_combobox.get_model()
|
|
|
262
|
+ row = self._ui.protocol_jid_combobox.get_active()
|
|
272
|
263
|
transport = model[row][0]
|
|
273
|
264
|
if self.account and not self.jid_escaped:
|
|
274
|
265
|
self.adding_jid = (jid, transport, type_)
|
| ... |
... |
@@ -307,11 +298,11 @@ def _add_jid(self, jid, type_): |
|
307
|
298
|
)
|
|
308
|
299
|
return
|
|
309
|
300
|
|
|
310
|
|
- nickname = self.nickname_entry.get_text() or ''
|
|
|
301
|
+ nickname = self._ui.nickname_entry.get_text() or ''
|
|
311
|
302
|
# get value of account combobox, if account was not specified
|
|
312
|
303
|
if not self.account:
|
|
313
|
|
- model = self.account_combobox.get_model()
|
|
314
|
|
- index = self.account_combobox.get_active()
|
|
|
304
|
+ model = self._ui.account_combobox.get_model()
|
|
|
305
|
+ index = self._ui.account_combobox.get_active()
|
|
315
|
306
|
self.account = model[index][1]
|
|
316
|
307
|
|
|
317
|
308
|
# Check if jid is already in roster
|
| ... |
... |
@@ -324,30 +315,35 @@ def _add_jid(self, jid, type_): |
|
324
|
315
|
return
|
|
325
|
316
|
|
|
326
|
317
|
if type_ == 'jabber':
|
|
327
|
|
- message_buffer = self.message_textview.get_buffer()
|
|
|
318
|
+ message_buffer = self._ui.message_textview.get_buffer()
|
|
328
|
319
|
start_iter = message_buffer.get_start_iter()
|
|
329
|
320
|
end_iter = message_buffer.get_end_iter()
|
|
330
|
321
|
message = message_buffer.get_text(start_iter, end_iter, True)
|
|
331
|
|
- if self.save_message_checkbutton.get_active():
|
|
|
322
|
+ if self._ui.save_message_checkbutton.get_active():
|
|
332
|
323
|
msg = helpers.to_one_line(message)
|
|
333
|
324
|
app.settings.set_account_setting(self.account,
|
|
334
|
325
|
'subscription_request_msg',
|
|
335
|
326
|
msg)
|
|
336
|
327
|
else:
|
|
337
|
328
|
message = ''
|
|
338
|
|
- group = self.group_comboboxentry.get_child().get_text()
|
|
|
329
|
+ group = self._ui.group_comboboxentry.get_child().get_text()
|
|
339
|
330
|
groups = []
|
|
340
|
331
|
if group:
|
|
341
|
332
|
groups = [group]
|
|
342
|
|
- auto_auth = self.auto_authorize_checkbutton.get_active()
|
|
343
|
|
- app.interface.roster.req_sub(
|
|
344
|
|
- self, jid, message, self.account,
|
|
345
|
|
- groups=groups, nickname=nickname, auto_auth=auto_auth)
|
|
|
333
|
+ auto_auth = self._ui.auto_authorize_checkbutton.get_active()
|
|
|
334
|
+
|
|
|
335
|
+ client = app.get_client(self.account)
|
|
|
336
|
+ client.get_module('Presence').subscribe(jid,
|
|
|
337
|
+ message,
|
|
|
338
|
+ nickname,
|
|
|
339
|
+ groups=groups,
|
|
|
340
|
+ auto_auth=auto_auth)
|
|
|
341
|
+
|
|
346
|
342
|
self.destroy()
|
|
347
|
343
|
|
|
348
|
344
|
def on_account_combobox_changed(self, widget):
|
|
349
|
345
|
account = widget.get_active_id()
|
|
350
|
|
- message_buffer = self.message_textview.get_buffer()
|
|
|
346
|
+ message_buffer = self._ui.message_textview.get_buffer()
|
|
351
|
347
|
message_buffer.set_text(helpers.get_subscription_request_msg(account))
|
|
352
|
348
|
self.account = account
|
|
353
|
349
|
|
| ... |
... |
@@ -357,8 +353,8 @@ def on_protocol_jid_combobox_changed(self, widget): |
|
357
|
353
|
if not iter_:
|
|
358
|
354
|
return
|
|
359
|
355
|
jid_ = model[iter_][0]
|
|
360
|
|
- model = self.protocol_combobox.get_model()
|
|
361
|
|
- iter_ = self.protocol_combobox.get_active_iter()
|
|
|
356
|
+ model = self._ui.protocol_combobox.get_model()
|
|
|
357
|
+ iter_ = self._ui.protocol_combobox.get_active_iter()
|
|
362
|
358
|
type_ = model[iter_][2]
|
|
363
|
359
|
|
|
364
|
360
|
desc = None
|
| ... |
... |
@@ -366,10 +362,10 @@ def on_protocol_jid_combobox_changed(self, widget): |
|
366
|
362
|
desc = self.gateway_prompt[jid_]['desc']
|
|
367
|
363
|
|
|
368
|
364
|
if desc:
|
|
369
|
|
- self.prompt_label.set_markup(desc)
|
|
370
|
|
- self.prompt_label.show()
|
|
|
365
|
+ self._ui.prompt_label.set_markup(desc)
|
|
|
366
|
+ self._ui.prompt_label.show()
|
|
371
|
367
|
else:
|
|
372
|
|
- self.prompt_label.hide()
|
|
|
368
|
+ self._ui.prompt_label.hide()
|
|
373
|
369
|
|
|
374
|
370
|
prompt = None
|
|
375
|
371
|
if self.agents[type_] and jid_ in self.gateway_prompt:
|
| ... |
... |
@@ -379,18 +375,18 @@ def on_protocol_jid_combobox_changed(self, widget): |
|
379
|
375
|
prompt = self.uid_labels[type_]
|
|
380
|
376
|
else:
|
|
381
|
377
|
prompt = _('User ID:')
|
|
382
|
|
- self.uid_label.set_text(prompt)
|
|
|
378
|
+ self._ui.uid_label.set_text(prompt)
|
|
383
|
379
|
|
|
384
|
380
|
def on_protocol_combobox_changed(self, widget):
|
|
385
|
381
|
model = widget.get_model()
|
|
386
|
382
|
iter_ = widget.get_active_iter()
|
|
387
|
383
|
type_ = model[iter_][2]
|
|
388
|
|
- model = self.protocol_jid_combobox.get_model()
|
|
|
384
|
+ model = self._ui.protocol_jid_combobox.get_model()
|
|
389
|
385
|
model.clear()
|
|
390
|
386
|
if self.agents[type_]:
|
|
391
|
387
|
for jid_ in self.agents[type_]:
|
|
392
|
388
|
model.append([jid_])
|
|
393
|
|
- self.protocol_jid_combobox.set_active(0)
|
|
|
389
|
+ self._ui.protocol_jid_combobox.set_active(0)
|
|
394
|
390
|
desc = None
|
|
395
|
391
|
if self.agents[type_]:
|
|
396
|
392
|
jid_ = self.agents[type_][0]
|
| ... |
... |
@@ -398,15 +394,15 @@ def on_protocol_combobox_changed(self, widget): |
|
398
|
394
|
desc = self.gateway_prompt[jid_]['desc']
|
|
399
|
395
|
|
|
400
|
396
|
if desc:
|
|
401
|
|
- self.prompt_label.set_markup(desc)
|
|
402
|
|
- self.prompt_label.show()
|
|
|
397
|
+ self._ui.prompt_label.set_markup(desc)
|
|
|
398
|
+ self._ui.prompt_label.show()
|
|
403
|
399
|
else:
|
|
404
|
|
- self.prompt_label.hide()
|
|
|
400
|
+ self._ui.prompt_label.hide()
|
|
405
|
401
|
|
|
406
|
402
|
if len(self.agents[type_]) > 1:
|
|
407
|
|
- self.protocol_jid_combobox.show()
|
|
|
403
|
+ self._ui.protocol_jid_combobox.show()
|
|
408
|
404
|
else:
|
|
409
|
|
- self.protocol_jid_combobox.hide()
|
|
|
405
|
+ self._ui.protocol_jid_combobox.hide()
|
|
410
|
406
|
prompt = None
|
|
411
|
407
|
if self.agents[type_]:
|
|
412
|
408
|
jid_ = self.agents[type_][0]
|
| ... |
... |
@@ -417,59 +413,59 @@ def on_protocol_combobox_changed(self, widget): |
|
417
|
413
|
prompt = self.uid_labels[type_]
|
|
418
|
414
|
else:
|
|
419
|
415
|
prompt = _('User ID:')
|
|
420
|
|
- self.uid_label.set_text(prompt)
|
|
|
416
|
+ self._ui.uid_label.set_text(prompt)
|
|
421
|
417
|
|
|
422
|
418
|
if type_ == 'jabber':
|
|
423
|
|
- self.message_scrolledwindow.show()
|
|
424
|
|
- self.save_message_checkbutton.show()
|
|
|
419
|
+ self._ui.message_scrolledwindow.show()
|
|
|
420
|
+ self._ui.save_message_checkbutton.show()
|
|
425
|
421
|
else:
|
|
426
|
|
- self.message_scrolledwindow.hide()
|
|
427
|
|
- self.save_message_checkbutton.hide()
|
|
|
422
|
+ self._ui.message_scrolledwindow.hide()
|
|
|
423
|
+ self._ui.save_message_checkbutton.hide()
|
|
428
|
424
|
if type_ in self.available_types:
|
|
429
|
|
- self.register_hbox.show()
|
|
430
|
|
- self.auto_authorize_checkbutton.hide()
|
|
431
|
|
- self.connected_label.hide()
|
|
|
425
|
+ self._ui.register_hbox.show()
|
|
|
426
|
+ self._ui.auto_authorize_checkbutton.hide()
|
|
|
427
|
+ self._ui.connected_label.hide()
|
|
432
|
428
|
self._subscription_table_hide()
|
|
433
|
|
- self.add_button.set_sensitive(False)
|
|
|
429
|
+ self._ui.add_button.set_sensitive(False)
|
|
434
|
430
|
else:
|
|
435
|
|
- self.register_hbox.hide()
|
|
|
431
|
+ self._ui.register_hbox.hide()
|
|
436
|
432
|
if type_ != 'jabber':
|
|
437
|
|
- model = self.protocol_jid_combobox.get_model()
|
|
438
|
|
- row = self.protocol_jid_combobox.get_active()
|
|
|
433
|
+ model = self._ui.protocol_jid_combobox.get_model()
|
|
|
434
|
+ row = self._ui.protocol_jid_combobox.get_active()
|
|
439
|
435
|
jid = model[row][0]
|
|
440
|
436
|
contact = app.contacts.get_first_contact_from_jid(
|
|
441
|
437
|
self.account, jid)
|
|
442
|
438
|
if contact is None or contact.show in ('offline', 'error'):
|
|
443
|
439
|
self._subscription_table_hide()
|
|
444
|
|
- self.connected_label.show()
|
|
445
|
|
- self.add_button.set_sensitive(False)
|
|
446
|
|
- self.auto_authorize_checkbutton.hide()
|
|
|
440
|
+ self._ui.connected_label.show()
|
|
|
441
|
+ self._ui.add_button.set_sensitive(False)
|
|
|
442
|
+ self._ui.auto_authorize_checkbutton.hide()
|
|
447
|
443
|
return
|
|
448
|
444
|
self._subscription_table_show()
|
|
449
|
|
- self.auto_authorize_checkbutton.show()
|
|
450
|
|
- self.connected_label.hide()
|
|
451
|
|
- self.add_button.set_sensitive(True)
|
|
|
445
|
+ self._ui.auto_authorize_checkbutton.show()
|
|
|
446
|
+ self._ui.connected_label.hide()
|
|
|
447
|
+ self._ui.add_button.set_sensitive(True)
|
|
452
|
448
|
|
|
453
|
449
|
def transport_signed_in(self, jid):
|
|
454
|
|
- model = self.protocol_jid_combobox.get_model()
|
|
455
|
|
- row = self.protocol_jid_combobox.get_active()
|
|
|
450
|
+ model = self._ui.protocol_jid_combobox.get_model()
|
|
|
451
|
+ row = self._ui.protocol_jid_combobox.get_active()
|
|
456
|
452
|
_jid = model[row][0]
|
|
457
|
453
|
if _jid == jid:
|
|
458
|
|
- self.register_hbox.hide()
|
|
459
|
|
- self.connected_label.hide()
|
|
|
454
|
+ self._ui.register_hbox.hide()
|
|
|
455
|
+ self._ui.connected_label.hide()
|
|
460
|
456
|
self._subscription_table_show()
|
|
461
|
|
- self.auto_authorize_checkbutton.show()
|
|
462
|
|
- self.add_button.set_sensitive(True)
|
|
|
457
|
+ self._ui.auto_authorize_checkbutton.show()
|
|
|
458
|
+ self._ui.add_button.set_sensitive(True)
|
|
463
|
459
|
|
|
464
|
460
|
def transport_signed_out(self, jid):
|
|
465
|
|
- model = self.protocol_jid_combobox.get_model()
|
|
466
|
|
- row = self.protocol_jid_combobox.get_active()
|
|
|
461
|
+ model = self._ui.protocol_jid_combobox.get_model()
|
|
|
462
|
+ row = self._ui.protocol_jid_combobox.get_active()
|
|
467
|
463
|
_jid = model[row][0]
|
|
468
|
464
|
if _jid == jid:
|
|
469
|
465
|
self._subscription_table_hide()
|
|
470
|
|
- self.auto_authorize_checkbutton.hide()
|
|
471
|
|
- self.connected_label.show()
|
|
472
|
|
- self.add_button.set_sensitive(False)
|
|
|
466
|
+ self._ui.auto_authorize_checkbutton.hide()
|
|
|
467
|
+ self._ui.connected_label.show()
|
|
|
468
|
+ self._ui.add_button.set_sensitive(False)
|
|
473
|
469
|
|
|
474
|
470
|
def _nec_presence_received(self, obj):
|
|
475
|
471
|
if app.jid_is_transport(obj.jid):
|