avoid libglade overuse. a workaround until we redisgn the whole thing
This commit is contained in:
parent
2df99a76a9
commit
d08770000b
|
@ -1227,20 +1227,25 @@ class roster_window:
|
||||||
|
|
||||||
def makemenu(self):
|
def makemenu(self):
|
||||||
"""create the browse agents, add contact & join groupchat sub menus"""
|
"""create the browse agents, add contact & join groupchat sub menus"""
|
||||||
|
# try to avoid WIDGET_REALIZED_FOR_EVENT failed which freezes gajim
|
||||||
|
new_message_menuitem = self.xml.get_widget('new_message_menuitem')
|
||||||
|
join_gc_menuitem = self.xml.get_widget('join_gc_menuitem')
|
||||||
|
add_contact_menuitem = self.xml.get_widget('add_contact_menuitem')
|
||||||
|
browse_agents_menuitem = self.xml.get_widget('browse_agents_menuitem')
|
||||||
if len(self.plugin.accounts.keys()) > 0:
|
if len(self.plugin.accounts.keys()) > 0:
|
||||||
self.xml.get_widget('new_message_menuitem').set_sensitive(True)
|
new_message_menuitem.set_sensitive(True)
|
||||||
self.xml.get_widget('join_gc_menuitem').set_sensitive(True)
|
join_gc_menuitem.set_sensitive(True)
|
||||||
self.xml.get_widget('add_contact_menuitem').set_sensitive(True)
|
add_contact_menuitem.set_sensitive(True)
|
||||||
self.xml.get_widget('browse_agents_menuitem').set_sensitive(True)
|
browse_agents_menuitem.set_sensitive(True)
|
||||||
else:
|
else:
|
||||||
self.xml.get_widget('new_message_menuitem').set_sensitive(False)
|
new_message_menuitem.set_sensitive(False)
|
||||||
self.xml.get_widget('join_gc_menuitem').set_sensitive(False)
|
join_gc_menuitem.set_sensitive(False)
|
||||||
self.xml.get_widget('add_contact_menuitem').set_sensitive(False)
|
add_contact_menuitem.set_sensitive(False)
|
||||||
self.xml.get_widget('browse_agents_menuitem').set_sensitive(False)
|
browse_agents_menuitem.set_sensitive(False)
|
||||||
if len(self.plugin.accounts.keys()) > 1: # 2 or more accounts? make submenus
|
if len(self.plugin.accounts.keys()) > 1: # 2 or more accounts? make submenus
|
||||||
#add
|
#add
|
||||||
menu_sub = gtk.Menu()
|
menu_sub = gtk.Menu()
|
||||||
self.xml.get_widget('add_contact_menuitem').set_submenu(menu_sub)
|
add_contact_menuitem.set_submenu(menu_sub)
|
||||||
for account in self.plugin.accounts.keys():
|
for account in self.plugin.accounts.keys():
|
||||||
item = gtk.MenuItem('using ' + account + ' account')
|
item = gtk.MenuItem('using ' + account + ' account')
|
||||||
menu_sub.append(item)
|
menu_sub.append(item)
|
||||||
|
@ -1248,7 +1253,7 @@ class roster_window:
|
||||||
menu_sub.show_all()
|
menu_sub.show_all()
|
||||||
#agents
|
#agents
|
||||||
menu_sub = gtk.Menu()
|
menu_sub = gtk.Menu()
|
||||||
self.xml.get_widget('browse_agents_menuitem').set_submenu(menu_sub)
|
browse_agents_menuitem.set_submenu(menu_sub)
|
||||||
for account in self.plugin.accounts.keys():
|
for account in self.plugin.accounts.keys():
|
||||||
item = gtk.MenuItem('using ' + account + ' account')
|
item = gtk.MenuItem('using ' + account + ' account')
|
||||||
menu_sub.append(item)
|
menu_sub.append(item)
|
||||||
|
@ -1256,7 +1261,7 @@ class roster_window:
|
||||||
menu_sub.show_all()
|
menu_sub.show_all()
|
||||||
#join gc
|
#join gc
|
||||||
menu_sub = gtk.Menu()
|
menu_sub = gtk.Menu()
|
||||||
self.xml.get_widget('join_gc_menuitem').set_submenu(menu_sub)
|
join_gc_menuitem.set_submenu(menu_sub)
|
||||||
for account in self.plugin.accounts.keys():
|
for account in self.plugin.accounts.keys():
|
||||||
item = gtk.MenuItem('using ' + account + ' account')
|
item = gtk.MenuItem('using ' + account + ' account')
|
||||||
menu_sub.append(item)
|
menu_sub.append(item)
|
||||||
|
@ -1264,7 +1269,7 @@ class roster_window:
|
||||||
menu_sub.show_all()
|
menu_sub.show_all()
|
||||||
#new message
|
#new message
|
||||||
menu_sub = gtk.Menu()
|
menu_sub = gtk.Menu()
|
||||||
self.xml.get_widget('new_message_menuitem').set_submenu(menu_sub)
|
new_message_menuitem.set_submenu(menu_sub)
|
||||||
for account in self.plugin.accounts.keys():
|
for account in self.plugin.accounts.keys():
|
||||||
item = gtk.MenuItem('using ' + account + ' account')
|
item = gtk.MenuItem('using ' + account + ' account')
|
||||||
menu_sub.append(item)
|
menu_sub.append(item)
|
||||||
|
@ -1553,7 +1558,7 @@ class roster_window:
|
||||||
item = gtk.MenuItem(_("_Add contact"))
|
item = gtk.MenuItem(_("_Add contact"))
|
||||||
menu.append(item)
|
menu.append(item)
|
||||||
item.connect("activate", self.on_add_contact, account)
|
item.connect("activate", self.on_add_contact, account)
|
||||||
item = gtk.MenuItem(_('_New Message'))
|
item = gtk.MenuItem(_('_New message'))
|
||||||
menu.append(item)
|
menu.append(item)
|
||||||
item.connect("activate", self.on_new_message_menuitem_activate, account)
|
item.connect("activate", self.on_new_message_menuitem_activate, account)
|
||||||
if not self.plugin.connected[account]:
|
if not self.plugin.connected[account]:
|
||||||
|
|
Loading…
Reference in New Issue