Start chat is now available from menu in systray
This commit is contained in:
parent
7a413ec749
commit
da8488a71e
|
@ -1255,6 +1255,14 @@ class systray:
|
|||
statuss = ['online', 'away', 'xa', 'dnd', 'invisible', 'vide', 'offline']
|
||||
optionmenu.set_history(statuss.index(status))
|
||||
|
||||
def start_chat(self, widget, account, jid):
|
||||
if self.plugin.windows[account]['chats'].has_key(jid):
|
||||
self.plugin.windows[account]['chats'][jid].window.present()
|
||||
elif self.plugin.roster.contacts[account].has_key(jid):
|
||||
self.plugin.windows[account]['chats'][jid] = \
|
||||
message_Window(self.plugin.roster.contacts[account][jid][0], \
|
||||
self.plugin, account)
|
||||
|
||||
def mk_menu(self, event):
|
||||
menu = gtk.Menu()
|
||||
item = gtk.MenuItem(_("Status"))
|
||||
|
@ -1286,6 +1294,33 @@ class systray:
|
|||
item = gtk.MenuItem()
|
||||
menu.append(item)
|
||||
|
||||
item = gtk.MenuItem(_("Chat with"))
|
||||
menu.append(item)
|
||||
menu_account = gtk.Menu()
|
||||
item.set_submenu(menu_account)
|
||||
for account in self.plugin.accounts.keys():
|
||||
item = gtk.MenuItem(account)
|
||||
menu_account.append(item)
|
||||
menu_group = gtk.Menu()
|
||||
item.set_submenu(menu_group)
|
||||
for group in self.plugin.roster.groups[account].keys():
|
||||
if group == 'Agents':
|
||||
continue
|
||||
item = gtk.MenuItem(group)
|
||||
menu_group.append(item)
|
||||
menu_user = gtk.Menu()
|
||||
item.set_submenu(menu_user)
|
||||
for users in self.plugin.roster.contacts[account].values():
|
||||
user = users[0]
|
||||
if group in user.groups and user.show != 'offline' and \
|
||||
user.show != 'error':
|
||||
item = gtk.MenuItem(user.name)
|
||||
menu_user.append(item)
|
||||
item.connect("activate", self.start_chat, account, user.jid)
|
||||
|
||||
item = gtk.MenuItem()
|
||||
menu.append(item)
|
||||
|
||||
item = gtk.MenuItem(_("Quit"))
|
||||
menu.append(item)
|
||||
item.connect("activate", self.plugin.roster.on_quit)
|
||||
|
|
Loading…
Reference in New Issue