[gimp] app, menus: get rid of custom input method menu.



commit f6f94836c1291a2be25313aa63b40bd5e3b68105
Author: Jehan <jehan girinstud io>
Date:   Tue Dec 15 02:51:30 2020 +0100

    app, menus: get rid of custom input method menu.
    
    The input menu added with gtk_im_multicontext_append_menuitems() mostly
    provides redundant (e.g. the system defaults) or useless options
    (e.g. "None" or "Simple" which basically seems to mean the keyboard
    mapping straight keys, and I don't see why anyone would want this if one
    set a system-wide input system). Worse it can provide unstable options
    (e.g. "Wayland" which crashes GIMP when I tried it on my X11 desktop! It
    crashes on _gtk_immodule_wayland_init which is probably normal as we are
    not on a Wayland client).
    
    Anyway gtk_im_multicontext_append_menuitems() is deprecated since
    GTK+3.10, as well as the "gtk-show-input-method-menu" property which we
    read from GTK+ settings (and is FALSE anyway nowadays by default, so we
    usually never show this submenu) to determine if we should show this
    additional text tool submenu or not. Furthermore there is just no reason
    not to leave the defaults system input method engine does its job (which
    works well as far as I can see, at the very least on my GNU/Linux X11
    desktop and on Wayland also, last I tested).

 app/actions/text-tool-actions.c | 12 +-----------
 app/tools/gimptexttool.c        | 19 -------------------
 menus/text-tool-menu.xml        |  2 --
 3 files changed, 1 insertion(+), 32 deletions(-)
---
diff --git a/app/actions/text-tool-actions.c b/app/actions/text-tool-actions.c
index 1692253866..9ccfa6e3a4 100644
--- a/app/actions/text-tool-actions.c
+++ b/app/actions/text-tool-actions.c
@@ -50,10 +50,6 @@ static const GimpActionEntry text_tool_actions[] =
     NC_("text-tool-action", "Text Tool Menu"), NULL, NULL, NULL,
     NULL },
 
-  { "text-tool-input-methods-menu", NULL,
-    NC_("text-tool-action", "Input _Methods"), NULL, NULL, NULL,
-    NULL },
-
   { "text-tool-cut", GIMP_ICON_EDIT_CUT,
     NC_("text-tool-action", "Cu_t"), NULL, "<primary>X",
     text_tool_cut_cmd_callback,
@@ -150,8 +146,6 @@ text_tool_actions_setup (GimpActionGroup *group)
                                        NULL,
                                        GIMP_TEXT_DIRECTION_LTR,
                                        text_tool_direction_cmd_callback);
-
-  SET_HIDE_EMPTY ("text-tool-input-methods-menu", FALSE);
 }
 
 /* The following code is written on the assumption that this is for a
@@ -174,7 +168,6 @@ text_tool_actions_update (GimpActionGroup *group,
   gboolean          text_layer = FALSE;
   gboolean          text_sel   = FALSE;   /* some text is selected        */
   gboolean          clip       = FALSE;   /* clipboard has text available */
-  gboolean          input_method_menu;
   gboolean          unicode_menu;
   GimpTextDirection direction;
   gint              i;
@@ -195,8 +188,7 @@ text_tool_actions_update (GimpActionGroup *group,
   clip = gtk_clipboard_wait_is_text_available (clipboard);
 
   g_object_get (gtk_widget_get_settings (shell->canvas),
-                "gtk-show-input-method-menu", &input_method_menu,
-                "gtk-show-unicode-menu",      &unicode_menu,
+                "gtk-show-unicode-menu", &unicode_menu,
                 NULL);
 
 #define SET_VISIBLE(action,condition) \
@@ -224,6 +216,4 @@ text_tool_actions_update (GimpActionGroup *group,
           break;
         }
     }
-
-  SET_VISIBLE ("text-tool-input-methods-menu", input_method_menu);
 }
diff --git a/app/tools/gimptexttool.c b/app/tools/gimptexttool.c
index 9fa6f5dd2c..1472a04837 100644
--- a/app/tools/gimptexttool.c
+++ b/app/tools/gimptexttool.c
@@ -842,8 +842,6 @@ gimp_text_tool_get_popup (GimpTool         *tool,
           GimpDisplayShell  *shell = gimp_display_get_shell (tool->display);
           GimpImageWindow   *image_window;
           GimpDialogFactory *dialog_factory;
-          GtkWidget         *im_menu;
-          GList             *children;
 
           image_window   = gimp_display_shell_get_window (shell);
           dialog_factory = gimp_dock_container_get_dialog_factory (GIMP_DOCK_CONTAINER (image_window));
@@ -852,23 +850,6 @@ gimp_text_tool_get_popup (GimpTool         *tool,
             gimp_menu_factory_manager_new (gimp_dialog_factory_get_menu_factory (dialog_factory),
                                            "<TextTool>",
                                            text_tool);
-
-          im_menu = gimp_ui_manager_get_widget (text_tool->ui_manager,
-                                                "/text-tool-popup/text-tool-input-methods-menu");
-
-          if (GTK_IS_MENU_ITEM (im_menu))
-            im_menu = gtk_menu_item_get_submenu (GTK_MENU_ITEM (im_menu));
-
-          /*  hide the generated "empty" item  */
-          children = gtk_container_get_children (GTK_CONTAINER (im_menu));
-          while (children)
-            {
-              gtk_widget_hide (children->data);
-              children = g_list_remove (children, children->data);
-            }
-
-          gtk_im_multicontext_append_menuitems (GTK_IM_MULTICONTEXT (text_tool->im_context),
-                                                GTK_MENU_SHELL (im_menu));
         }
 
       gimp_ui_manager_update (text_tool->ui_manager, text_tool);
diff --git a/menus/text-tool-menu.xml b/menus/text-tool-menu.xml
index c38f86be2f..102f5b954a 100644
--- a/menus/text-tool-menu.xml
+++ b/menus/text-tool-menu.xml
@@ -20,7 +20,5 @@
     <menuitem action="text-tool-direction-ttb-rtl-upright" />
     <menuitem action="text-tool-direction-ttb-ltr" />
     <menuitem action="text-tool-direction-ttb-ltr-upright" />
-    <separator />
-    <menu action="text-tool-input-methods-menu" />
   </popup>
 </ui>


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