ability to block / unblock a transport. Remove log on / log off (it's the same as send_custom_status)

This commit is contained in:
Yann Leboulanger 2007-12-28 23:37:06 +00:00
parent e5ba743641
commit f6ceb19876
1 changed files with 43 additions and 43 deletions

View File

@ -2831,28 +2831,6 @@ class RosterWindow:
contact = gajim.contacts.get_contact_with_highest_priority(account, jid)
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
item = gtk.ImageMenuItem(_('Send Single Message'))
icon = gtk.image_new_from_stock(gtk.STOCK_NEW, gtk.ICON_SIZE_MENU)
@ -2861,9 +2839,17 @@ class RosterWindow:
self.on_send_single_message_menuitem_activate, account, contact)
menu.append(item)
blocked = False
if jid in gajim.connections[account].blocked_contacts:
blocked = True
# Send Custom Status
send_custom_status_menuitem = gtk.ImageMenuItem(_('Send Cus_tom Status'))
# add a special img for this menuitem
if blocked:
send_custom_status_menuitem.set_image(self.load_icon('offline'))
send_custom_status_menuitem.set_sensitive(False)
else:
if gajim.interface.status_sent_to_users.has_key(account) and \
jid in gajim.interface.status_sent_to_users[account]:
send_custom_status_menuitem.set_image(self.load_icon(
@ -2933,6 +2919,20 @@ class RosterWindow:
item = gtk.SeparatorMenuItem() # separator
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
item = gtk.ImageMenuItem(_('_Remove'))
icon = gtk.image_new_from_stock(gtk.STOCK_REMOVE, gtk.ICON_SIZE_MENU)