[gimp] app: initialize GimpToolPreset's tool options from the user context



commit b458b1b5c07332705c2413c613c31f1444a8b7fa
Author: Michael Natterer <mitch gimp org>
Date:   Sun Apr 3 00:47:41 2011 +0200

    app: initialize GimpToolPreset's tool options from the user context
    
    so that if deserializing wants to set an unknown brush, pattern etc.,
    the previously set default value will be used instead.

 app/core/gimptoolpreset.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/app/core/gimptoolpreset.c b/app/core/gimptoolpreset.c
index ce5a699..abacb9e 100644
--- a/app/core/gimptoolpreset.c
+++ b/app/core/gimptoolpreset.c
@@ -175,6 +175,14 @@ gimp_tool_preset_constructed (GObject *object)
     G_OBJECT_CLASS (parent_class)->constructed (object);
 
   g_assert (GIMP_IS_GIMP (preset->gimp));
+
+  /*  initialize the tool options with sane default values, so that if
+   *  deserializing wants to set non-existant brushe, pattern etc.,
+   *  the previously set default object will be used instead.
+   */
+  gimp_context_copy_properties (gimp_get_user_context (preset->gimp),
+                                GIMP_CONTEXT (preset->tool_options),
+                                GIMP_CONTEXT_ALL_PROPS_MASK);
 }
 
 static void



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