| ... |
... |
@@ -46,7 +46,6 @@ class StatusIcon: |
|
46
|
46
|
def __init__(self):
|
|
47
|
47
|
self.single_message_handler_id = None
|
|
48
|
48
|
self.show_roster_handler_id = None
|
|
49
|
|
- self.new_chat_handler_id = None
|
|
50
|
49
|
# click somewhere else does not popdown menu. workaround this.
|
|
51
|
50
|
self.added_hide_menuitem = False
|
|
52
|
51
|
self.status = 'offline'
|
| ... |
... |
@@ -170,7 +169,7 @@ class StatusIcon: |
|
170
|
169
|
def on_single_message_menuitem_activate(self, widget, account):
|
|
171
|
170
|
SingleMessageWindow(account, action='send')
|
|
172
|
171
|
|
|
173
|
|
- def on_new_chat(self, widget, account):
|
|
|
172
|
+ def on_new_chat(self, _widget):
|
|
174
|
173
|
app.app.activate_action('start-chat', GLib.Variant('s', ''))
|
|
175
|
174
|
|
|
176
|
175
|
def make_menu(self, event_button, event_time):
|
| ... |
... |
@@ -180,7 +179,7 @@ class StatusIcon: |
|
180
|
179
|
for m in self.popup_menus:
|
|
181
|
180
|
m.destroy()
|
|
182
|
181
|
|
|
183
|
|
- chat_with_menuitem = self._ui.chat_with_menuitem
|
|
|
182
|
+ start_chat_menuitem = self._ui.start_chat_menuitem
|
|
184
|
183
|
single_message_menuitem = self._ui.single_message_menuitem
|
|
185
|
184
|
status_menuitem = self._ui.status_menu
|
|
186
|
185
|
join_gc_menuitem = self._ui.join_gc_menuitem
|
| ... |
... |
@@ -191,9 +190,6 @@ class StatusIcon: |
|
191
|
190
|
single_message_menuitem.handler_disconnect(
|
|
192
|
191
|
self.single_message_handler_id)
|
|
193
|
192
|
self.single_message_handler_id = None
|
|
194
|
|
- if self.new_chat_handler_id:
|
|
195
|
|
- chat_with_menuitem.disconnect(self.new_chat_handler_id)
|
|
196
|
|
- self.new_chat_handler_id = None
|
|
197
|
193
|
|
|
198
|
194
|
sub_menu = Gtk.Menu()
|
|
199
|
195
|
self.popup_menus.append(sub_menu)
|
| ... |
... |
@@ -229,34 +225,11 @@ class StatusIcon: |
|
229
|
225
|
|
|
230
|
226
|
iskey = connected_accounts > 0 and not (connected_accounts == 1 and
|
|
231
|
227
|
app.zeroconf_is_connected())
|
|
232
|
|
- chat_with_menuitem.set_sensitive(iskey)
|
|
|
228
|
+ start_chat_menuitem.set_sensitive(iskey)
|
|
233
|
229
|
single_message_menuitem.set_sensitive(iskey)
|
|
234
|
230
|
join_gc_menuitem.set_sensitive(iskey)
|
|
235
|
231
|
|
|
236
|
232
|
accounts_list = sorted(app.contacts.get_accounts())
|
|
237
|
|
- # items that get shown whether an account is zeroconf or not
|
|
238
|
|
- if connected_accounts > 1: # 2 or more connections? make submenus
|
|
239
|
|
- account_menu_for_chat_with = Gtk.Menu()
|
|
240
|
|
- chat_with_menuitem.set_submenu(account_menu_for_chat_with)
|
|
241
|
|
- self.popup_menus.append(account_menu_for_chat_with)
|
|
242
|
|
-
|
|
243
|
|
- for account in accounts_list:
|
|
244
|
|
- account_label = app.get_account_label(account)
|
|
245
|
|
- if app.account_is_connected(account):
|
|
246
|
|
- # for chat_with
|
|
247
|
|
- item = Gtk.MenuItem.new_with_label(
|
|
248
|
|
- _('using account %s') % account_label)
|
|
249
|
|
- account_menu_for_chat_with.append(item)
|
|
250
|
|
- item.connect('activate', self.on_new_chat, account)
|
|
251
|
|
-
|
|
252
|
|
- elif connected_accounts == 1: # one account
|
|
253
|
|
- # one account connected, no need to show 'as jid'
|
|
254
|
|
- for account in app.connections:
|
|
255
|
|
- if app.connections[account].connected > 1:
|
|
256
|
|
- # for start chat
|
|
257
|
|
- self.new_chat_handler_id = chat_with_menuitem.connect(
|
|
258
|
|
- 'activate', self.on_new_chat, account)
|
|
259
|
|
- break # No other connected account
|
|
260
|
233
|
|
|
261
|
234
|
# menu items that don't apply to zeroconf connections
|
|
262
|
235
|
if connected_accounts == 1 or (connected_accounts == 2 and \
|