only if connected show menuitems

This commit is contained in:
Nikos Kouremenos 2005-06-19 23:01:45 +00:00
parent f279bcf8af
commit 0eeba54e67
1 changed files with 6 additions and 0 deletions

View File

@ -325,6 +325,8 @@ class RosterWindow:
sub_menu = gtk.Menu() sub_menu = gtk.Menu()
add_new_contact_menuitem.set_submenu(sub_menu) add_new_contact_menuitem.set_submenu(sub_menu)
for account in gajim.connections: for account in gajim.connections:
if gajim.connections[account].connected <= 1: #if offline or connecting
continue
item = gtk.MenuItem(_('to ') + account + _(' account')) item = gtk.MenuItem(_('to ') + account + _(' account'))
sub_menu.append(item) sub_menu.append(item)
item.connect('activate', self.on_add_new_contact, account) item.connect('activate', self.on_add_new_contact, account)
@ -333,6 +335,8 @@ class RosterWindow:
sub_menu = gtk.Menu() sub_menu = gtk.Menu()
service_disco_menuitem.set_submenu(sub_menu) service_disco_menuitem.set_submenu(sub_menu)
for account in gajim.connections: for account in gajim.connections:
if gajim.connections[account].connected <= 1: #if offline or connecting
continue
item = gtk.MenuItem(_('using ') + account + _(' account')) item = gtk.MenuItem(_('using ') + account + _(' account'))
sub_menu.append(item) sub_menu.append(item)
item.connect('activate', self.on_service_disco_menuitem_activate, account) item.connect('activate', self.on_service_disco_menuitem_activate, account)
@ -342,6 +346,8 @@ class RosterWindow:
sub_menu = gtk.Menu() sub_menu = gtk.Menu()
new_message_menuitem.set_submenu(sub_menu) new_message_menuitem.set_submenu(sub_menu)
for account in gajim.connections: for account in gajim.connections:
if gajim.connections[account].connected <= 1: #if offline or connecting
continue
our_jid = gajim.config.get_per('accounts', account, 'name') + '@' +\ our_jid = gajim.config.get_per('accounts', account, 'name') + '@' +\
gajim.config.get_per('accounts', account, 'hostname') gajim.config.get_per('accounts', account, 'hostname')
item = gtk.MenuItem(_('as ') + our_jid) item = gtk.MenuItem(_('as ') + our_jid)