ability to block / unblock a transport. Remove log on / log off (it's the same as send_custom_status)
This commit is contained in:
parent
e5ba743641
commit
f6ceb19876
1 changed files with 43 additions and 43 deletions
|
@ -2396,7 +2396,7 @@ class RosterWindow:
|
||||||
widget.set_sensitive(False)
|
widget.set_sensitive(False)
|
||||||
|
|
||||||
if gajim.connections[account] and gajim.connections[account].\
|
if gajim.connections[account] and gajim.connections[account].\
|
||||||
privacy_rules_supported:
|
privacy_rules_supported:
|
||||||
if jid in gajim.connections[account].blocked_contacts:
|
if jid in gajim.connections[account].blocked_contacts:
|
||||||
block_menuitem.set_no_show_all(True)
|
block_menuitem.set_no_show_all(True)
|
||||||
unblock_menuitem.connect('activate', self.on_unblock, iter, None)
|
unblock_menuitem.connect('activate', self.on_unblock, iter, None)
|
||||||
|
@ -2831,28 +2831,6 @@ class RosterWindow:
|
||||||
contact = gajim.contacts.get_contact_with_highest_priority(account, jid)
|
contact = gajim.contacts.get_contact_with_highest_priority(account, jid)
|
||||||
menu = gtk.Menu()
|
menu = gtk.Menu()
|
||||||
|
|
||||||
# Connect/Didconnect
|
|
||||||
show = contact.show
|
|
||||||
if (show != 'offline' and show != 'error') or\
|
|
||||||
gajim.account_is_disconnected(account):
|
|
||||||
# Log Off
|
|
||||||
item = gtk.ImageMenuItem(_('_Log off'))
|
|
||||||
icon = gtk.image_new_from_stock(gtk.STOCK_DISCONNECT, gtk.ICON_SIZE_MENU)
|
|
||||||
item.connect('activate', self.on_agent_logging, jid, 'unavailable',
|
|
||||||
account)
|
|
||||||
else:
|
|
||||||
# Log on
|
|
||||||
item = gtk.ImageMenuItem(_('_Log on'))
|
|
||||||
icon = gtk.image_new_from_stock(gtk.STOCK_CONNECT, gtk.ICON_SIZE_MENU)
|
|
||||||
item.connect('activate', self.on_agent_logging, jid, None, account)
|
|
||||||
item.set_image(icon)
|
|
||||||
menu.append(item)
|
|
||||||
if show == 'error':
|
|
||||||
item.set_sensitive(False)
|
|
||||||
|
|
||||||
item = gtk.SeparatorMenuItem() # separator
|
|
||||||
menu.append(item)
|
|
||||||
|
|
||||||
# Send single message
|
# Send single message
|
||||||
item = gtk.ImageMenuItem(_('Send Single Message'))
|
item = gtk.ImageMenuItem(_('Send Single Message'))
|
||||||
icon = gtk.image_new_from_stock(gtk.STOCK_NEW, gtk.ICON_SIZE_MENU)
|
icon = gtk.image_new_from_stock(gtk.STOCK_NEW, gtk.ICON_SIZE_MENU)
|
||||||
|
@ -2861,30 +2839,38 @@ class RosterWindow:
|
||||||
self.on_send_single_message_menuitem_activate, account, contact)
|
self.on_send_single_message_menuitem_activate, account, contact)
|
||||||
menu.append(item)
|
menu.append(item)
|
||||||
|
|
||||||
|
blocked = False
|
||||||
|
if jid in gajim.connections[account].blocked_contacts:
|
||||||
|
blocked = True
|
||||||
|
|
||||||
# Send Custom Status
|
# Send Custom Status
|
||||||
send_custom_status_menuitem = gtk.ImageMenuItem(_('Send Cus_tom Status'))
|
send_custom_status_menuitem = gtk.ImageMenuItem(_('Send Cus_tom Status'))
|
||||||
# add a special img for this menuitem
|
# add a special img for this menuitem
|
||||||
if gajim.interface.status_sent_to_users.has_key(account) and \
|
if blocked:
|
||||||
jid in gajim.interface.status_sent_to_users[account]:
|
send_custom_status_menuitem.set_image(self.load_icon('offline'))
|
||||||
send_custom_status_menuitem.set_image(self.load_icon(
|
send_custom_status_menuitem.set_sensitive(False)
|
||||||
gajim.interface.status_sent_to_users[account][jid]))
|
|
||||||
else:
|
else:
|
||||||
icon = gtk.image_new_from_stock(gtk.STOCK_NETWORK,
|
if gajim.interface.status_sent_to_users.has_key(account) and \
|
||||||
gtk.ICON_SIZE_MENU)
|
jid in gajim.interface.status_sent_to_users[account]:
|
||||||
send_custom_status_menuitem.set_image(icon)
|
send_custom_status_menuitem.set_image(self.load_icon(
|
||||||
status_menuitems = gtk.Menu()
|
gajim.interface.status_sent_to_users[account][jid]))
|
||||||
send_custom_status_menuitem.set_submenu(status_menuitems)
|
else:
|
||||||
iconset = gajim.config.get('iconset')
|
icon = gtk.image_new_from_stock(gtk.STOCK_NETWORK,
|
||||||
path = os.path.join(helpers.get_iconset_path(iconset), '16x16')
|
gtk.ICON_SIZE_MENU)
|
||||||
for s in ['online', 'chat', 'away', 'xa', 'dnd', 'offline']:
|
send_custom_status_menuitem.set_image(icon)
|
||||||
# icon MUST be different instance for every item
|
status_menuitems = gtk.Menu()
|
||||||
state_images = self.load_iconset(path)
|
send_custom_status_menuitem.set_submenu(status_menuitems)
|
||||||
status_menuitem = gtk.ImageMenuItem(helpers.get_uf_show(s))
|
iconset = gajim.config.get('iconset')
|
||||||
status_menuitem.connect('activate', self.on_send_custom_status,
|
path = os.path.join(helpers.get_iconset_path(iconset), '16x16')
|
||||||
[(contact, account)], s)
|
for s in ['online', 'chat', 'away', 'xa', 'dnd', 'offline']:
|
||||||
icon = state_images[s]
|
# icon MUST be different instance for every item
|
||||||
status_menuitem.set_image(icon)
|
state_images = self.load_iconset(path)
|
||||||
status_menuitems.append(status_menuitem)
|
status_menuitem = gtk.ImageMenuItem(helpers.get_uf_show(s))
|
||||||
|
status_menuitem.connect('activate', self.on_send_custom_status,
|
||||||
|
[(contact, account)], s)
|
||||||
|
icon = state_images[s]
|
||||||
|
status_menuitem.set_image(icon)
|
||||||
|
status_menuitems.append(status_menuitem)
|
||||||
menu.append(send_custom_status_menuitem)
|
menu.append(send_custom_status_menuitem)
|
||||||
|
|
||||||
item = gtk.SeparatorMenuItem() # separator
|
item = gtk.SeparatorMenuItem() # separator
|
||||||
|
@ -2933,6 +2919,20 @@ class RosterWindow:
|
||||||
item = gtk.SeparatorMenuItem() # separator
|
item = gtk.SeparatorMenuItem() # separator
|
||||||
manage_transport_submenu.append(item)
|
manage_transport_submenu.append(item)
|
||||||
|
|
||||||
|
# Block
|
||||||
|
if blocked:
|
||||||
|
item = gtk.ImageMenuItem(_('_Unblock'))
|
||||||
|
item.connect('activate', self.on_unblock, iter, None)
|
||||||
|
else:
|
||||||
|
item = gtk.ImageMenuItem(_('_Block'))
|
||||||
|
item.connect('activate', self.on_block, iter, None)
|
||||||
|
|
||||||
|
icon = gtk.image_new_from_stock(gtk.STOCK_STOP, gtk.ICON_SIZE_MENU)
|
||||||
|
item.set_image(icon)
|
||||||
|
manage_transport_submenu.append(item)
|
||||||
|
if gajim.account_is_disconnected(account):
|
||||||
|
item.set_sensitive(False)
|
||||||
|
|
||||||
# Remove
|
# Remove
|
||||||
item = gtk.ImageMenuItem(_('_Remove'))
|
item = gtk.ImageMenuItem(_('_Remove'))
|
||||||
icon = gtk.image_new_from_stock(gtk.STOCK_REMOVE, gtk.ICON_SIZE_MENU)
|
icon = gtk.image_new_from_stock(gtk.STOCK_REMOVE, gtk.ICON_SIZE_MENU)
|
||||||
|
|
Loading…
Add table
Reference in a new issue