[gimp] Bug 759316 - "Recently used" menu not updated with gegl filters



commit a0c1d72be6941e13dec0c2de5960184551abc804
Author: Michael Natterer <mitch gimp org>
Date:   Mon Jan 4 17:28:48 2016 +0100

    Bug 759316 - "Recently used" menu not updated with gegl filters
    
    Implement RUN_WITH_LAST_VALS in GimpGeglProcedure, using the first
    item in the MRU list of the op's gimp-gegl-config-proxy container.

 app/actions/gimpgeglprocedure.c |   59 ++++++++++++++++++++++++++++++++++++++-
 po/POTFILES.in                  |    1 +
 2 files changed, 59 insertions(+), 1 deletions(-)
---
diff --git a/app/actions/gimpgeglprocedure.c b/app/actions/gimpgeglprocedure.c
index adf5b5c..3c46c8e 100644
--- a/app/actions/gimpgeglprocedure.c
+++ b/app/actions/gimpgeglprocedure.c
@@ -31,11 +31,17 @@
 
 #include "core/gimp.h"
 #include "core/gimp-memsize.h"
+#include "core/gimpcontainer.h"
 #include "core/gimpcontext.h"
+#include "core/gimpdrawable-operation.h"
+#include "core/gimpimage.h"
 #include "core/gimplayermask.h"
 #include "core/gimpparamspecs.h"
+#include "core/gimpsettings.h"
 #include "core/gimptoolinfo.h"
 
+#include "gegl/gimp-gegl-config-proxy.h"
+
 #include "display/gimpdisplay.h"
 
 #include "tools/gimpoperationtool.h"
@@ -43,6 +49,8 @@
 
 #include "gimpgeglprocedure.h"
 
+#include "gimp-intl.h"
+
 
 static void     gimp_gegl_procedure_finalize            (GObject        *object);
 
@@ -226,7 +234,56 @@ gimp_gegl_procedure_execute_async (GimpProcedure  *procedure,
                                    GimpValueArray *args,
                                    GimpObject     *display)
 {
-  GimpTool *active_tool = tool_manager_get_active (gimp);
+  GimpRunMode  run_mode = g_value_get_int (gimp_value_array_index (args, 0));
+  GimpTool    *active_tool;
+
+  if (run_mode == GIMP_RUN_WITH_LAST_VALS)
+    {
+      GimpObject    *settings;
+      GimpContainer *container;
+
+      settings = gimp_gegl_get_config_proxy (procedure->original_name,
+                                             GIMP_TYPE_SETTINGS);
+
+      container = gimp_gegl_get_config_container (G_TYPE_FROM_INSTANCE (settings));
+
+      g_object_unref (settings);
+
+      settings = gimp_container_get_child_by_index (container, 0);
+
+      if (settings)
+        {
+          GimpImage    *image;
+          GimpDrawable *drawable;
+          GeglNode     *node;
+
+          node = gegl_node_new_child (NULL,
+                                      "operation", procedure->original_name,
+                                      NULL);
+          gimp_gegl_config_proxy_sync (settings, node);
+
+          image = gimp_value_get_image (gimp_value_array_index (args, 1),
+                                        gimp);
+          drawable = gimp_value_get_drawable (gimp_value_array_index (args, 2),
+                                              gimp);
+
+          gimp_drawable_apply_operation (drawable, progress,
+                                         gimp_procedure_get_label (procedure),
+                                         node);
+          g_object_unref (node);
+
+          gimp_image_flush (image);
+          return;
+        }
+
+      gimp_message (gimp,
+                    G_OBJECT (progress), GIMP_MESSAGE_WARNING,
+                    _("There are no last settings for '%s', "
+                      "showing the filter dialog instead."),
+                    gimp_procedure_get_label (procedure));
+    }
+
+  active_tool = tool_manager_get_active (gimp);
 
   /*  do not use the passed context because we need to set the active
    *  tool on the global user context
diff --git a/po/POTFILES.in b/po/POTFILES.in
index a4fa4f8..fd9aa43 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -43,6 +43,7 @@ app/actions/file-actions.c
 app/actions/file-commands.c
 app/actions/filters-actions.c
 app/actions/fonts-actions.c
+app/actions/gimpgeglprocedure.h
 app/actions/gradient-editor-actions.c
 app/actions/gradient-editor-commands.c
 app/actions/gradients-actions.c


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