From fd03253594d2eb6312daf73c00beeb097c6c8ef6 Mon Sep 17 00:00:00 2001 From: Yann Leboulanger Date: Tue, 5 Jul 2005 20:47:25 +0000 Subject: [PATCH] show Ctrl+N only when we have only one account --- src/gtkgui.glade | 19 +++++++++---------- src/roster_window.py | 13 +++++++++++++ 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/gtkgui.glade b/src/gtkgui.glade index e0c21eb6d..997a88d92 100644 --- a/src/gtkgui.glade +++ b/src/gtkgui.glade @@ -45,10 +45,9 @@ True _New Message True - - + True gtk-new 1 @@ -68,7 +67,7 @@ True - + True gtk-connect 1 @@ -94,7 +93,7 @@ True - + True gtk-add 1 @@ -114,7 +113,7 @@ True - + True gtk-find 1 @@ -152,7 +151,7 @@ - + True gtk-about 1 @@ -180,7 +179,7 @@ - + True gtk-quit 1 @@ -215,7 +214,7 @@ - + True gtk-network 1 @@ -236,7 +235,7 @@ - + True gtk-properties 1 @@ -264,7 +263,7 @@ - + True gtk-preferences 1 diff --git a/src/roster_window.py b/src/roster_window.py index 870cd2a82..392050660 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -296,6 +296,12 @@ class RosterWindow: join_gc_menuitem.remove_submenu() new_message_menuitem.remove_submenu() + #remove the existing accelerator + if self.have_new_message_accel: + ag = gtk.accel_groups_from_object(self.window)[0] + new_message_menuitem.remove_accelerator(ag, gtk.keysyms.n, gtk.gdk.CONTROL_MASK) + self.have_new_message_accel = False + #join gc sub_menu = gtk.Menu() join_gc_menuitem.set_submenu(sub_menu) @@ -383,6 +389,10 @@ class RosterWindow: self.new_message_menuitem_handler_id = new_message_menuitem.\ connect('activate', self.on_new_message_menuitem_activate, gajim.connections.keys()[0]) + if not self.have_new_message_accel: + ag = gtk.accel_groups_from_object(self.window)[0] + new_message_menuitem.add_accelerator('activate', ag, gtk.keysyms.n, gtk.gdk.CONTROL_MASK, gtk.ACCEL_VISIBLE) + self.have_new_message_accel = True if at_least_one_account_connected: new_message_menuitem.set_sensitive(True) @@ -1742,6 +1752,9 @@ _('If "%s" accepts this request you will know his status.') %jid).get_response() self.new_message_menuitem_handler_id = False self.regroup = 0 self.regroup = gajim.config.get('mergeaccounts') + #FIXME: When list_accel_closures will be wrapped in pygtk + # no need of this variable + self.have_new_message_accel = False # Is the "Ctrl+N" shown ? if gajim.config.get('saveposition'): self.window.move(gajim.config.get('x-position'), gajim.config.get('y-position'))