[gtk+] Deprecate and ignore gtk-menu-bar-accel setting



commit b26c74e5dac0b5fd869d2c8cc7a0edb6b01aeebd
Author: William Jon McCann <william jon mccann gmail com>
Date:   Wed Jun 26 14:21:44 2013 -0400

    Deprecate and ignore gtk-menu-bar-accel setting
    
    Use 'F10' by default.

 gdk/win32/gdkproperty-win32.c |    1 -
 gdk/x11/gdksettings.c         |    1 -
 gtk/gtkmenubar.c              |   59 ++++++++++++++---------------------------
 gtk/gtksettings.c             |    7 +++++
 4 files changed, 27 insertions(+), 41 deletions(-)
---
diff --git a/gdk/win32/gdkproperty-win32.c b/gdk/win32/gdkproperty-win32.c
index e6dedd6..5058f52 100644
--- a/gdk/win32/gdkproperty-win32.c
+++ b/gdk/win32/gdkproperty-win32.c
@@ -315,7 +315,6 @@ _gdk_win32_window_delete_property (GdkWindow *window,
   "Gtk/IMStatusStyle\0"       "gtk-im-status-style\0"
   "Gtk/Modules\0"             "gtk-modules\0"
   "Gtk/FileChooserBackend\0"  "gtk-file-chooser-backend\0"
-  "Gtk/MenuBarAccel\0"        "gtk-menu-bar-accel\0"
   "Gtk/CursorThemeName\0"     "gtk-cursor-theme-name\0"
   "Gtk/CursorThemeSize\0"     "gtk-cursor-theme-size\0"
   "Gtk/TimeoutInitial\0"      "gtk-timeout-initial\0"
diff --git a/gdk/x11/gdksettings.c b/gdk/x11/gdksettings.c
index 188afc4..d5ffb31 100644
--- a/gdk/x11/gdksettings.c
+++ b/gdk/x11/gdksettings.c
@@ -40,7 +40,6 @@ static const struct {
   {"Gtk/IMStatusStyle",       "gtk-im-status-style"},
   {"Gtk/Modules",             "gtk-modules"},
   {"Gtk/FileChooserBackend",  "gtk-file-chooser-backend"},
-  {"Gtk/MenuBarAccel",        "gtk-menu-bar-accel"},
   {"Gtk/CursorThemeName",     "gtk-cursor-theme-name"},
   {"Gtk/CursorThemeSize",     "gtk-cursor-theme-size"},
   {"Gtk/TimeoutInitial",      "gtk-timeout-initial"},
diff --git a/gtk/gtkmenubar.c b/gtk/gtkmenubar.c
index 0a49fed..f93afa4 100644
--- a/gtk/gtkmenubar.c
+++ b/gtk/gtkmenubar.c
@@ -700,54 +700,35 @@ window_key_press_handler (GtkWidget   *widget,
                           GdkEventKey *event,
                           gpointer     data)
 {
-  gchar *accel = NULL;
   gboolean retval = FALSE;
-  
-  g_object_get (gtk_widget_get_settings (widget),
-                "gtk-menu-bar-accel", &accel,
-                NULL);
+  guint keyval = GDK_KEY_F10;
 
-  if (accel && *accel)
+  /* FIXME this is wrong, needs to be in the global accel resolution
+   * thing, to properly consider i18n etc., but that probably requires
+   * AccelGroup changes etc.
+   */
+  if (event->keyval == keyval && event->state == 0)
     {
-      guint keyval = 0;
-      GdkModifierType mods = 0;
-
-      gtk_accelerator_parse (accel, &keyval, &mods);
+      GList *tmp_menubars = get_viewable_menu_bars (GTK_WINDOW (widget));
+      GList *menubars;
 
-      if (keyval == 0)
-        g_warning ("Failed to parse menu bar accelerator '%s'\n", accel);
+      menubars = _gtk_container_focus_sort (GTK_CONTAINER (widget), tmp_menubars,
+                                            GTK_DIR_TAB_FORWARD, NULL);
+      g_list_free (tmp_menubars);
 
-      /* FIXME this is wrong, needs to be in the global accel resolution
-       * thing, to properly consider i18n etc., but that probably requires
-       * AccelGroup changes etc.
-       */
-      if (event->keyval == keyval &&
-          ((event->state & gtk_accelerator_get_default_mod_mask ()) ==
-          (mods & gtk_accelerator_get_default_mod_mask ())))
+      if (menubars)
         {
-         GList *tmp_menubars = get_viewable_menu_bars (GTK_WINDOW (widget));
-         GList *menubars;
+          GtkMenuShell *menu_shell = GTK_MENU_SHELL (menubars->data);
 
-         menubars = _gtk_container_focus_sort (GTK_CONTAINER (widget), tmp_menubars,
-                                               GTK_DIR_TAB_FORWARD, NULL);
-         g_list_free (tmp_menubars);
-         
-         if (menubars)
-           {
-             GtkMenuShell *menu_shell = GTK_MENU_SHELL (menubars->data);
-
-              _gtk_menu_shell_set_keyboard_mode (menu_shell, TRUE);
-             gtk_menu_shell_select_first (menu_shell, FALSE);
-             
-             g_list_free (menubars);
-             
-             retval = TRUE;          
-           }
+          _gtk_menu_shell_set_keyboard_mode (menu_shell, TRUE);
+          gtk_menu_shell_select_first (menu_shell, FALSE);
+
+          g_list_free (menubars);
+
+          retval = TRUE;
         }
     }
 
-  g_free (accel);
-
   return retval;
 }
 
diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c
index 9a3e5e9..fba3b0f 100644
--- a/gtk/gtksettings.c
+++ b/gtk/gtksettings.c
@@ -473,6 +473,13 @@ gtk_settings_class_init (GtkSettingsClass *class)
                                              NULL);
   g_assert (result == PROP_KEY_THEME_NAME);
 
+  /**
+   * GtkSettings:gtk-menu-bar-accel:
+   *
+   * Keybinding to activate the menu bar.
+   *
+   * Deprecated: 3.10: This setting is ignored.
+   */
   result = settings_install_property_parser (class,
                                              g_param_spec_string ("gtk-menu-bar-accel",
                                                                   P_("Menu bar accelerator"),


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