diff --git a/app/actions/filters-actions.c b/app/actions/filters-actions.c index 212623ffbf..510c4028be 100644 --- a/app/actions/filters-actions.c +++ b/app/actions/filters-actions.c @@ -18,12 +18,15 @@ #include "config.h" #include +#include #include #include "libgimpwidgets/gimpwidgets.h" #include "actions-types.h" +#include "gegl/gimp-gegl-utils.h" + #include "core/gimp-filter-history.h" #include "core/gimpimage.h" #include "core/gimplayermask.h" @@ -34,6 +37,7 @@ #include "widgets/gimpactiongroup.h" #include "widgets/gimphelp-ids.h" #include "widgets/gimpuimanager.h" +#include "widgets/gimpwidgets-utils.h" #include "actions.h" #include "filters-actions.h" @@ -747,6 +751,8 @@ filters_actions_setup (GimpActionGroup *group) GimpProcedureActionEntry *entries; gint n_entries; gint i; + GList *op_classes; + GList *iter; gimp_action_group_add_string_actions (group, "filters-action", filters_actions, @@ -769,6 +775,51 @@ filters_actions_setup (GimpActionGroup *group) filters_actions_set_tooltips (group, filters_interactive_actions, G_N_ELEMENTS (filters_interactive_actions)); + op_classes = gimp_gegl_get_op_classes (); + + for (iter = op_classes; iter; iter = iter->next) + { + GeglOperationClass *op_class = GEGL_OPERATION_CLASS (iter->data); + GimpStringActionEntry entry = { 0, }; + gchar *formatted_op_name; + gchar *action_name; + const gchar *title; + const gchar *op_name; + gchar *label; + + formatted_op_name = g_strdup (op_class->name); + gimp_make_valid_action_name (formatted_op_name); + action_name = g_strdup_printf ("filters-%s", formatted_op_name); + g_free (formatted_op_name); + + title = gegl_operation_class_get_key (op_class, "title"); + op_name = op_class->name; + + if (g_str_has_prefix (op_name, "gegl:")) + op_name += strlen ("gegl:"); + + if (title) + label = g_strdup_printf ("%s (%s)", title, op_name); + else + label = g_strdup (op_name); + + entry.name = action_name; + entry.icon_name = GIMP_ICON_GEGL; + entry.label = label; + entry.tooltip = gegl_operation_class_get_key (op_class, "description"); + entry.value = op_class->name; + entry.help_id = GIMP_HELP_TOOL_GEGL; + + gimp_action_group_add_string_actions (group, "filters-action", + &entry, 1, + filters_apply_interactive_cmd_callback); + + g_free (label); + g_free (action_name); + } + + g_list_free (op_classes); + gimp_action_group_add_enum_actions (group, "filters-action", filters_repeat_actions, G_N_ELEMENTS (filters_repeat_actions), diff --git a/app/menus/filters-menu.c b/app/menus/filters-menu.c index f1128d534d..7e023001d0 100644 --- a/app/menus/filters-menu.c +++ b/app/menus/filters-menu.c @@ -18,14 +18,18 @@ #include "config.h" #include +#include #include #include "menus-types.h" +#include "gegl/gimp-gegl-utils.h" + #include "core/gimp.h" #include "core/gimp-filter-history.h" #include "widgets/gimpuimanager.h" +#include "widgets/gimpwidgets-utils.h" #include "filters-menu.h" @@ -36,7 +40,9 @@ void filters_menu_setup (GimpUIManager *manager, const gchar *ui_path) { - gint i; + GList *op_classes; + GList *iter; + gint i; g_return_if_fail (GIMP_IS_UI_MANAGER (manager)); g_return_if_fail (ui_path != NULL); @@ -52,4 +58,25 @@ filters_menu_setup (GimpUIManager *manager, g_free (action_name); } + + op_classes = gimp_gegl_get_op_classes (); + + for (iter = op_classes; iter; iter = iter->next) + { + GeglOperationClass *opclass = GEGL_OPERATION_CLASS (iter->data); + gchar *formatted_op_name; + gchar *action_name; + + formatted_op_name = g_strdup (opclass->name); + gimp_make_valid_action_name (formatted_op_name); + action_name = g_strdup_printf ("filters-%s", formatted_op_name); + g_free (formatted_op_name); + + gimp_ui_manager_add_ui (manager, "/Filters/GEGL Operations", + action_name, NULL, FALSE); + + g_free (action_name); + } + + g_list_free (op_classes); } diff --git a/menus/image-menu.ui.in.in b/menus/image-menu.ui.in.in index 3291745536..951adfda66 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.tools-gegl +
app.dialogs-toolbox app.context-colors-default @@ -711,12 +714,16 @@ _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