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
|
@ -339,3 +339,11 @@ def get_xmpp_show(show):
|
||||||
return None
|
return None
|
||||||
return show
|
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
|
||||||
|
|
|
@ -1004,6 +1004,11 @@ class RosterWindow:
|
||||||
|
|
||||||
return 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):
|
def mk_menu_account(self, event, iter):
|
||||||
'''Make account's popup menu'''
|
'''Make account's popup menu'''
|
||||||
|
@ -1040,19 +1045,31 @@ class RosterWindow:
|
||||||
sub_menu = gtk.Menu()
|
sub_menu = gtk.Menu()
|
||||||
status_menuitem.set_submenu(sub_menu)
|
status_menuitem.set_submenu(sub_menu)
|
||||||
|
|
||||||
for show in ['online', 'chat', 'away', 'xa', 'dnd', 'invisible',
|
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)
|
|
||||||
|
|
||||||
item = gtk.ImageMenuItem(helpers.get_uf_show(show))
|
item = gtk.ImageMenuItem(helpers.get_uf_show(show))
|
||||||
icon = state_images[show]
|
icon = state_images[show]
|
||||||
item.set_image(icon)
|
item.set_image(icon)
|
||||||
sub_menu.append(item)
|
sub_menu.append(item)
|
||||||
item.connect('activate', self.change_status, account, show)
|
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,
|
xml_console_menuitem.connect('activate', self.on_xml_console_menuitem_activate,
|
||||||
account)
|
account)
|
||||||
set_motd_menuitem.connect('activate', self.on_set_motd_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()
|
self.update_status_comboxbox()
|
||||||
return
|
return
|
||||||
status = model[active][2].decode('utf-8')
|
status = model[active][2].decode('utf-8')
|
||||||
one_connected = False
|
one_connected = helpers.one_account_connected()
|
||||||
for acct in accounts:
|
|
||||||
if gajim.connections[acct].connected > 1:
|
|
||||||
one_connected = True
|
|
||||||
break
|
|
||||||
if status == 'invisible':
|
if status == 'invisible':
|
||||||
bug_user = False
|
bug_user = False
|
||||||
for acct in accounts:
|
for acct in accounts:
|
||||||
|
|
|
@ -131,19 +131,31 @@ class Systray:
|
||||||
path = os.path.join(gajim.DATA_DIR, 'iconsets/' + iconset + '/16x16/')
|
path = os.path.join(gajim.DATA_DIR, 'iconsets/' + iconset + '/16x16/')
|
||||||
state_images = self.plugin.roster.load_iconset(path)
|
state_images = self.plugin.roster.load_iconset(path)
|
||||||
|
|
||||||
for show in ['online', 'chat', 'away', 'xa', 'dnd', 'invisible',
|
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)
|
|
||||||
|
|
||||||
uf_show = helpers.get_uf_show(show)
|
uf_show = helpers.get_uf_show(show)
|
||||||
item = gtk.ImageMenuItem(uf_show)
|
item = gtk.ImageMenuItem(uf_show)
|
||||||
item.set_image(state_images[show])
|
item.set_image(state_images[show])
|
||||||
sub_menu.append(item)
|
sub_menu.append(item)
|
||||||
item.connect('activate', self.on_show_menuitem_activate, show)
|
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
|
iskey = len(gajim.connections) > 0
|
||||||
chat_with_menuitem.set_sensitive(iskey)
|
chat_with_menuitem.set_sensitive(iskey)
|
||||||
new_message_menuitem.set_sensitive(iskey)
|
new_message_menuitem.set_sensitive(iskey)
|
||||||
|
@ -296,6 +308,14 @@ class Systray:
|
||||||
index = l.index(show)
|
index = l.index(show)
|
||||||
self.plugin.roster.status_combobox.set_active(index)
|
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):
|
def show_tooltip(self, widget):
|
||||||
position = widget.window.get_origin()
|
position = widget.window.get_origin()
|
||||||
if self.tooltip.id == position:
|
if self.tooltip.id == position:
|
||||||
|
|
Loading…
Reference in New Issue