[gtk+] Allow applications to use gtk-enable-mnemonics in 3.12



commit ba0542dc51f89a0df0b42c26eaab530143c0678c
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Sep 23 13:01:49 2013 -0400

    Allow applications to use gtk-enable-mnemonics in 3.12
    
    gnome-terminal is still using this setting, so we'll let
    applications override it for another cycle. It is no longer
    backed by a system-wide setting, though, and it will still
    go away eventually.
    
    This partically reverts 7e3a494fac62140f466fc43f6cc061215953e9b1

 gtk/gtklabel.c     |   11 +++++++++++
 gtk/gtkmenushell.c |   10 +++++++++-
 gtk/gtksettings.c  |    5 +++--
 3 files changed, 23 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index 5858034..fcbd016 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -1871,6 +1871,9 @@ gtk_label_screen_changed (GtkWidget *widget,
 
   if (! shortcuts_connected)
     {
+      g_signal_connect (settings, "notify::gtk-enable-mnemonics",
+                        G_CALLBACK (label_shortcut_setting_changed),
+                        NULL);
       g_signal_connect (settings, "notify::gtk-enable-accels",
                         G_CALLBACK (label_shortcut_setting_changed),
                         NULL);
@@ -2522,6 +2525,10 @@ gtk_label_set_markup_internal (GtkLabel    *label,
       gboolean enable_mnemonics = TRUE;
       gboolean auto_mnemonics = TRUE;
 
+      g_object_get (gtk_widget_get_settings (GTK_WIDGET (label)),
+                    "gtk-enable-mnemonics", &enable_mnemonics,
+                    NULL);
+
       if (!(enable_mnemonics && priv->mnemonics_visible &&
             (!auto_mnemonics ||
              (gtk_widget_is_sensitive (GTK_WIDGET (label)) &&
@@ -2737,6 +2744,10 @@ gtk_label_set_pattern_internal (GtkLabel    *label,
 
   if (is_mnemonic)
     {
+      g_object_get (gtk_widget_get_settings (GTK_WIDGET (label)),
+                    "gtk-enable-mnemonics", &enable_mnemonics,
+                    NULL);
+
       if (enable_mnemonics && priv->mnemonics_visible && pattern &&
           (!auto_mnemonics ||
            (gtk_widget_is_sensitive (GTK_WIDGET (label)) &&
diff --git a/gtk/gtkmenushell.c b/gtk/gtkmenushell.c
index 48a00ea..7e2dbe7 100644
--- a/gtk/gtkmenushell.c
+++ b/gtk/gtkmenushell.c
@@ -955,6 +955,7 @@ gtk_menu_shell_key_press (GtkWidget   *widget,
 {
   GtkMenuShell *menu_shell = GTK_MENU_SHELL (widget);
   GtkMenuShellPrivate *priv = menu_shell->priv;
+  gboolean enable_mnemonics;
 
   priv->keyboard_mode = TRUE;
 
@@ -965,7 +966,14 @@ gtk_menu_shell_key_press (GtkWidget   *widget,
   if (gtk_bindings_activate_event (G_OBJECT (widget), event))
     return TRUE;
 
-  return gtk_menu_shell_activate_mnemonic (menu_shell, event);
+  g_object_get (gtk_widget_get_settings (widget),
+                "gtk-enable-mnemonics", &enable_mnemonics,
+                NULL);
+
+  if (enable_mnemonics)
+    return gtk_menu_shell_activate_mnemonic (menu_shell, event);
+
+  return FALSE;
 }
 
 static gint
diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c
index 3182cea..ebde1ef 100644
--- a/gtk/gtksettings.c
+++ b/gtk/gtksettings.c
@@ -1006,14 +1006,15 @@ gtk_settings_class_init (GtkSettingsClass *class)
    *
    * Since: 2.12
    *
-   * Deprecated: 3.10: This setting is ignored
+   * Deprecated: 3.10: This setting can still be used for application
+   *      overrides, but will be ignored in the future
    */
   result = settings_install_property_parser (class,
                                              g_param_spec_boolean ("gtk-enable-mnemonics",
                                                                    P_("Enable Mnemonics"),
                                                                    P_("Whether labels should have 
mnemonics"),
                                                                    TRUE,
-                                                                   GTK_PARAM_READWRITE | G_PARAM_DEPRECATED),
+                                                                   GTK_PARAM_READWRITE),
                                              NULL);
   g_assert (result == PROP_ENABLE_MNEMONICS);
 


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