fixing a traceback from previous commit

This commit is contained in:
Nikos Kouremenos 2005-06-11 17:49:10 +00:00
parent 665d7b8a58
commit d5fdbc7a45
1 changed files with 13 additions and 9 deletions

View File

@ -241,12 +241,15 @@ class RosterWindow:
model.set_value(iter, 0, img) model.set_value(iter, 0, img)
model.set_value(iter, 1, name) model.set_value(iter, 1, name)
def join_gc_room(self, account, bm): def join_gc_room(self, account, bookmark):
jid = bm['jid'] jid = bookmark['jid']
self.new_room(jid, bm['nick'], account) self.new_room(jid, bookmark['nick'], account)
self.plugin.windows[account]['gc'][jid].set_active_tab(jid) self.plugin.windows[account]['gc'][jid].set_active_tab(jid)
self.plugin.windows[account]['gc'][jid].window.present() self.plugin.windows[account]['gc'][jid].window.present()
def on_bookmark_menuitem_activate(self, widget, account, bookmark):
self.join_gc_room(account, bookmark)
def on_bm_header_changed_state(self, widget, event): def on_bm_header_changed_state(self, widget, event):
widget.set_state(gtk.STATE_NORMAL) #do not allow selected_state widget.set_state(gtk.STATE_NORMAL) #do not allow selected_state
@ -290,6 +293,8 @@ class RosterWindow:
sub_menu = gtk.Menu() sub_menu = gtk.Menu()
join_gc_menuitem.set_submenu(sub_menu) join_gc_menuitem.set_submenu(sub_menu)
for account in gajim.connections: for account in gajim.connections:
if gajim.connections[account].connected <= 1:
continue
label = gtk.Label() label = gtk.Label()
label.set_markup('<u>' + account.upper() +'</u>') label.set_markup('<u>' + account.upper() +'</u>')
item = gtk.MenuItem() item = gtk.MenuItem()
@ -297,17 +302,16 @@ class RosterWindow:
item.connect('state-changed', self.on_bm_header_changed_state) item.connect('state-changed', self.on_bm_header_changed_state)
sub_menu.append(item) sub_menu.append(item)
item = gtk.MenuItem(_('New Room')) item = gtk.MenuItem(_('New _Room'))
sub_menu.append(item) sub_menu.append(item)
item.connect('activate', self.on_join_gc_activate, account) item.connect('activate', self.on_join_gc_activate, account)
#FIXME: delmonico hack here [get bookmakrs and add them]
if gajim.connections[account].connected <= 1:
continue
for bookmark in gajim.connections[account].bookmarks: for bookmark in gajim.connections[account].bookmarks:
print bookmark['name']
item = gtk.MenuItem(bookmark['name']) item = gtk.MenuItem(bookmark['name'])
sub_menu.append(item) sub_menu.append(item)
item.connect('activate', self.join_gc_room, account, bookmark) item.connect('activate', self.on_bookmark_menuitem_activate,
account, bookmark)
newitem = gtk.MenuItem() # seperator newitem = gtk.MenuItem() # seperator
sub_menu.append(newitem) sub_menu.append(newitem)