diff --git a/app/actions/filters-actions.c b/app/actions/filters-actions.c
index deec1b85b9..be61264870 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-history.h"
+#include "core/gimp-filter.h"
#include "core/gimpimage.h"
#include "core/gimplayermask.h"
diff --git a/app/actions/filters-commands.c b/app/actions/filters-commands.c
index 389048e3a1..2bfe55a197 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-history.h"
+#include "core/gimp-filter.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 7ce5482c4e..b691ec33fc 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-history.h"
+#include "core/gimp-filter.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 53c3188db9..7d156ef221 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-history.c \
- gimp-filter-history.h \
+ gimp-filter.c \
+ gimp-filter.h \
gimp-gradients.c \
gimp-gradients.h \
gimp-gui.c \
diff --git a/app/core/gimp-filter-history.c b/app/core/gimp-filter.c
similarity index 81%
rename from app/core/gimp-filter-history.c
rename to app/core/gimp-filter.c
index afdd6ed684..a5438ea6ec 100644
--- a/app/core/gimp-filter-history.c
+++ b/app/core/gimp-filter.c
@@ -1,7 +1,7 @@
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995-2003 Spencer Kimball and Peter Mattis
*
- * gimp-filter-history.c
+ * gimp-filter.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-history.h"
+#include "gimp-filter.h"
#include "pdb/gimpprocedure.h"
@@ -143,6 +143,40 @@ 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-history.h b/app/core/gimp-filter.h
similarity index 72%
rename from app/core/gimp-filter-history.h
rename to app/core/gimp-filter.h
index e74b8201b3..576093c059 100644
--- a/app/core/gimp-filter-history.h
+++ b/app/core/gimp-filter.h
@@ -1,7 +1,7 @@
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
- * gimp-filter-history.h
+ * gimp-filter.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_HISTORY_H__
-#define __GIMP_FILTER_HISTORY_H__
+#ifndef __GIMP__FILTER_H__
+#define __GIMP__FILTER_H__
gint gimp_filter_history_size (Gimp *gimp);
@@ -31,5 +31,12 @@ 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_HISTORY_H__ */
+
+#endif /* __GIMP__FILTER_H__ */
diff --git a/app/core/gimp.c b/app/core/gimp.c
index 1040670d0e..005f2c5142 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-history.h"
+#include "gimp-filter.h"
#include "gimp-memsize.h"
#include "gimp-modules.h"
#include "gimp-parasites.h"
@@ -303,6 +303,8 @@ 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);
@@ -434,6 +436,8 @@ 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);
@@ -486,6 +490,7 @@ 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 45cf74a412..d6b39e933d 100644
--- a/app/core/gimp.h
+++ b/app/core/gimp.h
@@ -83,6 +83,7 @@ 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 c7155729f9..20cdc6cae0 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-history.c',
+ 'gimp-filter.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 b0f4a47d20..204edcdf22 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-history.h"
+#include "core/gimp-filter.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 f1128d534d..81b1660ca6 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-history.h"
+#include "core/gimp-filter.h"
#include "widgets/gimpuimanager.h"
@@ -36,7 +36,8 @@ void
filters_menu_setup (GimpUIManager *manager,
const gchar *ui_path)
{
- gint i;
+ GList *actions;
+ gint i;
g_return_if_fail (GIMP_IS_UI_MANAGER (manager));
g_return_if_fail (ui_path != NULL);
@@ -52,4 +53,10 @@ 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 46d534c5d3..61f1b13202 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-history.h"
+#include "core/gimp-filter.h"
#include "core/gimp-memsize.h"
#include "core/gimpmarshal.h"
diff --git a/app/tools/gimpgegltool.c b/app/tools/gimpgegltool.c
index 45fa9d4131..2a00655d21 100644
--- a/app/tools/gimpgegltool.c
+++ b/app/tools/gimpgegltool.c
@@ -30,6 +30,7 @@
#include "tools-types.h"
#include "core/gimp.h"
+#include "core/gimp-filter.h"
#include "core/gimptoolinfo.h"
#include "widgets/gimphelp-ids.h"
@@ -57,7 +58,7 @@ static void gimp_gegl_tool_control (GimpTool *tool,
GimpToolAction action,
GimpDisplay *display);
-static GList * gimp_get_geglopclasses (void);
+static GList * gimp_get_geglopclasses (void);
static void gimp_gegl_tool_dialog (GimpFilterTool *filter_tool);
@@ -76,12 +77,9 @@ void
gimp_gegl_tool_register (GimpToolRegisterCallback callback,
gpointer data)
{
- GimpGeglToolClass *klass;
- Gimp *gimp = GIMP (data);
- GList *opclasses;
- GList *iter;
-
- klass = g_type_class_ref (GIMP_TYPE_GEGL_TOOL);
+ Gimp *gimp = GIMP (data);
+ GList *opclasses;
+ GList *iter;
(* callback) (GIMP_TYPE_GEGL_TOOL,
GIMP_TYPE_FILTER_OPTIONS,
@@ -131,7 +129,8 @@ gimp_gegl_tool_register (GimpToolRegisterCallback callback,
* and ending with "-tool".
*/
identifier = g_strdup_printf ("gimp-%s-tool", action_name + strlen ("tools-"));
- g_hash_table_replace (klass->generated_ops, action_name, g_strdup (op_name));
+ gimp_filter_gegl_ops_add (gimp, action_name, op_name);
+ g_free (action_name);
if (g_str_has_prefix (op_name, "gegl:"))
icon_name = GIMP_ICON_GEGL;
@@ -163,7 +162,6 @@ gimp_gegl_tool_register (GimpToolRegisterCallback callback,
}
g_list_free (opclasses);
- g_type_class_unref (klass);
}
static void
@@ -175,12 +173,6 @@ 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
@@ -502,12 +494,10 @@ gimp_gegl_tool_dialog (GimpFilterTool *filter_tool)
GList *opclasses;
GList *iter;
gchar *action_name;
- gchar *show_op_name = NULL;
- GimpGeglToolClass *klass;
+ const gchar *show_op_name;
- klass = GIMP_GEGL_TOOL_GET_CLASS (tool);
action_name = gimp_tool_info_get_action_name (tool_info);
- show_op_name = g_hash_table_lookup (klass->generated_ops, action_name);
+ show_op_name = gimp_filter_gegl_ops_get (tool_info->gimp, action_name);
g_free (action_name);
GIMP_FILTER_TOOL_CLASS (parent_class)->dialog (filter_tool);
diff --git a/app/tools/gimpgegltool.h b/app/tools/gimpgegltool.h
index 5f4dbe3903..0a7a8f4964 100644
--- a/app/tools/gimpgegltool.h
+++ b/app/tools/gimpgegltool.h
@@ -45,8 +45,6 @@ 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 a41d760fa9..ec96eb5345 100644
--- a/menus/image-menu.ui.in.in
+++ b/menus/image-menu.ui.in.in
@@ -605,6 +605,9 @@
- app.tools-measure
- app.tools-zoom
+
- app.dialogs-toolbox
- app.context-colors-default
@@ -711,11 +714,15 @@
_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