[gimp] Remove the possibility to disable mnemonics (bug #120034)



commit 6fd729cfb691cf2b0f6b9e1b9febea38711bfe41
Author: Michael Natterer <mitch gimp org>
Date:   Sat Jul 18 17:51:04 2009 +0200

    Remove the possibility to disable mnemonics (bug #120034)
    
    There is GtkSettings:gtk-enable-mnemonics: now, so there is no
    reason to do the same in GIMP:
    
    * app/config/gimpguiconfig.[ch]: turn "menu-mnemonics" into a dummy.
    
    * app/dialogs/preferences-dialog.c: remove its GUI.
    
    * app/widgets/gimpactionfactory.[ch]
    * app/widgets/gimpactiongroup.[ch]: remove infrastructure for disabling
      menu mnemonics.
    
    * app/actions/actions.c: bye bye glue code.

 app/actions/actions.c            |   10 +---
 app/config/gimpguiconfig.c       |   20 +++-----
 app/config/gimpguiconfig.h       |    1 -
 app/dialogs/preferences-dialog.c |    3 -
 app/widgets/gimpactionfactory.c  |    7 +--
 app/widgets/gimpactionfactory.h  |    5 +--
 app/widgets/gimpactiongroup.c    |   93 ++++++-------------------------------
 app/widgets/gimpactiongroup.h    |    2 -
 8 files changed, 28 insertions(+), 113 deletions(-)
---
diff --git a/app/actions/actions.c b/app/actions/actions.c
index f5b86b9..f84b27c 100644
--- a/app/actions/actions.c
+++ b/app/actions/actions.c
@@ -24,8 +24,6 @@
 
 #include "actions-types.h"
 
-#include "config/gimpguiconfig.h"
-
 #include "core/gimp.h"
 #include "core/gimpcontainer.h"
 #include "core/gimpcontext.h"
@@ -227,16 +225,12 @@ static const GimpActionFactoryEntry action_groups[] =
 void
 actions_init (Gimp *gimp)
 {
-  GimpGuiConfig *gui_config;
-  gint           i;
+  gint i;
 
   g_return_if_fail (GIMP_IS_GIMP (gimp));
   g_return_if_fail (global_action_factory == NULL);
 
-  gui_config = GIMP_GUI_CONFIG (gimp->config);
-
-  global_action_factory = gimp_action_factory_new (gimp,
-                                                   gui_config->menu_mnemonics);
+  global_action_factory = gimp_action_factory_new (gimp);
 
   for (i = 0; i < G_N_ELEMENTS (action_groups); i++)
     gimp_action_factory_group_register (global_action_factory,
diff --git a/app/config/gimpguiconfig.c b/app/config/gimpguiconfig.c
index e84b6c8..2af33b3 100644
--- a/app/config/gimpguiconfig.c
+++ b/app/config/gimpguiconfig.c
@@ -64,7 +64,6 @@ enum
   PROP_CAN_CHANGE_ACCELS,
   PROP_SAVE_ACCELS,
   PROP_RESTORE_ACCELS,
-  PROP_MENU_MNEMONICS,
   PROP_LAST_OPENED_SIZE,
   PROP_MAX_NEW_IMAGE_SIZE,
   PROP_TOOLBOX_COLOR_AREA,
@@ -87,6 +86,7 @@ enum
 
   /* ignored, only for backward compatibility: */
   PROP_INFO_WINDOW_PER_DISPLAY,
+  PROP_MENU_MNEMONICS,
   PROP_SHOW_TOOL_TIPS,
   PROP_SHOW_TIPS
 };
@@ -177,11 +177,6 @@ gimp_gui_config_class_init (GimpGuiConfigClass *klass)
                                     "restore-accels", RESTORE_ACCELS_BLURB,
                                     TRUE,
                                     GIMP_PARAM_STATIC_STRINGS);
-  GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_MENU_MNEMONICS,
-                                    "menu-mnemonics", MENU_MNEMONICS_BLURB,
-                                    TRUE,
-                                    GIMP_PARAM_STATIC_STRINGS |
-                                    GIMP_CONFIG_PARAM_RESTART);
   GIMP_CONFIG_INSTALL_PROP_INT (object_class, PROP_LAST_OPENED_SIZE,
                                 "last-opened-size", LAST_OPENED_SIZE_BLURB,
                                 0, 1024, 10,
@@ -286,6 +281,11 @@ gimp_gui_config_class_init (GimpGuiConfigClass *klass)
                                     FALSE,
                                     GIMP_PARAM_STATIC_STRINGS |
                                     GIMP_CONFIG_PARAM_IGNORE);
+  GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_MENU_MNEMONICS,
+                                    "menu-mnemonics", MENU_MNEMONICS_BLURB,
+                                    TRUE,
+                                    GIMP_PARAM_STATIC_STRINGS |
+                                    GIMP_CONFIG_PARAM_IGNORE);
   GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_TOOL_TIPS,
                                     "show-tool-tips", NULL,
                                     FALSE,
