From dc25c2bc97a75f67541a7070efdd4d561890e4fa Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Thu, 25 May 2023 01:59:59 +0200 Subject: [PATCH] Revert "app: add a "Filters > Generic > GEGL Operations" submenu with generated actions." This reverts commit 747cbf70db32334b9c7298e14b1a15e019abc013. --- app/actions/filters-actions.c | 2 +- app/actions/filters-commands.c | 2 +- app/actions/plug-in-commands.c | 2 +- app/core/Makefile.am | 4 +- .../{gimp-filter.c => gimp-filter-history.c} | 38 +------------------ .../{gimp-filter.h => gimp-filter-history.h} | 15 ++------ app/core/gimp.c | 7 +--- app/core/gimp.h | 1 - app/core/meson.build | 2 +- app/display/gimpdisplayshell-tool-events.c | 2 +- app/menus/filters-menu.c | 11 +----- app/plug-in/gimppluginmanager.c | 2 +- app/tools/gimpgegltool.c | 6 +++ app/tools/gimpgegltool.h | 2 + menus/image-menu.ui.in.in | 11 +----- 15 files changed, 27 insertions(+), 80 deletions(-) rename app/core/{gimp-filter.c => gimp-filter-history.c} (81%) rename app/core/{gimp-filter.h => gimp-filter-history.h} (72%) diff --git a/app/actions/filters-actions.c b/app/actions/filters-actions.c index 64c06bf4de..212623ffbf 100644 --- a/app/actions/filters-actions.c +++ b/app/actions/filters-actions.c @@ -24,7 +24,7 @@ #include "actions-types.h" -#include "core/gimp-filter.h" +#include "core/gimp-filter-history.h" #include "core/gimpimage.h" #include "core/gimplayermask.h" diff --git a/app/actions/filters-commands.c b/app/actions/filters-commands.c index 2bfe55a197..389048e3a1 100644 --- a/app/actions/filters-commands.c +++ b/app/actions/filters-commands.c @@ -32,7 +32,7 @@ #include "operations/gimpoperationsettings.h" #include "core/gimp.h" -#include "core/gimp-filter.h" +#include "core/gimp-filter-history.h" #include "core/gimpimage.h" #include "core/gimpprogress.h" diff --git a/app/actions/plug-in-commands.c b/app/actions/plug-in-commands.c index b691ec33fc..7ce5482c4e 100644 --- a/app/actions/plug-in-commands.c +++ b/app/actions/plug-in-commands.c @@ -26,7 +26,7 @@ #include "actions-types.h" #include "core/gimp.h" -#include "core/gimp-filter.h" +#include "core/gimp-filter-history.h" #include "core/gimpcontainer.h" #include "core/gimpcontext.h" #include "core/gimpimage.h" diff --git a/app/core/Makefile.am b/app/core/Makefile.am index 7d156ef221..53c3188db9 100644 --- a/app/core/Makefile.am +++ b/app/core/Makefile.am @@ -54,8 +54,8 @@ libappcore_a_sources = \ gimp-data-factories.h \ gimp-edit.c \ gimp-edit.h \ - gimp-filter.c \ - gimp-filter.h \ + gimp-filter-history.c \ + gimp-filter-history.h \ gimp-gradients.c \ gimp-gradients.h \ gimp-gui.c \ diff --git a/app/core/gimp-filter.c b/app/core/gimp-filter-history.c similarity index 81% rename from app/core/gimp-filter.c rename to app/core/gimp-filter-history.c index a5438ea6ec..afdd6ed684 100644 --- a/app/core/gimp-filter.c +++ b/app/core/gimp-filter-history.c @@ -1,7 +1,7 @@ /* GIMP - The GNU Image Manipulation Program * Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis * - * gimp-filter.c + * gimp-filter-history.c * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -31,7 +31,7 @@ #include "config/gimpcoreconfig.h" #include "gimp.h" -#include "gimp-filter.h" +#include "gimp-filter-history.h" #include "pdb/gimpprocedure.h" @@ -143,40 +143,6 @@ gimp_filter_history_clear (Gimp *gimp) } } -void -gimp_filter_gegl_ops_add (Gimp *gimp, - const gchar *action_name, - const gchar *op_name) -{ - g_return_if_fail (GIMP_IS_GIMP (gimp)); - g_return_if_fail (action_name != NULL); - g_return_if_fail (op_name != NULL); - - g_hash_table_replace (gimp->filter_gegl_ops, g_strdup (action_name), g_strdup (op_name)); -} - -const gchar * -gimp_filter_gegl_ops_get (Gimp *gimp, - const gchar *action_name) -{ - g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); - g_return_val_if_fail (action_name != NULL, NULL); - - return g_hash_table_lookup (gimp->filter_gegl_ops, action_name); -} - -GList * -gimp_filter_gegl_ops_list (Gimp *gimp) -{ - GList *actions; - - g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL); - - actions = g_hash_table_get_keys (gimp->filter_gegl_ops); - - return g_list_sort (actions, (GCompareFunc) g_strcmp0); -} - /* private functions */ diff --git a/app/core/gimp-filter.h b/app/core/gimp-filter-history.h similarity index 72% rename from app/core/gimp-filter.h rename to app/core/gimp-filter-history.h index 576093c059..e74b8201b3 100644 --- a/app/core/gimp-filter.h +++ b/app/core/gimp-filter-history.h @@ -1,7 +1,7 @@ /* GIMP - The GNU Image Manipulation Program * Copyright (C) 1995 Spencer Kimball and Peter Mattis * - * gimp-filter.h + * gimp-filter-history.h * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,8 +17,8 @@ * along with this program. If not, see . */ -#ifndef __GIMP__FILTER_H__ -#define __GIMP__FILTER_H__ +#ifndef __GIMP_FILTER_HISTORY_H__ +#define __GIMP_FILTER_HISTORY_H__ gint gimp_filter_history_size (Gimp *gimp); @@ -31,12 +31,5 @@ void gimp_filter_history_remove (Gimp *gimp, GimpProcedure *procedure); void gimp_filter_history_clear (Gimp *gimp); -void gimp_filter_gegl_ops_add (Gimp *gimp, - const gchar *action_name, - const gchar *op_name); -const gchar * gimp_filter_gegl_ops_get (Gimp *gimp, - const gchar *action_name); -GList * gimp_filter_gegl_ops_list (Gimp *gimp); - -#endif /* __GIMP__FILTER_H__ */ +#endif /* __GIMP_FILTER_HISTORY_H__ */ diff --git a/app/core/gimp.c b/app/core/gimp.c index 005f2c5142..1040670d0e 100644 --- a/app/core/gimp.c +++ b/app/core/gimp.c @@ -47,7 +47,7 @@ #include "gimp.h" #include "gimp-contexts.h" #include "gimp-data-factories.h" -#include "gimp-filter.h" +#include "gimp-filter-history.h" #include "gimp-memsize.h" #include "gimp-modules.h" #include "gimp-parasites.h" @@ -303,8 +303,6 @@ gimp_constructed (GObject *object) gimp->plug_in_manager = gimp_plug_in_manager_new (gimp); gimp->pdb = gimp_pdb_new (gimp); - gimp->filter_gegl_ops = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); - xcf_init (gimp); file_data_init (gimp); @@ -436,8 +434,6 @@ gimp_finalize (GObject *object) if (gimp->module_db) gimp_modules_exit (gimp); - g_hash_table_unref (gimp->filter_gegl_ops); - gimp_paint_exit (gimp); g_clear_object (&gimp->parasites); @@ -490,7 +486,6 @@ gimp_get_memsize (GimpObject *object, (GimpMemsizeFunc) gimp_object_get_memsize, gui_size); - /* TODO: get memsize of gimp->filter_gegl_ops */ memsize += gimp_object_get_memsize (GIMP_OBJECT (gimp->image_table), 0); memsize += gimp_object_get_memsize (GIMP_OBJECT (gimp->item_table), 0); diff --git a/app/core/gimp.h b/app/core/gimp.h index d6b39e933d..45cf74a412 100644 --- a/app/core/gimp.h +++ b/app/core/gimp.h @@ -83,7 +83,6 @@ struct _Gimp GimpPlugInManager *plug_in_manager; GList *filter_history; - GHashTable *filter_gegl_ops; /* Map generated action names to GEGL operation names. */ GimpContainer *images; guint32 next_guide_id; diff --git a/app/core/meson.build b/app/core/meson.build index 20cdc6cae0..c7155729f9 100644 --- a/app/core/meson.build +++ b/app/core/meson.build @@ -30,7 +30,7 @@ libappcore_sources = [ 'gimp-contexts.c', 'gimp-data-factories.c', 'gimp-edit.c', - 'gimp-filter.c', + 'gimp-filter-history.c', 'gimp-gradients.c', 'gimp-gui.c', 'gimp-internal-data.c', diff --git a/app/display/gimpdisplayshell-tool-events.c b/app/display/gimpdisplayshell-tool-events.c index 204edcdf22..b0f4a47d20 100644 --- a/app/display/gimpdisplayshell-tool-events.c +++ b/app/display/gimpdisplayshell-tool-events.c @@ -32,7 +32,7 @@ #include "config/gimpdisplayconfig.h" #include "core/gimp.h" -#include "core/gimp-filter.h" +#include "core/gimp-filter-history.h" #include "core/gimpcontext.h" #include "core/gimpimage.h" #include "core/gimpimage-pick-item.h" diff --git a/app/menus/filters-menu.c b/app/menus/filters-menu.c index 81b1660ca6..f1128d534d 100644 --- a/app/menus/filters-menu.c +++ b/app/menus/filters-menu.c @@ -23,7 +23,7 @@ #include "menus-types.h" #include "core/gimp.h" -#include "core/gimp-filter.h" +#include "core/gimp-filter-history.h" #include "widgets/gimpuimanager.h" @@ -36,8 +36,7 @@ void filters_menu_setup (GimpUIManager *manager, const gchar *ui_path) { - GList *actions; - gint i; + gint i; g_return_if_fail (GIMP_IS_UI_MANAGER (manager)); g_return_if_fail (ui_path != NULL); @@ -53,10 +52,4 @@ filters_menu_setup (GimpUIManager *manager, g_free (action_name); } - - actions = gimp_filter_gegl_ops_list (manager->gimp); - for (GList *iter = actions; iter; iter = iter->next) - gimp_ui_manager_add_ui (manager, "/Filters/Generic/GEGL Operations", - iter->data, NULL, FALSE); - g_list_free (actions); } diff --git a/app/plug-in/gimppluginmanager.c b/app/plug-in/gimppluginmanager.c index 61f1b13202..46d534c5d3 100644 --- a/app/plug-in/gimppluginmanager.c +++ b/app/plug-in/gimppluginmanager.c @@ -32,7 +32,7 @@ #include "config/gimpcoreconfig.h" #include "core/gimp.h" -#include "core/gimp-filter.h" +#include "core/gimp-filter-history.h" #include "core/gimp-memsize.h" #include "core/gimpmarshal.h" diff --git a/app/tools/gimpgegltool.c b/app/tools/gimpgegltool.c index 48867144c7..7eed373b20 100644 --- a/app/tools/gimpgegltool.c +++ b/app/tools/gimpgegltool.c @@ -97,6 +97,12 @@ gimp_gegl_tool_class_init (GimpGeglToolClass *klass) tool_class->control = gimp_gegl_tool_control; filter_tool_class->dialog = gimp_gegl_tool_dialog; + + /* Store the mapping from tool identifier to operation name. + * This data is leaking, otherwise we'd have to register a dynamic type with a + * class_finalize() class method. + **/ + klass->generated_ops = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free); } static void diff --git a/app/tools/gimpgegltool.h b/app/tools/gimpgegltool.h index 0a7a8f4964..5f4dbe3903 100644 --- a/app/tools/gimpgegltool.h +++ b/app/tools/gimpgegltool.h @@ -45,6 +45,8 @@ struct _GimpGeglTool struct _GimpGeglToolClass { GimpOperationToolClass parent_class; + + GHashTable *generated_ops; }; diff --git a/menus/image-menu.ui.in.in b/menus/image-menu.ui.in.in index 055a2a5c30..3291745536 100644 --- a/menus/image-menu.ui.in.in +++ b/menus/image-menu.ui.in.in @@ -605,9 +605,6 @@ app.tools-measure app.tools-zoom -
- app.tools-gegl -
app.dialogs-toolbox app.context-colors-default @@ -714,15 +711,11 @@ _Generic app.filters-convolution-matrix app.filters-distance-map + app.tools-gegl + app.filters-gegl-graph app.filters-normal-map app.filters-dilate app.filters-erode - - _GEGL Operations -
- app.filters-gegl-graph -
-
C_ombine