account context menu and systary context menu now contain a change status message item
TODO: global status combobox need it
This commit is contained in:
parent
15fc953638
commit
8f3dafa920
|
@ -338,4 +338,12 @@ def get_xmpp_show(show):
|
|||
if show in ['online', 'offline']:
|
||||
return None
|
||||
return show
|
||||
|
||||
|
||||
def one_account_connected():
|
||||
one_connected = False
|
||||
accounts = gajim.connections.keys()
|
||||
for acct in accounts:
|
||||
if gajim.connections[acct].connected > 1:
|
||||
one_connected = True
|
||||
break
|
||||
return one_connected
|
||||
|
|
|
@ -1003,7 +1003,12 @@ class RosterWindow:
|
|||
event_button = event.button
|
||||
|
||||
return event_button
|
||||
|
||||
|
||||
def change_status_message(self, widget, account):
|
||||
show = gajim.SHOW_LIST[gajim.connections[account].connected]
|
||||
dlg = dialogs.ChangeStatusMessageDialog(self.plugin, show)
|
||||
message = dlg.run()
|
||||
self.send_status(account, show, message)
|
||||
|
||||
def mk_menu_account(self, event, iter):
|
||||
'''Make account's popup menu'''
|
||||
|
@ -1040,19 +1045,31 @@ class RosterWindow:
|
|||
sub_menu = gtk.Menu()
|
||||
status_menuitem.set_submenu(sub_menu)
|
||||
|
||||
for show in ['online', 'chat', 'away', 'xa', 'dnd', 'invisible',
|
||||
'offline']:
|
||||
|
||||
if show == 'offline': # We add a sep before offline item
|
||||
item = gtk.SeparatorMenuItem()
|
||||
sub_menu.append(item)
|
||||
|
||||
for show in ['online', 'chat', 'away', 'xa', 'dnd', 'invisible']:
|
||||
item = gtk.ImageMenuItem(helpers.get_uf_show(show))
|
||||
icon = state_images[show]
|
||||
item.set_image(icon)
|
||||
sub_menu.append(item)
|
||||
item.connect('activate', self.change_status, account, show)
|
||||
|
||||
item = gtk.SeparatorMenuItem()
|
||||
sub_menu.append(item)
|
||||
|
||||
item = gtk.MenuItem(_('Change status message'))
|
||||
sub_menu.append(item)
|
||||
item.connect('activate', self.change_status_message, account)
|
||||
if gajim.connections[account].connected < 2:
|
||||
item.set_sensitive(False)
|
||||
|
||||
item = gtk.SeparatorMenuItem()
|
||||
sub_menu.append(item)
|
||||
|
||||
item = gtk.ImageMenuItem(helpers.get_uf_show('offline'))
|
||||
icon = state_images['offline']
|
||||
item.set_image(icon)
|
||||
sub_menu.append(item)
|
||||
item.connect('activate', self.change_status, account, 'offline')
|
||||
|
||||
xml_console_menuitem.connect('activate', self.on_xml_console_menuitem_activate,
|
||||
account)
|
||||
set_motd_menuitem.connect('activate', self.on_set_motd_menuitem_activate, account)
|
||||
|
@ -1383,11 +1400,7 @@ _('If "%s" accepts this request you will know his status.') %jid)
|
|||
self.update_status_comboxbox()
|
||||
return
|
||||
status = model[active][2].decode('utf-8')
|
||||
one_connected = False
|
||||
for acct in accounts:
|
||||
if gajim.connections[acct].connected > 1:
|
||||
one_connected = True
|
||||
break
|
||||
one_connected = helpers.one_account_connected()
|
||||
if status == 'invisible':
|
||||
bug_user = False
|
||||
for acct in accounts:
|
||||
|
|
|
@ -130,20 +130,32 @@ class Systray:
|
|||
iconset = 'sun'
|
||||
path = os.path.join(gajim.DATA_DIR, 'iconsets/' + iconset + '/16x16/')
|
||||
state_images = self.plugin.roster.load_iconset(path)
|
||||
|
||||
for show in ['online', 'chat', 'away', 'xa', 'dnd', 'invisible',
|
||||
'offline']:
|
||||
|
||||
if show == 'offline': # We add a sep before offline item
|
||||
item = gtk.SeparatorMenuItem()
|
||||
sub_menu.append(item)
|
||||
|
||||
for show in ['online', 'chat', 'away', 'xa', 'dnd', 'invisible']:
|
||||
uf_show = helpers.get_uf_show(show)
|
||||
item = gtk.ImageMenuItem(uf_show)
|
||||
item.set_image(state_images[show])
|
||||
sub_menu.append(item)
|
||||
item.connect('activate', self.on_show_menuitem_activate, show)
|
||||
|
||||
item = gtk.SeparatorMenuItem()
|
||||
sub_menu.append(item)
|
||||
|
||||
item = gtk.MenuItem(_('Change status message'))
|
||||
sub_menu.append(item)
|
||||
item.connect('activate', self.on_change_status_message_activate)
|
||||
if not helpers.one_account_connected():
|
||||
item.set_sensitive(False)
|
||||
|
||||
item = gtk.SeparatorMenuItem()
|
||||
sub_menu.append(item)
|
||||
|
||||
uf_show = helpers.get_uf_show('offline')
|
||||
item = gtk.ImageMenuItem(uf_show)
|
||||
item.set_image(state_images['offline'])
|
||||
sub_menu.append(item)
|
||||
item.connect('activate', self.on_show_menuitem_activate, 'offline')
|
||||
|
||||
iskey = len(gajim.connections) > 0
|
||||
chat_with_menuitem.set_sensitive(iskey)
|
||||
new_message_menuitem.set_sensitive(iskey)
|
||||
|
@ -295,7 +307,15 @@ class Systray:
|
|||
l = ['online', 'chat', 'away', 'xa', 'dnd', 'invisible', 'offline']
|
||||
index = l.index(show)
|
||||
self.plugin.roster.status_combobox.set_active(index)
|
||||
|
||||
|
||||
def on_change_status_message_activate(self, widget):
|
||||
dlg = dialogs.ChangeStatusMessageDialog(self.plugin)
|
||||
message = dlg.run()
|
||||
accounts = gajim.connections.keys()
|
||||
for acct in accounts:
|
||||
show = gajim.SHOW_LIST[gajim.connections[acct].connected]
|
||||
self.plugin.roster.send_status(acct, show, message)
|
||||
|
||||
def show_tooltip(self, widget):
|
||||
position = widget.window.get_origin()
|
||||
if self.tooltip.id == position:
|
||||
|
|
Loading…
Reference in New Issue