From f0fca2d2b0ac9e4498cfc16e35ae1cbc9b28c3e0 Mon Sep 17 00:00:00 2001 From: Nikos Kouremenos Date: Sun, 12 Jun 2005 11:21:50 +0000 Subject: [PATCH] fixing UI for bookmarks --- src/config.py | 3 ++- src/groupchat_window.py | 16 +++++----------- src/roster_window.py | 24 ++++++++++++++---------- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/src/config.py b/src/config.py index 4812d6ba2..496d73e30 100644 --- a/src/config.py +++ b/src/config.py @@ -2377,7 +2377,8 @@ class ManageBookmarksWindow: 'password': bm[4], 'nick': bm[5] } gajim.connections[account[1]].store_bookmarks() - + + self.plugin.roster.make_menu() self.window.destroy() def on_cancel_button_clicked(self, widget): diff --git a/src/groupchat_window.py b/src/groupchat_window.py index a0d699201..ba6831f73 100644 --- a/src/groupchat_window.py +++ b/src/groupchat_window.py @@ -294,11 +294,11 @@ class GroupchatWindow(chat.Chat): def on_add_bookmark_menuitem_activate(self, widget): room_jid = self.get_active_jid() - bm = { 'name': '', - 'jid': self.get_active_jid(), + bm = { 'name': room_jid, + 'jid': room_jid, 'autojoin': '0', 'password': '', - 'nick': self.nicks[self.get_active_jid()] + 'nick': self.nicks[room_jid] } for bookmark in gajim.connections[self.account].bookmarks: @@ -310,14 +310,8 @@ class GroupchatWindow(chat.Chat): gajim.connections[self.account].bookmarks.append(bm) gajim.connections[self.account].store_bookmarks() - - #FIXME: use join_gc_window [where user can put password] and change the - #name of the boookmark [default: fill with room's 'name'] - dialogs.InformationDialog( - _('Bookmark has been added successfully'), - _('You can find the bookmark for room "%s" in your roster.') % \ - room_jid.split('@')[0]).get_response() - + + self.plugin.roster.make_menu() def on_message_textview_key_press_event(self, widget, event): """When a key is pressed: diff --git a/src/roster_window.py b/src/roster_window.py index ea1cab0a9..57a90a37a 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -291,10 +291,13 @@ class RosterWindow: #join gc sub_menu = gtk.Menu() - join_gc_menuitem.set_submenu(sub_menu) + join_gc_menuitem.set_submenu(sub_menu) + at_least_one_account_connected = False for account in gajim.connections: if gajim.connections[account].connected <= 1: - continue + continue + if not at_least_one_account_connected: + at_least_one_account_connected = True label = gtk.Label() label.set_markup('' + account.upper() +'') item = gtk.MenuItem() @@ -311,14 +314,15 @@ class RosterWindow: sub_menu.append(item) item.connect('activate', self.on_bookmark_menuitem_activate, account, bookmark) - - newitem = gtk.MenuItem() # seperator - sub_menu.append(newitem) - - newitem = gtk.MenuItem('Bookmarks') - sub_menu.append(newitem) - newitem.connect('activate', self.on_bookmarks_menuitem_activate) - sub_menu.show_all() + + if at_least_one_account_connected: + newitem = gtk.MenuItem() # seperator + sub_menu.append(newitem) + + newitem = gtk.MenuItem('Bookmarks') + sub_menu.append(newitem) + newitem.connect('activate', self.on_bookmarks_menuitem_activate) + sub_menu.show_all() if len(gajim.connections) >= 2: # 2 or more accounts? make submenus #add