From d5fdbc7a4537f3d75447c78533fd2d6b0862ed83 Mon Sep 17 00:00:00 2001 From: Nikos Kouremenos Date: Sat, 11 Jun 2005 17:49:10 +0000 Subject: [PATCH] fixing a traceback from previous commit --- src/roster_window.py | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/roster_window.py b/src/roster_window.py index cd0e5075c..0199044db 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -241,12 +241,15 @@ class RosterWindow: model.set_value(iter, 0, img) model.set_value(iter, 1, name) - def join_gc_room(self, account, bm): - jid = bm['jid'] - self.new_room(jid, bm['nick'], account) + def join_gc_room(self, account, bookmark): + jid = bookmark['jid'] + self.new_room(jid, bookmark['nick'], account) self.plugin.windows[account]['gc'][jid].set_active_tab(jid) 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): widget.set_state(gtk.STATE_NORMAL) #do not allow selected_state @@ -290,6 +293,8 @@ class RosterWindow: sub_menu = gtk.Menu() join_gc_menuitem.set_submenu(sub_menu) for account in gajim.connections: + if gajim.connections[account].connected <= 1: + continue label = gtk.Label() label.set_markup('' + account.upper() +'') item = gtk.MenuItem() @@ -297,17 +302,16 @@ class RosterWindow: item.connect('state-changed', self.on_bm_header_changed_state) sub_menu.append(item) - item = gtk.MenuItem(_('New Room')) + item = gtk.MenuItem(_('New _Room')) sub_menu.append(item) 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: + print bookmark['name'] item = gtk.MenuItem(bookmark['name']) 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 sub_menu.append(newitem)