[gimp] Bug 794826 - Do not default to last used filter settings



commit fe932fe7ad5acd3a05be2bb6e934583881c26e7a
Author: Michael Natterer <mitch gimp org>
Date:   Sun Apr 1 14:41:20 2018 +0200

    Bug 794826 - Do not default to last used filter settings
    
    Add GimpGuiConfig::filter-tool-use-last-settings wchich defaults to FALSE.
    
    Honor the new option in gimp_gegl_procedure_execute_async() and add
    it to prefs -> dialog defaults.

 app/actions/gimpgeglprocedure.c  |    6 +++++-
 app/config/gimpguiconfig.c       |   14 ++++++++++++++
 app/config/gimpguiconfig.h       |    1 +
 app/config/gimprc-blurbs.h       |    3 +++
 app/dialogs/preferences-dialog.c |    4 ++++
 5 files changed, 27 insertions(+), 1 deletions(-)
---
diff --git a/app/actions/gimpgeglprocedure.c b/app/actions/gimpgeglprocedure.c
index adcb01d..587ec9e 100644
--- a/app/actions/gimpgeglprocedure.c
+++ b/app/actions/gimpgeglprocedure.c
@@ -30,6 +30,8 @@
 
 #include "actions-types.h"
 
+#include "config/gimpguiconfig.h"
+
 #include "operations/gimp-operation-config.h"
 
 #include "core/gimp.h"
@@ -276,7 +278,9 @@ gimp_gegl_procedure_execute_async (GimpProcedure  *procedure,
   run_mode = g_value_get_int    (gimp_value_array_index (args, 0));
   settings = g_value_get_object (gimp_value_array_index (args, 3));
 
-  if (! settings)
+  if (! settings &&
+      (run_mode != GIMP_RUN_INTERACTIVE ||
+       GIMP_GUI_CONFIG (gimp->config)->filter_tool_use_last_settings))
     {
       /*  if we didn't get settings passed, get the last used settings  */
 
diff --git a/app/config/gimpguiconfig.c b/app/config/gimpguiconfig.c
index 31d932e..72e263d 100644
--- a/app/config/gimpguiconfig.c
+++ b/app/config/gimpguiconfig.c
@@ -54,6 +54,7 @@ enum
   PROP_0,
   PROP_MOVE_TOOL_CHANGES_ACTIVE,
   PROP_FILTER_TOOL_MAX_RECENT,
+  PROP_FILTER_TOOL_USE_LAST_SETTINGS,
   PROP_FILTER_TOOL_SHOW_COLOR_OPTIONS,
   PROP_TRUST_DIRTY_FLAG,
   PROP_SAVE_DEVICE_STATUS,
@@ -163,6 +164,13 @@ gimp_gui_config_class_init (GimpGuiConfigClass *klass)
                         0, 255, 10,
                         GIMP_PARAM_STATIC_STRINGS);
 
+  GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_FILTER_TOOL_USE_LAST_SETTINGS,
+                            "filter-tool-use-last-settings",
+                            "Use last used settings in filters",
+                            FILTER_TOOL_USE_LAST_SETTINGS_BLURB,
+                            FALSE,
+                            GIMP_PARAM_STATIC_STRINGS);
+
   GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_FILTER_TOOL_SHOW_COLOR_OPTIONS,
                             "filter-tool-show-color-options",
                             "Show avanced color options in filters",
@@ -569,6 +577,9 @@ gimp_gui_config_set_property (GObject      *object,
     case PROP_IMAGE_MAP_TOOL_MAX_RECENT:
       gui_config->filter_tool_max_recent = g_value_get_int (value);
       break;
+    case PROP_FILTER_TOOL_USE_LAST_SETTINGS:
+      gui_config->filter_tool_use_last_settings = g_value_get_boolean (value);
+      break;
     case PROP_FILTER_TOOL_SHOW_COLOR_OPTIONS:
       gui_config->filter_tool_show_color_options = g_value_get_boolean (value);
       break;
@@ -751,6 +762,9 @@ gimp_gui_config_get_property (GObject    *object,
     case PROP_IMAGE_MAP_TOOL_MAX_RECENT:
       g_value_set_int (value, gui_config->filter_tool_max_recent);
       break;
+    case PROP_FILTER_TOOL_USE_LAST_SETTINGS:
+      g_value_set_boolean (value, gui_config->filter_tool_use_last_settings);
+      break;
     case PROP_FILTER_TOOL_SHOW_COLOR_OPTIONS:
       g_value_set_boolean (value, gui_config->filter_tool_show_color_options);
       break;
diff --git a/app/config/gimpguiconfig.h b/app/config/gimpguiconfig.h
index bbb8130..f90f0f2 100644
--- a/app/config/gimpguiconfig.h
+++ b/app/config/gimpguiconfig.h
@@ -43,6 +43,7 @@ struct _GimpGuiConfig
 
   gboolean             move_tool_changes_active;
   gint                 filter_tool_max_recent;
+  gboolean             filter_tool_use_last_settings;
   gboolean             filter_tool_show_color_options;
   gboolean             trust_dirty_flag;
   gboolean             save_device_status;
diff --git a/app/config/gimprc-blurbs.h b/app/config/gimprc-blurbs.h
index 384b528..5cd0dd4 100644
--- a/app/config/gimprc-blurbs.h
+++ b/app/config/gimprc-blurbs.h
@@ -178,6 +178,9 @@ _("Sets the browser used by the help system.")
 #define FILTER_TOOL_MAX_RECENT_BLURB \
 _("How many recent settings to keep around in filter tools.")
 
+#define FILTER_TOOL_USE_LAST_SETTINGS_BLURB \
+_("Default to the last used settings in filter tools.")
+
 #define FILTER_TOOL_SHOW_COLOR_OPTIONS_BLURB \
 _("Show advanced color options in filter tools.")
 
diff --git a/app/dialogs/preferences-dialog.c b/app/dialogs/preferences-dialog.c
index dbea19b..f061cb5 100644
--- a/app/dialogs/preferences-dialog.c
+++ b/app/dialogs/preferences-dialog.c
@@ -477,6 +477,7 @@ prefs_dialog_defaults_reset (GtkWidget *widget,
     }
 
   gimp_config_reset_property (config, "filter-tool-max-recent");
+  gimp_config_reset_property (config, "filter-tool-use-last-settings");
   gimp_config_reset_property (config, "filter-tool-show-color-options");
 
   g_object_thaw_notify (config);
@@ -2175,6 +2176,9 @@ prefs_dialog_new (Gimp       *gimp,
                          _("Keep recent settings:"),
                          GTK_TABLE (table), 1, size_group);
 
+  button = prefs_check_button_add (object, "filter-tool-use-last-settings",
+                                   _("Default to the last used settings"),
+                                   GTK_BOX (vbox2));
   button = prefs_check_button_add (object, "filter-tool-show-color-options",
                                    _("Show advanced color options"),
                                    GTK_BOX (vbox2));


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