show Ctrl+N only when we have only one account

This commit is contained in:
Yann Leboulanger 2005-07-05 20:47:25 +00:00
parent 664e2f824b
commit fd03253594
2 changed files with 22 additions and 10 deletions

View File

@ -45,10 +45,9 @@
<property name="visible">True</property>
<property name="label" translatable="yes">_New Message</property>
<property name="use_underline">True</property>
<accelerator key="N" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image787">
<widget class="GtkImage" id="image869">
<property name="visible">True</property>
<property name="stock">gtk-new</property>
<property name="icon_size">1</property>
@ -68,7 +67,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image788">
<widget class="GtkImage" id="image870">
<property name="visible">True</property>
<property name="stock">gtk-connect</property>
<property name="icon_size">1</property>
@ -94,7 +93,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image789">
<widget class="GtkImage" id="image871">
<property name="visible">True</property>
<property name="stock">gtk-add</property>
<property name="icon_size">1</property>
@ -114,7 +113,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image790">
<widget class="GtkImage" id="image872">
<property name="visible">True</property>
<property name="stock">gtk-find</property>
<property name="icon_size">1</property>
@ -152,7 +151,7 @@
<signal name="activate" handler="on_about_menuitem_activate" last_modification_time="Tue, 01 Mar 2005 22:56:45 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image791">
<widget class="GtkImage" id="image873">
<property name="visible">True</property>
<property name="stock">gtk-about</property>
<property name="icon_size">1</property>
@ -180,7 +179,7 @@
<accelerator key="Q" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image792">
<widget class="GtkImage" id="image874">
<property name="visible">True</property>
<property name="stock">gtk-quit</property>
<property name="icon_size">1</property>
@ -215,7 +214,7 @@
<accelerator key="A" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image793">
<widget class="GtkImage" id="image875">
<property name="visible">True</property>
<property name="stock">gtk-network</property>
<property name="icon_size">1</property>
@ -236,7 +235,7 @@
<signal name="activate" handler="on_profile_avatar_activate" last_modification_time="Thu, 09 Jun 2005 22:22:16 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image794">
<widget class="GtkImage" id="image876">
<property name="visible">True</property>
<property name="stock">gtk-properties</property>
<property name="icon_size">1</property>
@ -264,7 +263,7 @@
<accelerator key="P" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image795">
<widget class="GtkImage" id="image877">
<property name="visible">True</property>
<property name="stock">gtk-preferences</property>
<property name="icon_size">1</property>

View File

@ -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'))