add advanced_menuitem.set_sensitive(val) depending on conditions (if no accounts it is False, else True)

This commit is contained in:
Nikos Kouremenos 2005-08-18 16:51:03 +00:00
parent 444346a789
commit 277e040c0d
1 changed files with 8 additions and 2 deletions

View File

@ -362,6 +362,9 @@ class RosterWindow:
'show_offline_contacts_menuitem') 'show_offline_contacts_menuitem')
profile_avatar_menuitem = self.xml.get_widget('profile_avatar_menuitem') profile_avatar_menuitem = self.xml.get_widget('profile_avatar_menuitem')
# make it sensitive. it is insensitive only if no accounts are *available*
advanced_menuitem.set_sensitive(True)
if self.add_new_contact_handler_id: if self.add_new_contact_handler_id:
add_new_contact_menuitem.handler_disconnect( add_new_contact_menuitem.handler_disconnect(
@ -396,7 +399,7 @@ class RosterWindow:
sub_menu = gtk.Menu() sub_menu = gtk.Menu()
join_gc_menuitem.set_submenu(sub_menu) join_gc_menuitem.set_submenu(sub_menu)
at_least_one_account_connected = False at_least_one_account_connected = False
multiple_accounts = len(gajim.connections) >= 2 multiple_accounts = len(gajim.connections) >= 2 #FIXME: stop using bool var here
for account in gajim.connections: for account in gajim.connections:
if gajim.connections[account].connected <= 1: #if offline or connecting if gajim.connections[account].connected <= 1: #if offline or connecting
continue continue
@ -420,7 +423,8 @@ class RosterWindow:
account, bookmark) account, bookmark)
sub_menu.append(item) sub_menu.append(item)
if at_least_one_account_connected: if at_least_one_account_connected: #FIXME: move this below where we do this check
#and make sure it works
newitem = gtk.SeparatorMenuItem() # seperator newitem = gtk.SeparatorMenuItem() # seperator
sub_menu.append(newitem) sub_menu.append(newitem)
@ -514,6 +518,8 @@ class RosterWindow:
advanced_menuitem_menu = self.get_and_connect_advanced_menuitem_menu( advanced_menuitem_menu = self.get_and_connect_advanced_menuitem_menu(
account) account)
advanced_menuitem.set_submenu(advanced_menuitem_menu) advanced_menuitem.set_submenu(advanced_menuitem_menu)
elif len(gajim.connections) == 0: # user has no accounts
advanced_menuitem.set_sensitive(False)
#FIXME: Gajim 0.9 should have this visible #FIXME: Gajim 0.9 should have this visible