@@ -366,9 +366,6 @@ gimp_gui_config_set_property (GObject      *object,
     case PROP_RESTORE_ACCELS:
       gui_config->restore_accels = g_value_get_boolean (value);
       break;
-    case PROP_MENU_MNEMONICS:
-      gui_config->menu_mnemonics = g_value_get_boolean (value);
-      break;
     case PROP_LAST_OPENED_SIZE:
       gui_config->last_opened_size = g_value_get_int (value);
       break;
@@ -433,6 +430,7 @@ gimp_gui_config_set_property (GObject      *object,
       break;
 
     case PROP_INFO_WINDOW_PER_DISPLAY:
+    case PROP_MENU_MNEMONICS:
     case PROP_SHOW_TOOL_TIPS:
     case PROP_SHOW_TIPS:
       /* ignored */
@@ -493,9 +491,6 @@ gimp_gui_config_get_property (GObject    *object,
     case PROP_RESTORE_ACCELS:
       g_value_set_boolean (value, gui_config->restore_accels);
       break;
-    case PROP_MENU_MNEMONICS:
-      g_value_set_boolean (value, gui_config->menu_mnemonics);
-      break;
     case PROP_LAST_OPENED_SIZE:
       g_value_set_int (value, gui_config->last_opened_size);
       break;
@@ -555,6 +550,7 @@ gimp_gui_config_get_property (GObject    *object,
       break;
 
     case PROP_INFO_WINDOW_PER_DISPLAY:
+    case PROP_MENU_MNEMONICS:
     case PROP_SHOW_TOOL_TIPS:
     case PROP_SHOW_TIPS:
       /* ignored */
diff --git a/app/config/gimpguiconfig.h b/app/config/gimpguiconfig.h
index 68c9981..63e05a8 100644
--- a/app/config/gimpguiconfig.h
+++ b/app/config/gimpguiconfig.h
@@ -52,7 +52,6 @@ struct _GimpGuiConfig
   gboolean             can_change_accels;
   gboolean             save_accels;
   gboolean             restore_accels;
-  gboolean             menu_mnemonics;
   gint                 last_opened_size;
   guint64              max_new_image_size;
   gboolean             toolbox_color_area;
diff --git a/app/dialogs/preferences-dialog.c b/app/dialogs/preferences-dialog.c
index 9b59ea0..c2c146c 100644
--- a/app/dialogs/preferences-dialog.c
+++ b/app/dialogs/preferences-dialog.c
@@ -1633,9 +1633,6 @@ prefs_dialog_new (Gimp       *gimp,
   vbox2 = prefs_frame_new (_("Keyboard Shortcuts"),
                            GTK_CONTAINER (vbox), FALSE);
 
-  prefs_check_button_add (object, "menu-mnemonics",
-                          _("Show menu _mnemonics (access keys)"),
-                          GTK_BOX (vbox2));
   prefs_check_button_add (object, "can-change-accels",
                           _("_Use dynamic keyboard shortcuts"),
                           GTK_BOX (vbox2));
diff --git a/app/widgets/gimpactionfactory.c b/app/widgets/gimpactionfactory.c
index 0850ef4..7555456 100644
--- a/app/widgets/gimpactionfactory.c
+++ b/app/widgets/gimpactionfactory.c
@@ -81,8 +81,7 @@ gimp_action_factory_finalize (GObject *object)
 }
 
 GimpActionFactory *
-gimp_action_factory_new (Gimp     *gimp,
-                         gboolean  mnemonics)
+gimp_action_factory_new (Gimp *gimp)
 {
   GimpActionFactory *factory;
 
@@ -90,8 +89,7 @@ gimp_action_factory_new (Gimp     *gimp,
 
   factory = g_object_new (GIMP_TYPE_ACTION_FACTORY, NULL);
 
-  factory->gimp      = gimp;
-  factory->mnemonics = mnemonics ? TRUE : FALSE;
+  factory->gimp = gimp;
 
   return factory;
 }
@@ -146,7 +144,6 @@ gimp_action_factory_group_new (GimpActionFactory *factory,
                                          entry->identifier,
                                          entry->label,
                                          entry->stock_id,
-                                         factory->mnemonics,
                                          user_data,
                                          entry->update_func);
 
diff --git a/app/widgets/gimpactionfactory.h b/app/widgets/gimpactionfactory.h
index 1bff478..9f0e610 100644
--- a/app/widgets/gimpactionfactory.h
+++ b/app/widgets/gimpactionfactory.h
@@ -53,8 +53,6 @@ struct _GimpActionFactory
 
   Gimp       *gimp;
   GList      *registered_groups;
-
-  gboolean    mnemonics;
 };
 
 struct _GimpActionFactoryClass
@@ -65,8 +63,7 @@ struct _GimpActionFactoryClass
 
 GType               gimp_action_factory_get_type (void) G_GNUC_CONST;
 
-GimpActionFactory * gimp_action_factory_new      (Gimp              *gimp,
-                                                  gboolean           mnemonics);
+GimpActionFactory * gimp_action_factory_new      (Gimp              *gimp);
 
 void          gimp_action_factory_group_register (GimpActionFactory *factory,
                                                   const gchar       *identifier,
diff --git a/app/widgets/gimpactiongroup.c b/app/widgets/gimpactiongroup.c
index 7e6c70d..3425256 100644
--- a/app/widgets/gimpactiongroup.c
+++ b/app/widgets/gimpactiongroup.c
@@ -46,8 +46,7 @@ enum
   PROP_0,
   PROP_GIMP,
   PROP_LABEL,
-  PROP_STOCK_ID,
-  PROP_MNEMONICS
+  PROP_STOCK_ID
 };
 
 
@@ -103,13 +102,6 @@ gimp_action_group_class_init (GimpActionGroupClass *klass)
                                                         GIMP_PARAM_READWRITE |
                                                         G_PARAM_CONSTRUCT_ONLY));
 
-  g_object_class_install_property (object_class, PROP_MNEMONICS,
-                                   g_param_spec_boolean ("mnemonics",
-                                                         NULL, NULL,
-                                                         TRUE,
-                                                         GIMP_PARAM_READWRITE |
-                                                         G_PARAM_CONSTRUCT_ONLY));
-
   klass->groups = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
 }
 
@@ -223,9 +215,7 @@ gimp_action_group_set_property (GObject      *object,
     case PROP_STOCK_ID:
       group->stock_id = g_value_dup_string (value);
       break;
-    case PROP_MNEMONICS:
-      group->mnemonics = g_value_get_boolean (value);
-      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -251,9 +241,7 @@ gimp_action_group_get_property (GObject    *object,
     case PROP_STOCK_ID:
       g_value_set_string (value, group->stock_id);
       break;
-    case PROP_MNEMONICS:
-      g_value_set_boolean (value, group->mnemonics);
-      break;
+
     default:
       G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
       break;
@@ -283,7 +271,6 @@ gimp_action_group_check_unique_action (GimpActionGroup *group,
  * @name:        the name of the action group.
  * @label:       the user visible label of the action group.
  * @stock_id:    the icon of the action group.
- * @mnemonics:   whether or not to show mnemonics.
  * @user_data:   the user_data for #GtkAction callbacks.
  * @update_func: the function that will be called on
  *               gimp_action_group_update().
@@ -299,7 +286,6 @@ gimp_action_group_new (Gimp                      *gimp,
                        const gchar               *name,
                        const gchar               *label,
                        const gchar               *stock_id,
-                       gboolean                   mnemonics,
                        gpointer                   user_data,
                        GimpActionGroupUpdateFunc  update_func)
 {
@@ -313,7 +299,6 @@ gimp_action_group_new (Gimp                      *gimp,
                         "name",      name,
                         "label",     label,
                         "stock-id",  stock_id,
-                        "mnemonics", mnemonics,
                         NULL);
 
   group->user_data   = user_data;
@@ -362,7 +347,7 @@ gimp_action_group_add_actions (GimpActionGroup       *group,
   for (i = 0; i < n_entries; i++)
     {
       GimpAction  *action;
-      gchar       *label;
+      const gchar *label;
       const gchar *tooltip = NULL;
 
       if (! gimp_action_group_check_unique_action (group, entries[i].name))
@@ -370,7 +355,7 @@ gimp_action_group_add_actions (GimpActionGroup       *group,
 
       if (msg_context)
         {
-          label = (gchar *) g_dpgettext2 (NULL, msg_context, entries[i].label);
+          label = g_dpgettext2 (NULL, msg_context, entries[i].label);
 
           if (entries[i].tooltip)
             tooltip = g_dpgettext2 (NULL, msg_context, entries[i].tooltip);
@@ -381,15 +366,9 @@ gimp_action_group_add_actions (GimpActionGroup       *group,
           tooltip = gettext (entries[i].tooltip);
         }
 
-      if (! group->mnemonics)
-        label = gimp_strip_uline (label);
-
       action = gimp_action_new (entries[i].name, label, tooltip,
                                 entries[i].stock_id);
 
-      if (! group->mnemonics)
-        g_free (label);
-
       if (entries[i].callback)
         g_signal_connect (action, "activate",
                           entries[i].callback,
@@ -421,7 +400,7 @@ gimp_action_group_add_toggle_actions (GimpActionGroup             *group,
   for (i = 0; i < n_entries; i++)
     {
       GtkToggleAction *action;
-      gchar           *label;
+      const gchar     *label;
       const gchar     *tooltip = NULL;
 
       if (! gimp_action_group_check_unique_action (group, entries[i].name))
@@ -429,7 +408,7 @@ gimp_action_group_add_toggle_actions (GimpActionGroup             *group,
 
       if (msg_context)
         {
-          label = (gchar *) g_dpgettext2 (NULL, msg_context, entries[i].label);
+          label = g_dpgettext2 (NULL, msg_context, entries[i].label);
 
           if (entries[i].tooltip)
             tooltip = g_dpgettext2 (NULL, msg_context, entries[i].tooltip);
@@ -440,15 +419,9 @@ gimp_action_group_add_toggle_actions (GimpActionGroup             *group,
           tooltip = gettext (entries[i].tooltip);
         }
 
-      if (! group->mnemonics)
-        label = gimp_strip_uline (label);
-
       action = gimp_toggle_action_new (entries[i].name, label, tooltip,
                                        entries[i].stock_id);
 
-      if (! group->mnemonics)
-        g_free (label);
-
       gtk_toggle_action_set_active (action, entries[i].is_active);
 
       if (entries[i].callback)
@@ -486,7 +459,7 @@ gimp_action_group_add_radio_actions (GimpActionGroup            *group,
   for (i = 0; i < n_entries; i++)
     {
       GtkRadioAction *action;
-      gchar          *label;
+      const gchar    *label;
       const gchar    *tooltip = NULL;
 
       if (! gimp_action_group_check_unique_action (group, entries[i].name))
@@ -494,7 +467,7 @@ gimp_action_group_add_radio_actions (GimpActionGroup            *group,
 
       if (msg_context)
         {
-          label = (gchar *) g_dpgettext2 (NULL, msg_context, entries[i].label);
+          label = g_dpgettext2 (NULL, msg_context, entries[i].label);
 
           if (entries[i].tooltip)
             tooltip = g_dpgettext2 (NULL, msg_context, entries[i].tooltip);
@@ -505,16 +478,10 @@ gimp_action_group_add_radio_actions (GimpActionGroup            *group,
           tooltip = gettext (entries[i].tooltip);
         }
 
-      if (! group->mnemonics)
-        label = gimp_strip_uline (label);
-
       action = gimp_radio_action_new (entries[i].name, label, tooltip,
                                       entries[i].stock_id,
                                       entries[i].value);
 
-      if (! group->mnemonics)
-        g_free (label);
-
       if (i == 0)
         first_action = action;
 
@@ -558,7 +525,7 @@ gimp_action_group_add_enum_actions (GimpActionGroup           *group,
   for (i = 0; i < n_entries; i++)
     {
       GimpEnumAction *action;
-      gchar          *label;
+      const gchar    *label;
       const gchar    *tooltip = NULL;
 
       if (! gimp_action_group_check_unique_action (group, entries[i].name))
@@ -566,7 +533,7 @@ gimp_action_group_add_enum_actions (GimpActionGroup           *group,
 
       if (msg_context)
         {
-          label = (gchar *) g_dpgettext2 (NULL, msg_context, entries[i].label);
+          label = g_dpgettext2 (NULL, msg_context, entries[i].label);
 
           if (entries[i].tooltip)
             tooltip = g_dpgettext2 (NULL, msg_context, entries[i].tooltip);
@@ -577,17 +544,11 @@ gimp_action_group_add_enum_actions (GimpActionGroup           *group,
           tooltip = gettext (entries[i].tooltip);
         }
 
-      if (! group->mnemonics)
-        label = gimp_strip_uline (label);
-
       action = gimp_enum_action_new (entries[i].name, label, tooltip,
                                      entries[i].stock_id,
                                      entries[i].value,
                                      entries[i].value_variable);
 
-      if (! group->mnemonics)
-        g_free (label);
-
       if (callback)
         g_signal_connect (action, "selected",
                           callback,
@@ -620,7 +581,7 @@ gimp_action_group_add_string_actions (GimpActionGroup             *group,
   for (i = 0; i < n_entries; i++)
     {
       GimpStringAction *action;
-      gchar            *label;
+      const gchar      *label;
       const gchar      *tooltip = NULL;
 
       if (! gimp_action_group_check_unique_action (group, entries[i].name))
@@ -628,7 +589,7 @@ gimp_action_group_add_string_actions (GimpActionGroup             *group,
 
       if (msg_context)
         {
-          label = (gchar *) g_dpgettext2 (NULL, msg_context, entries[i].label);
+          label = g_dpgettext2 (NULL, msg_context, entries[i].label);
 
           if (entries[i].tooltip)
             tooltip = g_dpgettext2 (NULL, msg_context, entries[i].tooltip);
@@ -639,16 +600,10 @@ gimp_action_group_add_string_actions (GimpActionGroup             *group,
           tooltip = gettext (entries[i].tooltip);
         }
 
-      if (! group->mnemonics)
-        label = gimp_strip_uline (label);
-
       action = gimp_string_action_new (entries[i].name, label, tooltip,
                                        entries[i].stock_id,
                                        entries[i].value);
 
-      if (! group->mnemonics)
-        g_free (label);
-
       if (callback)
         g_signal_connect (action, "selected",
                           callback,
@@ -680,25 +635,16 @@ gimp_action_group_add_plug_in_actions (GimpActionGroup             *group,
   for (i = 0; i < n_entries; i++)
     {
       GimpPlugInAction *action;
-      gchar            *label;
 
       if (! gimp_action_group_check_unique_action (group, entries[i].name))
         continue;
 
-      label = (gchar *) entries[i].label;
-
-      if (! group->mnemonics)
-        label = gimp_strip_uline (label);
-
       action = gimp_plug_in_action_new (entries[i].name,
-                                        label,
+                                        entries[i].label,
                                         entries[i].tooltip,
                                         entries[i].stock_id,
                                         entries[i].procedure);
 
-      if (! group->mnemonics)
-        g_free (label);
-
       if (callback)
         g_signal_connect (action, "selected",
                           callback,
@@ -822,7 +768,6 @@ gimp_action_group_set_action_label (GimpActionGroup *group,
                                     const gchar     *label)
 {
   GtkAction *action;
-  gchar     *stripped;
 
   g_return_if_fail (GIMP_IS_ACTION_GROUP (group));
   g_return_if_fail (action_name != NULL);
@@ -837,15 +782,7 @@ gimp_action_group_set_action_label (GimpActionGroup *group,
       return;
     }
 
-  if (! group->mnemonics)
-    stripped = gimp_strip_uline (label);
-  else
-    stripped = (gchar *) label;
-
-  gtk_action_set_label (action, stripped);
-
-  if (! group->mnemonics)
-    g_free (stripped);
+  gtk_action_set_label (action, label);
 }
 
 void
diff --git a/app/widgets/gimpactiongroup.h b/app/widgets/gimpactiongroup.h
index e604225..4578bc5 100644
--- a/app/widgets/gimpactiongroup.h
+++ b/app/widgets/gimpactiongroup.h
@@ -39,7 +39,6 @@ struct _GimpActionGroup
   Gimp                      *gimp;
   gchar                     *label;
   gchar                     *stock_id;
-  gboolean                   mnemonics;
 
   gpointer                   user_data;
 
@@ -134,7 +133,6 @@ GimpActionGroup *gimp_action_group_new        (Gimp                  *gimp,
                                                const gchar           *name,
                                                const gchar           *label,
                                                const gchar           *stock_id,
-                                               gboolean               mnemonics,
                                                gpointer               user_data,
                                                GimpActionGroupUpdateFunc update_func);
 



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