[gnome-globalmenu] Fix issue 442.



commit a882de2990a294b227198b94becda9c77e0a5444
Author: Yu Feng <rainwoodman gmail com>
Date:   Sun Nov 8 20:29:20 2009 -0500

    Fix issue 442.
    Added a gconf key and the entry in applet preference dialog
    to disable the F10 key.

 applet/applet.vala                  |   12 +++++++-----
 libserver/globalmenubar.vala        |   14 +++++++++++++-
 schemas/gnome-globalmenu.schemas.in |   10 ++++++++++
 3 files changed, 30 insertions(+), 6 deletions(-)
---
diff --git a/applet/applet.vala b/applet/applet.vala
index 5223ed4..3669b0a 100644
--- a/applet/applet.vala
+++ b/applet/applet.vala
@@ -245,6 +245,7 @@ public class Applet : Panel.Applet {
 		switcher.enable_search_box = gconf_get_bool("enable_search_box");
 		Gnomenu.Menu.default_use_rgba_colormap = gconf_get_bool("use_rgba_colormap");
 		main_menubar.grab_keys = gconf_get_bool("grab_mnemonic_keys");
+		main_menubar.grab_menu_key = gconf_get_bool("grab_menu_bar_key");
 		main_menubar.per_monitor_mode = gconf_get_bool("per_monitor_mode");
 		this.has_handle = gconf_get_bool("has_handle");
 		this.tiny_mode = gconf_get_bool("tiny_mode");
@@ -263,17 +264,18 @@ public class Applet : Panel.Applet {
 			new string[] {
 				root + "/show_local_menu",
 				root + "/show_menu_icons",
-				root + "/use_rgba_colormap",
-				root + "/per_monitor_mode",
-				root + "/grab_mnemonic_keys"
+				root + "/per_monitor_mode"
 			}
 		);
 
 		gcd.add_key_group(
-			_("Global Menu"),
+			_("Applet"),
 			new string[]{
 				root + "/has_handle",
-				root + "/tiny_mode"
+				root + "/tiny_mode",
+				root + "/use_rgba_colormap",
+				root + "/grab_mnemonic_keys",
+				root + "/grab_menu_bar_key"
 			}
 		);
 
diff --git a/libserver/globalmenubar.vala b/libserver/globalmenubar.vala
index ec8d3bb..d208de4 100644
--- a/libserver/globalmenubar.vala
+++ b/libserver/globalmenubar.vala
@@ -19,6 +19,15 @@ public class Gnomenu.GlobalMenuBar : Gnomenu.MenuBar {
 		}
 	}
 
+	public bool _grab_menu_key = true;
+	public bool grab_menu_key {
+		get { return _grab_menu_key; }
+		set {
+			_grab_menu_key = value;
+			regrab_menu_bar_key();
+		}
+	}
+
 	public Gnomenu.Window active_window {
 		get { return active_window_monitor.active_window; }
 	}
@@ -103,6 +112,7 @@ public class Gnomenu.GlobalMenuBar : Gnomenu.MenuBar {
 			}
 		}
 	}
+
 	private void attach_to_screen(Gdk.Screen screen) {
 		active_window_monitor.attach(screen);
 		_root_window = new Window(get_root_window());
@@ -190,7 +200,9 @@ public class Gnomenu.GlobalMenuBar : Gnomenu.MenuBar {
 		uint keyval;
 		Gdk.ModifierType mods;
 		get_accel_key(out keyval, out mods);
-		_root_window.grab_key(keyval, mods);
+		if(_grab_menu_key) {
+			_root_window.grab_key(keyval, mods);
+		}
 		_root_window.set_data("menu-bar-keyval", (void*) keyval);
 		_root_window.set_data("menu-bar-keymods", (void*) mods);
 	}
diff --git a/schemas/gnome-globalmenu.schemas.in b/schemas/gnome-globalmenu.schemas.in
index 7824ea0..9120019 100644
--- a/schemas/gnome-globalmenu.schemas.in
+++ b/schemas/gnome-globalmenu.schemas.in
@@ -134,6 +134,16 @@
 		</locale>
 	</schema>
 	<schema>
+		<key>/schemas/apps/gnome-applet-globalmenu/prefs/grab_menu_bar_key</key>
+		<owner>gnome-applet-globalmenu</owner>
+		<type>bool</type>
+		<default>TRUE</default>
+		<locale name="C">
+			<short>Enable the menu bar key (F10 usually) </short>
+			<long>Accessing the global menu items by the menu bar key. When this option is disabled, the topmost menu items are not directly accessible from keyboard.</long>
+		</locale>
+	</schema>
+	<schema>
 		<key>/schemas/apps/gnome-applet-globalmenu/prefs/per_monitor_mode</key>
 		<owner>gnome-applet-globalmenu</owner>
 		<type>bool</type>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]