[gimp] app: some cleanup and fixes in the tool preset infrastructure
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: some cleanup and fixes in the tool preset infrastructure
- Date: Sun, 4 Apr 2010 11:59:37 +0000 (UTC)
commit efed2bf6235d283779661844f3f383a06f0e502f
Author: Michael Natterer <mitch gimp org>
Date: Sun Apr 4 13:58:55 2010 +0200
app: some cleanup and fixes in the tool preset infrastructure
app/actions/Makefile.am | 4 +-
app/actions/actions.c | 2 +-
app/actions/dialogs-actions.c | 12 ++--
app/config/gimpcoreconfig.c | 80 ++++++++++++--------
app/config/gimpcoreconfig.h | 4 +-
app/core/core-enums.h | 79 ++++++++++----------
app/core/gimp.c | 4 +-
app/core/gimpcontext.c | 36 +++++-----
app/core/gimpcontext.h | 164 ++++++++++++++++++++--------------------
app/core/gimptoolpreset.c | 38 ++++------
app/core/gimptoolpreset.h | 12 ++-
app/dialogs/dialogs.c | 24 +++---
app/widgets/gimphelp-ids.h | 14 ++--
13 files changed, 242 insertions(+), 231 deletions(-)
---
diff --git a/app/actions/Makefile.am b/app/actions/Makefile.am
index 83b0a9c..c03921a 100644
--- a/app/actions/Makefile.am
+++ b/app/actions/Makefile.am
@@ -163,8 +163,8 @@ libappactions_a_SOURCES = \
tool-options-commands.h \
tool-preset-actions.c \
tool-preset-actions.h \
- tool-preset-editor-actions.c \
- tool-preset-editor-actions.h \
+ tool-preset-editor-actions.c \
+ tool-preset-editor-actions.h \
tools-actions.c \
tools-actions.h \
tools-commands.c \
diff --git a/app/actions/actions.c b/app/actions/actions.c
index 7ae269c..5ff22b3 100644
--- a/app/actions/actions.c
+++ b/app/actions/actions.c
@@ -171,7 +171,7 @@ static const GimpActionFactoryEntry action_groups[] =
{ "gradients", N_("Gradients"), GIMP_STOCK_GRADIENT,
gradients_actions_setup,
gradients_actions_update },
- { "tool-preset", N_("Tool Presets"), GIMP_STOCK_DYNAMICS,
+ { "tool-preset", N_("Tool Presets"), GIMP_STOCK_TOOL_PRESET,
tool_preset_actions_setup,
tool_preset_actions_update },
{ "help", N_("Help"), GTK_STOCK_HELP,
diff --git a/app/actions/dialogs-actions.c b/app/actions/dialogs-actions.c
index 459cef4..532a7e4 100644
--- a/app/actions/dialogs-actions.c
+++ b/app/actions/dialogs-actions.c
@@ -142,12 +142,6 @@ const GimpStringActionEntry dialogs_dockable_actions[] =
"gimp-dynamics-list",
GIMP_HELP_DYNAMICS_DIALOG },
- { "dialogs-tool-presets", GIMP_STOCK_TOOL_PRESET,
- NC_("dialogs-action", "Tool presets"), NULL,
- NC_("dialogs-action", "Open tool presets dialog"),
- "gimp-tool-preset-list",
- GIMP_HELP_TOOL_PRESET_DIALOG },
-
{ "dialogs-dynamics-editor", GIMP_STOCK_DYNAMICS,
NC_("dialogs-action", "Paint Dynamics Editor"), NULL,
NC_("dialogs-action", "Open the paint dynamics editor"),
@@ -184,6 +178,12 @@ const GimpStringActionEntry dialogs_dockable_actions[] =
"gimp-palette-editor",
GIMP_HELP_PALETTE_EDIT },
+ { "dialogs-tool-presets", GIMP_STOCK_TOOL_PRESET,
+ NC_("dialogs-action", "Tool presets"), NULL,
+ NC_("dialogs-action", "Open tool presets dialog"),
+ "gimp-tool-preset-list",
+ GIMP_HELP_TOOL_PRESET_DIALOG },
+
{ "dialogs-fonts", GIMP_STOCK_FONT,
NC_("dialogs-action", "_Fonts"), NULL,
NC_("dialogs-action", "Open the fonts dialog"),
diff --git a/app/config/gimpcoreconfig.c b/app/config/gimpcoreconfig.c
index 04937d3..b2b6d00 100644
--- a/app/config/gimpcoreconfig.c
+++ b/app/config/gimpcoreconfig.c
@@ -37,14 +37,14 @@
#include "gimp-intl.h"
-#define DEFAULT_BRUSH "Round Fuzzy"
-#define DEFAULT_DYNAMICS "Basic Dynamics"
-#define DEFAULT_PATTERN "Pine"
-#define DEFAULT_PALETTE "Default"
-#define DEFAULT_GRADIENT "FG to BG (RGB)"
-#define DEFAULT_TOOL_PRESET "Current Options"
-#define DEFAULT_FONT "Sans"
-#define DEFAULT_COMMENT "Created with GIMP"
+#define DEFAULT_BRUSH "Round Fuzzy"
+#define DEFAULT_DYNAMICS "Basic Dynamics"
+#define DEFAULT_PATTERN "Pine"
+#define DEFAULT_PALETTE "Default"
+#define DEFAULT_GRADIENT "FG to BG (RGB)"
+#define DEFAULT_TOOL_PRESET "Current Options"
+#define DEFAULT_FONT "Sans"
+#define DEFAULT_COMMENT "Created with GIMP"
enum
@@ -149,6 +149,7 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
GIMP_TYPE_INTERPOLATION_TYPE,
GIMP_INTERPOLATION_CUBIC,
GIMP_PARAM_STATIC_STRINGS);
+
path = gimp_config_build_plug_in_path ("plug-ins");
GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_PLUG_IN_PATH,
"plug-in-path", PLUG_IN_PATH_BLURB,
@@ -156,6 +157,7 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
GIMP_PARAM_STATIC_STRINGS |
GIMP_CONFIG_PARAM_RESTART);
g_free (path);
+
path = gimp_config_build_plug_in_path ("modules");
GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_MODULE_PATH,
"module-path", MODULE_PATH_BLURB,
@@ -163,6 +165,7 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
GIMP_PARAM_STATIC_STRINGS |
GIMP_CONFIG_PARAM_RESTART);
g_free (path);
+
path = gimp_config_build_plug_in_path ("interpreters");
GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_INTERPRETER_PATH,
"interpreter-path", INTERPRETER_PATH_BLURB,
@@ -170,6 +173,7 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
GIMP_PARAM_STATIC_STRINGS |
GIMP_CONFIG_PARAM_RESTART);
g_free (path);
+
path = gimp_config_build_plug_in_path ("environ");
GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_ENVIRON_PATH,
"environ-path", ENVIRON_PATH_BLURB,
@@ -177,6 +181,7 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
GIMP_PARAM_STATIC_STRINGS |
GIMP_CONFIG_PARAM_RESTART);
g_free (path);
+
path = gimp_config_build_data_path ("brushes");
GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_BRUSH_PATH,
"brush-path", BRUSH_PATH_BLURB,
@@ -184,6 +189,7 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
GIMP_PARAM_STATIC_STRINGS |
GIMP_CONFIG_PARAM_RESTART);
g_free (path);
+
path = gimp_config_build_writable_path ("brushes");
GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_BRUSH_PATH_WRITABLE,
"brush-path-writable",
@@ -192,6 +198,7 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
GIMP_PARAM_STATIC_STRINGS |
GIMP_CONFIG_PARAM_RESTART);
g_free (path);
+
path = gimp_config_build_data_path ("dynamics");
GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_DYNAMICS_PATH,
"dynamics-path", DYNAMICS_PATH_BLURB,
@@ -199,6 +206,7 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
GIMP_PARAM_STATIC_STRINGS |
GIMP_CONFIG_PARAM_RESTART);
g_free (path);
+
path = gimp_config_build_writable_path ("dynamics");
GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_DYNAMICS_PATH_WRITABLE,
"dynamics-path-writable",
@@ -207,6 +215,7 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
GIMP_PARAM_STATIC_STRINGS |
GIMP_CONFIG_PARAM_RESTART);
g_free (path);
+
path = gimp_config_build_data_path ("patterns");
GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_PATTERN_PATH,
"pattern-path", PATTERN_PATH_BLURB,
@@ -214,6 +223,7 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
GIMP_PARAM_STATIC_STRINGS |
GIMP_CONFIG_PARAM_RESTART);
g_free (path);
+
path = gimp_config_build_writable_path ("patterns");
GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_PATTERN_PATH_WRITABLE,
"pattern-path-writable",
@@ -222,6 +232,7 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
GIMP_PARAM_STATIC_STRINGS |
GIMP_CONFIG_PARAM_RESTART);
g_free (path);
+
path = gimp_config_build_data_path ("palettes");
GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_PALETTE_PATH,
"palette-path", PALETTE_PATH_BLURB,
@@ -229,6 +240,7 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
GIMP_PARAM_STATIC_STRINGS |
GIMP_CONFIG_PARAM_RESTART);
g_free (path);
+
path = gimp_config_build_writable_path ("palettes");
GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_PALETTE_PATH_WRITABLE,
"palette-path-writable",
@@ -237,6 +249,7 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
GIMP_PARAM_STATIC_STRINGS |
GIMP_CONFIG_PARAM_RESTART);
g_free (path);
+
path = gimp_config_build_data_path ("gradients");
GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_GRADIENT_PATH,
"gradient-path", GRADIENT_PATH_BLURB,
@@ -244,6 +257,7 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
GIMP_PARAM_STATIC_STRINGS |
GIMP_CONFIG_PARAM_RESTART);
g_free (path);
+
path = gimp_config_build_writable_path ("gradients");
GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_GRADIENT_PATH_WRITABLE,
"gradient-path-writable",
@@ -252,13 +266,6 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
GIMP_PARAM_STATIC_STRINGS |
GIMP_CONFIG_PARAM_RESTART);
g_free (path);
- path = gimp_config_build_data_path ("fonts");
- GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_FONT_PATH,
- "font-path", FONT_PATH_BLURB,
- GIMP_CONFIG_PATH_DIR_LIST, path,
- GIMP_PARAM_STATIC_STRINGS |
- GIMP_CONFIG_PARAM_CONFIRM);
- g_free (path);
path = gimp_config_build_data_path ("tool-presets");
GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_TOOL_PRESET_PATH,
@@ -267,6 +274,7 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
GIMP_PARAM_STATIC_STRINGS |
GIMP_CONFIG_PARAM_RESTART);
g_free (path);
+
path = gimp_config_build_writable_path ("tool-presets");
GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_TOOL_PRESET_PATH_WRITABLE,
"tool-preset-path-writable",
@@ -276,6 +284,14 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
GIMP_CONFIG_PARAM_RESTART);
g_free (path);
+ path = gimp_config_build_data_path ("fonts");
+ GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_FONT_PATH,
+ "font-path", FONT_PATH_BLURB,
+ GIMP_CONFIG_PATH_DIR_LIST, path,
+ GIMP_PARAM_STATIC_STRINGS |
+ GIMP_CONFIG_PARAM_CONFIRM);
+ g_free (path);
+
GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_FONT_PATH_WRITABLE,
"font-path-writable", NULL,
GIMP_CONFIG_PATH_DIR_LIST, NULL,
@@ -466,18 +482,18 @@ gimp_core_config_finalize (GObject *object)
g_free (core_config->pattern_path_writable);
g_free (core_config->palette_path);
g_free (core_config->palette_path_writable);
- g_free (core_config->tool_preset_path);
- g_free (core_config->tool_preset_path_writable);
g_free (core_config->gradient_path);
g_free (core_config->gradient_path_writable);
+ g_free (core_config->tool_preset_path);
+ g_free (core_config->tool_preset_path_writable);
g_free (core_config->font_path);
g_free (core_config->font_path_writable);
g_free (core_config->default_brush);
g_free (core_config->default_dynamics);
g_free (core_config->default_pattern);
g_free (core_config->default_palette);
- g_free (core_config->default_tool_preset);
g_free (core_config->default_gradient);
+ g_free (core_config->default_tool_preset);
g_free (core_config->default_font);
g_free (core_config->plug_in_rc_path);
@@ -542,14 +558,6 @@ gimp_core_config_set_property (GObject *object,
g_free (core_config->dynamics_path_writable);
core_config->dynamics_path_writable = g_value_dup_string (value);
break;
- case PROP_TOOL_PRESET_PATH:
- g_free (core_config->tool_preset_path);
- core_config->tool_preset_path = g_value_dup_string (value);
- break;
- case PROP_TOOL_PRESET_PATH_WRITABLE:
- g_free (core_config->tool_preset_path_writable);
- core_config->tool_preset_path_writable = g_value_dup_string (value);
- break;
case PROP_PATTERN_PATH:
g_free (core_config->pattern_path);
core_config->pattern_path = g_value_dup_string (value);
@@ -574,6 +582,14 @@ gimp_core_config_set_property (GObject *object,
g_free (core_config->gradient_path_writable);
core_config->gradient_path_writable = g_value_dup_string (value);
break;
+ case PROP_TOOL_PRESET_PATH:
+ g_free (core_config->tool_preset_path);
+ core_config->tool_preset_path = g_value_dup_string (value);
+ break;
+ case PROP_TOOL_PRESET_PATH_WRITABLE:
+ g_free (core_config->tool_preset_path_writable);
+ core_config->tool_preset_path_writable = g_value_dup_string (value);
+ break;
case PROP_FONT_PATH:
g_free (core_config->font_path);
core_config->font_path = g_value_dup_string (value);
@@ -733,12 +749,6 @@ gimp_core_config_get_property (GObject *object,
case PROP_DYNAMICS_PATH_WRITABLE:
g_value_set_string (value, core_config->dynamics_path_writable);
break;
- case PROP_TOOL_PRESET_PATH:
- g_value_set_string (value, core_config->tool_preset_path);
- break;
- case PROP_TOOL_PRESET_PATH_WRITABLE:
- g_value_set_string (value, core_config->tool_preset_path_writable);
- break;
case PROP_PATTERN_PATH:
g_value_set_string (value, core_config->pattern_path);
break;
@@ -757,6 +767,12 @@ gimp_core_config_get_property (GObject *object,
case PROP_GRADIENT_PATH_WRITABLE:
g_value_set_string (value, core_config->gradient_path_writable);
break;
+ case PROP_TOOL_PRESET_PATH:
+ g_value_set_string (value, core_config->tool_preset_path);
+ break;
+ case PROP_TOOL_PRESET_PATH_WRITABLE:
+ g_value_set_string (value, core_config->tool_preset_path_writable);
+ break;
case PROP_FONT_PATH:
g_value_set_string (value, core_config->font_path);
break;
diff --git a/app/config/gimpcoreconfig.h b/app/config/gimpcoreconfig.h
index 87f1ec7..0a1f86a 100644
--- a/app/config/gimpcoreconfig.h
+++ b/app/config/gimpcoreconfig.h
@@ -55,10 +55,10 @@ struct _GimpCoreConfig
gchar *palette_path_writable;
gchar *gradient_path;
gchar *gradient_path_writable;
- gchar *font_path;
- gchar *font_path_writable; /* unused */
gchar *tool_preset_path;
gchar *tool_preset_path_writable;
+ gchar *font_path;
+ gchar *font_path_writable; /* unused */
gchar *default_brush;
gchar *default_dynamics;
gchar *default_pattern;
diff --git a/app/core/core-enums.h b/app/core/core-enums.h
index 10b4afb..a5f76ee 100644
--- a/app/core/core-enums.h
+++ b/app/core/core-enums.h
@@ -610,50 +610,51 @@ typedef enum /*< pdb-skip >*/
typedef enum /*< pdb-skip, skip >*/
{
- GIMP_CONTEXT_FIRST_PROP = 2,
-
- GIMP_CONTEXT_PROP_IMAGE = GIMP_CONTEXT_FIRST_PROP,
- GIMP_CONTEXT_PROP_DISPLAY = 3,
- GIMP_CONTEXT_PROP_TOOL = 4,
- GIMP_CONTEXT_PROP_PAINT_INFO = 5,
- GIMP_CONTEXT_PROP_FOREGROUND = 6,
- GIMP_CONTEXT_PROP_BACKGROUND = 7,
- GIMP_CONTEXT_PROP_OPACITY = 8,
- GIMP_CONTEXT_PROP_PAINT_MODE = 9,
- GIMP_CONTEXT_PROP_BRUSH = 10,
- GIMP_CONTEXT_PROP_DYNAMICS = 11,
- GIMP_CONTEXT_PROP_PATTERN = 12,
- GIMP_CONTEXT_PROP_GRADIENT = 13,
- GIMP_CONTEXT_PROP_PALETTE = 14,
- GIMP_CONTEXT_PROP_TOOL_PRESET= 15,
- GIMP_CONTEXT_PROP_FONT = 16,
- GIMP_CONTEXT_PROP_BUFFER = 17,
- GIMP_CONTEXT_PROP_IMAGEFILE = 18,
- GIMP_CONTEXT_PROP_TEMPLATE = 19,
-
- GIMP_CONTEXT_LAST_PROP = GIMP_CONTEXT_PROP_TEMPLATE
+ GIMP_CONTEXT_FIRST_PROP = 2,
+
+ GIMP_CONTEXT_PROP_IMAGE = GIMP_CONTEXT_FIRST_PROP,
+ GIMP_CONTEXT_PROP_DISPLAY = 3,
+ GIMP_CONTEXT_PROP_TOOL = 4,
+ GIMP_CONTEXT_PROP_PAINT_INFO = 5,
+ GIMP_CONTEXT_PROP_FOREGROUND = 6,
+ GIMP_CONTEXT_PROP_BACKGROUND = 7,
+ GIMP_CONTEXT_PROP_OPACITY = 8,
+ GIMP_CONTEXT_PROP_PAINT_MODE = 9,
+ GIMP_CONTEXT_PROP_BRUSH = 10,
+ GIMP_CONTEXT_PROP_DYNAMICS = 11,
+ GIMP_CONTEXT_PROP_PATTERN = 12,
+ GIMP_CONTEXT_PROP_GRADIENT = 13,
+ GIMP_CONTEXT_PROP_PALETTE = 14,
+ GIMP_CONTEXT_PROP_TOOL_PRESET = 15,
+ GIMP_CONTEXT_PROP_FONT = 16,
+ GIMP_CONTEXT_PROP_BUFFER = 17,
+ GIMP_CONTEXT_PROP_IMAGEFILE = 18,
+ GIMP_CONTEXT_PROP_TEMPLATE = 19,
+
+ GIMP_CONTEXT_LAST_PROP = GIMP_CONTEXT_PROP_TEMPLATE
} GimpContextPropType;
typedef enum /*< pdb-skip, skip >*/
{
- GIMP_CONTEXT_IMAGE_MASK = 1 << 2,
- GIMP_CONTEXT_DISPLAY_MASK = 1 << 3,
- GIMP_CONTEXT_TOOL_MASK = 1 << 4,
- GIMP_CONTEXT_PAINT_INFO_MASK = 1 << 5,
- GIMP_CONTEXT_FOREGROUND_MASK = 1 << 6,
- GIMP_CONTEXT_BACKGROUND_MASK = 1 << 7,
- GIMP_CONTEXT_OPACITY_MASK = 1 << 8,
- GIMP_CONTEXT_PAINT_MODE_MASK = 1 << 9,
- GIMP_CONTEXT_BRUSH_MASK = 1 << 10,
- GIMP_CONTEXT_DYNAMICS_MASK = 1 << 11,
- GIMP_CONTEXT_PATTERN_MASK = 1 << 12,
- GIMP_CONTEXT_GRADIENT_MASK = 1 << 13,
- GIMP_CONTEXT_PALETTE_MASK = 1 << 14,
- GIMP_CONTEXT_FONT_MASK = 1 << 15,
- GIMP_CONTEXT_BUFFER_MASK = 1 << 16,
- GIMP_CONTEXT_IMAGEFILE_MASK = 1 << 17,
- GIMP_CONTEXT_TEMPLATE_MASK = 1 << 18,
+ GIMP_CONTEXT_IMAGE_MASK = 1 << 2,
+ GIMP_CONTEXT_DISPLAY_MASK = 1 << 3,
+ GIMP_CONTEXT_TOOL_MASK = 1 << 4,
+ GIMP_CONTEXT_PAINT_INFO_MASK = 1 << 5,
+ GIMP_CONTEXT_FOREGROUND_MASK = 1 << 6,
+ GIMP_CONTEXT_BACKGROUND_MASK = 1 << 7,
+ GIMP_CONTEXT_OPACITY_MASK = 1 << 8,
+ GIMP_CONTEXT_PAINT_MODE_MASK = 1 << 9,
+ GIMP_CONTEXT_BRUSH_MASK = 1 << 10,
+ GIMP_CONTEXT_DYNAMICS_MASK = 1 << 11,
+ GIMP_CONTEXT_PATTERN_MASK = 1 << 12,
+ GIMP_CONTEXT_GRADIENT_MASK = 1 << 13,
+ GIMP_CONTEXT_PALETTE_MASK = 1 << 14,
+ GIMP_CONTEXT_TOOL_PRESET_MASK = 1 << 15,
+ GIMP_CONTEXT_FONT_MASK = 1 << 16,
+ GIMP_CONTEXT_BUFFER_MASK = 1 << 17,
+ GIMP_CONTEXT_IMAGEFILE_MASK = 1 << 18,
+ GIMP_CONTEXT_TEMPLATE_MASK = 1 << 19,
/* aliases */
GIMP_CONTEXT_PAINT_PROPS_MASK = (GIMP_CONTEXT_FOREGROUND_MASK |
diff --git a/app/core/gimp.c b/app/core/gimp.c
index c6d0573..6bf20a4 100644
--- a/app/core/gimp.c
+++ b/app/core/gimp.c
@@ -249,7 +249,6 @@ gimp_init (Gimp *gimp)
gimp->pattern_factory = NULL;
gimp->gradient_factory = NULL;
gimp->palette_factory = NULL;
-
gimp->tool_preset_factory = NULL;
gimp->tag_cache = NULL;
@@ -584,7 +583,7 @@ gimp_real_initialize (Gimp *gimp,
static const GimpDataFactoryLoaderEntry tool_preset_loader_entries[] =
{
- { gimp_tool_preset_load, GIMP_TOOL_PRESET_FILE_EXTENSION, TRUE }
+ { gimp_tool_preset_load, GIMP_TOOL_PRESET_FILE_EXTENSION, TRUE }
};
GimpData *clipboard_brush;
@@ -733,7 +732,6 @@ gimp_real_exit (Gimp *gimp,
gimp_data_factory_data_save (gimp->pattern_factory);
gimp_data_factory_data_save (gimp->gradient_factory);
gimp_data_factory_data_save (gimp->palette_factory);
-
gimp_data_factory_data_save (gimp->tool_preset_factory);
gimp_fonts_reset (gimp);
diff --git a/app/core/gimpcontext.c b/app/core/gimpcontext.c
index 11b2294..d34621e 100644
--- a/app/core/gimpcontext.c
+++ b/app/core/gimpcontext.c
@@ -45,9 +45,9 @@
#include "gimppaintinfo.h"
#include "gimppalette.h"
#include "gimppattern.h"
-#include "gimptoolpreset.h"
#include "gimptemplate.h"
#include "gimptoolinfo.h"
+#include "gimptoolpreset.h"
#include "text/gimpfont.h"
@@ -207,15 +207,15 @@ static void gimp_context_real_set_palette (GimpContext *context,
GimpPalette *palatte);
/* tool preset */
-static void gimp_context_tool_preset_dirty (GimpToolPreset *tool_preset,
- GimpContext *context);
-static void gimp_context_tool_preset_removed (GimpContainer *container,
- GimpToolPreset *tool_preset,
- GimpContext *context);
-static void gimp_context_tool_preset_list_thaw (GimpContainer *container,
- GimpContext *context);
-static void gimp_context_real_set_tool_preset (GimpContext *context,
- GimpToolPreset *tool_preset);
+static void gimp_context_tool_preset_dirty (GimpToolPreset *tool_preset,
+ GimpContext *context);
+static void gimp_context_tool_preset_removed (GimpContainer *container,
+ GimpToolPreset *tool_preset,
+ GimpContext *context);
+static void gimp_context_tool_preset_list_thaw (GimpContainer *container,
+ GimpContext *context);
+static void gimp_context_real_set_tool_preset (GimpContext *context,
+ GimpToolPreset *tool_preset);
/* font */
static void gimp_context_font_dirty (GimpFont *font,
@@ -1664,7 +1664,6 @@ gimp_context_copy_property (GimpContext *src,
dest_name_loc = &dest->palette_name;
break;
-
case GIMP_CONTEXT_PROP_TOOL_PRESET:
gimp_context_real_set_tool_preset (dest, src->tool_preset);
object = src->tool_preset;
@@ -3050,6 +3049,7 @@ gimp_context_real_set_palette (GimpContext *context,
gimp_context_palette_changed (context);
}
+
/********************************************************************************/
/* tool preset *****************************************************************/
@@ -3084,16 +3084,16 @@ gimp_context_tool_preset_changed (GimpContext *context)
static void
gimp_context_tool_preset_dirty (GimpToolPreset *tool_preset,
- GimpContext *context)
+ GimpContext *context)
{
g_free (context->tool_preset_name);
context->tool_preset_name = g_strdup (gimp_object_get_name (tool_preset));
}
static void
-gimp_context_tool_preset_removed (GimpContainer *container,
- GimpToolPreset *tool_preset,
- GimpContext *context)
+gimp_context_tool_preset_removed (GimpContainer *container,
+ GimpToolPreset *tool_preset,
+ GimpContext *context)
{
if (tool_preset == context->tool_preset)
{
@@ -3111,7 +3111,7 @@ gimp_context_tool_preset_removed (GimpContainer *container,
static void
gimp_context_tool_preset_list_thaw (GimpContainer *container,
- GimpContext *context)
+ GimpContext *context)
{
GimpToolPreset *tool_preset;
@@ -3126,8 +3126,8 @@ gimp_context_tool_preset_list_thaw (GimpContainer *container,
}
static void
-gimp_context_real_set_tool_preset (GimpContext *context,
- GimpToolPreset *tool_preset)
+gimp_context_real_set_tool_preset (GimpContext *context,
+ GimpToolPreset *tool_preset)
{
if (! standard_tool_preset)
{
diff --git a/app/core/gimpcontext.h b/app/core/gimpcontext.h
index 80e48ca..bcdabc3 100644
--- a/app/core/gimpcontext.h
+++ b/app/core/gimpcontext.h
@@ -197,112 +197,112 @@ GimpContextPropType gimp_context_type_to_property (GType type);
const gchar * gimp_context_type_to_prop_name (GType type);
const gchar * gimp_context_type_to_signal_name (GType type);
-GimpObject * gimp_context_get_by_type (GimpContext *context,
- GType type);
-void gimp_context_set_by_type (GimpContext *context,
- GType type,
- GimpObject *object);
-void gimp_context_changed_by_type (GimpContext *context,
- GType type);
+GimpObject * gimp_context_get_by_type (GimpContext *context,
+ GType type);
+void gimp_context_set_by_type (GimpContext *context,
+ GType type,
+ GimpObject *object);
+void gimp_context_changed_by_type (GimpContext *context,
+ GType type);
/* image */
-GimpImage * gimp_context_get_image (GimpContext *context);
-void gimp_context_set_image (GimpContext *context,
- GimpImage *image);
-void gimp_context_image_changed (GimpContext *context);
+GimpImage * gimp_context_get_image (GimpContext *context);
+void gimp_context_set_image (GimpContext *context,
+ GimpImage *image);
+void gimp_context_image_changed (GimpContext *context);
/* display */
-gpointer gimp_context_get_display (GimpContext *context);
-void gimp_context_set_display (GimpContext *context,
- gpointer display);
-void gimp_context_display_changed (GimpContext *context);
+gpointer gimp_context_get_display (GimpContext *context);
+void gimp_context_set_display (GimpContext *context,
+ gpointer display);
+void gimp_context_display_changed (GimpContext *context);
/* tool */
-GimpToolInfo * gimp_context_get_tool (GimpContext *context);
-void gimp_context_set_tool (GimpContext *context,
- GimpToolInfo *tool_info);
-void gimp_context_tool_changed (GimpContext *context);
+GimpToolInfo * gimp_context_get_tool (GimpContext *context);
+void gimp_context_set_tool (GimpContext *context,
+ GimpToolInfo *tool_info);
+void gimp_context_tool_changed (GimpContext *context);
/* paint info */
-GimpPaintInfo * gimp_context_get_paint_info (GimpContext *context);
-void gimp_context_set_paint_info (GimpContext *context,
- GimpPaintInfo *paint_info);
-void gimp_context_paint_info_changed (GimpContext *context);
+GimpPaintInfo * gimp_context_get_paint_info (GimpContext *context);
+void gimp_context_set_paint_info (GimpContext *context,
+ GimpPaintInfo *paint_info);
+void gimp_context_paint_info_changed (GimpContext *context);
/* foreground color */
-void gimp_context_get_foreground (GimpContext *context,
- GimpRGB *color);
-void gimp_context_set_foreground (GimpContext *context,
- const GimpRGB *color);
-void gimp_context_foreground_changed (GimpContext *context);
+void gimp_context_get_foreground (GimpContext *context,
+ GimpRGB *color);
+void gimp_context_set_foreground (GimpContext *context,
+ const GimpRGB *color);
+void gimp_context_foreground_changed (GimpContext *context);
/* background color */
-void gimp_context_get_background (GimpContext *context,
- GimpRGB *color);
-void gimp_context_set_background (GimpContext *context,
- const GimpRGB *color);
-void gimp_context_background_changed (GimpContext *context);
+void gimp_context_get_background (GimpContext *context,
+ GimpRGB *color);
+void gimp_context_set_background (GimpContext *context,
+ const GimpRGB *color);
+void gimp_context_background_changed (GimpContext *context);
/* color utility functions */
-void gimp_context_set_default_colors (GimpContext *context);
-void gimp_context_swap_colors (GimpContext *context);
+void gimp_context_set_default_colors (GimpContext *context);
+void gimp_context_swap_colors (GimpContext *context);
/* opacity */
-gdouble gimp_context_get_opacity (GimpContext *context);
-void gimp_context_set_opacity (GimpContext *context,
- gdouble opacity);
-void gimp_context_opacity_changed (GimpContext *context);
+gdouble gimp_context_get_opacity (GimpContext *context);
+void gimp_context_set_opacity (GimpContext *context,
+ gdouble opacity);
+void gimp_context_opacity_changed (GimpContext *context);
/* paint mode */
GimpLayerModeEffects
- gimp_context_get_paint_mode (GimpContext *context);
-void gimp_context_set_paint_mode (GimpContext *context,
- GimpLayerModeEffects paint_mode);
-void gimp_context_paint_mode_changed (GimpContext *context);
+ gimp_context_get_paint_mode (GimpContext *context);
+void gimp_context_set_paint_mode (GimpContext *context,
+ GimpLayerModeEffects paint_mode);
+void gimp_context_paint_mode_changed (GimpContext *context);
/* brush */
-GimpBrush * gimp_context_get_brush (GimpContext *context);
-void gimp_context_set_brush (GimpContext *context,
- GimpBrush *brush);
-void gimp_context_brush_changed (GimpContext *context);
+GimpBrush * gimp_context_get_brush (GimpContext *context);
+void gimp_context_set_brush (GimpContext *context,
+ GimpBrush *brush);
+void gimp_context_brush_changed (GimpContext *context);
/* dynamics */
-GimpDynamics * gimp_context_get_dynamics (GimpContext *context);
-void gimp_context_set_dynamics (GimpContext *context,
- GimpDynamics *dynamics);
-void gimp_context_dynamics_changed (GimpContext *context);
+GimpDynamics * gimp_context_get_dynamics (GimpContext *context);
+void gimp_context_set_dynamics (GimpContext *context,
+ GimpDynamics *dynamics);
+void gimp_context_dynamics_changed (GimpContext *context);
/* pattern */
-GimpPattern * gimp_context_get_pattern (GimpContext *context);
-void gimp_context_set_pattern (GimpContext *context,
- GimpPattern *pattern);
-void gimp_context_pattern_changed (GimpContext *context);
+GimpPattern * gimp_context_get_pattern (GimpContext *context);
+void gimp_context_set_pattern (GimpContext *context,
+ GimpPattern *pattern);
+void gimp_context_pattern_changed (GimpContext *context);
/* gradient */
-GimpGradient * gimp_context_get_gradient (GimpContext *context);
-void gimp_context_set_gradient (GimpContext *context,
- GimpGradient *gradient);
-void gimp_context_gradient_changed (GimpContext *context);
+GimpGradient * gimp_context_get_gradient (GimpContext *context);
+void gimp_context_set_gradient (GimpContext *context,
+ GimpGradient *gradient);
+void gimp_context_gradient_changed (GimpContext *context);
/* palette */
-GimpPalette * gimp_context_get_palette (GimpContext *context);
-void gimp_context_set_palette (GimpContext *context,
- GimpPalette *palette);
-void gimp_context_palette_changed (GimpContext *context);
+GimpPalette * gimp_context_get_palette (GimpContext *context);
+void gimp_context_set_palette (GimpContext *context,
+ GimpPalette *palette);
+void gimp_context_palette_changed (GimpContext *context);
/* tool_preset */
@@ -313,34 +313,34 @@ void gimp_context_tool_preset_changed (GimpContext *context);
/* font */
-GimpFont * gimp_context_get_font (GimpContext *context);
-void gimp_context_set_font (GimpContext *context,
- GimpFont *font);
-const gchar * gimp_context_get_font_name (GimpContext *context);
-void gimp_context_set_font_name (GimpContext *context,
- const gchar *name);
-void gimp_context_font_changed (GimpContext *context);
+GimpFont * gimp_context_get_font (GimpContext *context);
+void gimp_context_set_font (GimpContext *context,
+ GimpFont *font);
+const gchar * gimp_context_get_font_name (GimpContext *context);
+void gimp_context_set_font_name (GimpContext *context,
+ const gchar *name);
+void gimp_context_font_changed (GimpContext *context);
/* buffer */
-GimpBuffer * gimp_context_get_buffer (GimpContext *context);
-void gimp_context_set_buffer (GimpContext *context,
- GimpBuffer *palette);
-void gimp_context_buffer_changed (GimpContext *context);
+GimpBuffer * gimp_context_get_buffer (GimpContext *context);
+void gimp_context_set_buffer (GimpContext *context,
+ GimpBuffer *palette);
+void gimp_context_buffer_changed (GimpContext *context);
/* imagefile */
-GimpImagefile * gimp_context_get_imagefile (GimpContext *context);
-void gimp_context_set_imagefile (GimpContext *context,
- GimpImagefile *imagefile);
-void gimp_context_imagefile_changed (GimpContext *context);
+GimpImagefile * gimp_context_get_imagefile (GimpContext *context);
+void gimp_context_set_imagefile (GimpContext *context,
+ GimpImagefile *imagefile);
+void gimp_context_imagefile_changed (GimpContext *context);
/* template */
-GimpTemplate * gimp_context_get_template (GimpContext *context);
-void gimp_context_set_template (GimpContext *context,
- GimpTemplate *template);
-void gimp_context_template_changed (GimpContext *context);
+GimpTemplate * gimp_context_get_template (GimpContext *context);
+void gimp_context_set_template (GimpContext *context,
+ GimpTemplate *template);
+void gimp_context_template_changed (GimpContext *context);
#endif /* __GIMP_CONTEXT_H__ */
diff --git a/app/core/gimptoolpreset.c b/app/core/gimptoolpreset.c
index 382909a..5ebb82e 100644
--- a/app/core/gimptoolpreset.c
+++ b/app/core/gimptoolpreset.c
@@ -31,12 +31,11 @@
#include "gimp-intl.h"
+
enum
{
PROP_0,
-
PROP_NAME,
-
PROP_TOOL_OPTIONS
};
@@ -87,7 +86,6 @@ gimp_tool_preset_class_init (GimpToolPresetClass *klass)
"tool-options", NULL,
GIMP_TYPE_TOOL_PRESET,
GIMP_CONFIG_PARAM_AGGREGATE);
-
}
static void
@@ -101,7 +99,11 @@ gimp_tool_preset_finalize (GObject *object)
{
GimpToolPreset *tool_preset = GIMP_TOOL_PRESET (object);
- g_object_unref (tool_preset->tool_options);
+ if (tool_preset->tool_options)
+ {
+ g_object_unref (tool_preset->tool_options);
+ tool_preset->tool_options = NULL;
+ }
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@@ -112,39 +114,33 @@ gimp_tool_preset_set_property (GObject *object,
const GValue *value,
GParamSpec *pspec)
{
- GimpToolPreset *tool_preset = GIMP_TOOL_PRESET (object);
- GimpToolOptions *src_output = NULL;
- GimpToolOptions *dest_output = NULL;
+ GimpToolPreset *tool_preset = GIMP_TOOL_PRESET (object);
switch (property_id)
{
case PROP_NAME:
- gimp_object_set_name (GIMP_OBJECT (tool_preset), g_value_get_string (value));
+ gimp_object_set_name (GIMP_OBJECT (tool_preset),
+ g_value_get_string (value));
break;
case PROP_TOOL_OPTIONS:
- src_output = g_value_get_object (value);
- dest_output = tool_preset->tool_options;
+ if (tool_preset->tool_options)
+ g_object_unref (tool_preset->tool_options);
+ tool_preset->tool_options =
+ gimp_config_duplicate (g_value_get_object (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
-
- if (src_output && dest_output)
- {
- gimp_config_copy (GIMP_CONFIG (src_output),
- GIMP_CONFIG (dest_output),
- GIMP_CONFIG_PARAM_SERIALIZE);
- }
}
static void
gimp_tool_preset_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec)
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
{
GimpToolPreset *tool_preset = GIMP_TOOL_PRESET (object);
@@ -202,8 +198,6 @@ gimp_tool_preset_new (const gchar *name)
NULL);
}
-
-
GimpData *
gimp_tool_preset_get_standard (void)
{
diff --git a/app/core/gimptoolpreset.h b/app/core/gimptoolpreset.h
index 31102a4..8fce4c6 100644
--- a/app/core/gimptoolpreset.h
+++ b/app/core/gimptoolpreset.h
@@ -34,8 +34,9 @@ typedef struct _GimpToolPresetClass GimpToolPresetClass;
struct _GimpToolPreset
{
- GimpData parent_instance;
- GimpToolOptions *tool_options;
+ GimpData parent_instance;
+
+ GimpToolOptions *tool_options;
};
struct _GimpToolPresetClass
@@ -44,10 +45,11 @@ struct _GimpToolPresetClass
};
-GType gimp_tool_preset_get_type (void) G_GNUC_CONST;
+GType gimp_tool_preset_get_type (void) G_GNUC_CONST;
+
+GimpData * gimp_tool_preset_new (const gchar *name);
-GimpData * gimp_tool_preset_new (const gchar *name);
+GimpData * gimp_tool_preset_get_standard (void);
-GimpData * gimp_tool_preset_get_standard (void);
#endif /* __GIMP_TOOL_PRESET_H__ */
diff --git a/app/dialogs/dialogs.c b/app/dialogs/dialogs.c
index a96a9e5..84ebe1f 100644
--- a/app/dialogs/dialogs.c
+++ b/app/dialogs/dialogs.c
@@ -167,19 +167,19 @@ GimpContainer *global_recent_docks = NULL;
TRUE /* dockable */}
#define LIST(id, new_func, name, blurb, stock_id, help_id, view_size) \
- { "gimp-"#id"-list" /* identifier */, \
- name /* name */, \
- blurb /* blurb */, \
- stock_id /* stock_id */, \
- help_id /* help_id */, \
+ { "gimp-"#id"-list" /* identifier */, \
+ name /* name */, \
+ blurb /* blurb */, \
+ stock_id /* stock_id */, \
+ help_id /* help_id */, \
dialogs_##new_func##_list_view_new /* new_func */, \
- view_size /* view_size */, \
- FALSE /* singleton */, \
- FALSE /* session_managed */, \
- FALSE /* remember_size */, \
- TRUE /* remember_if_open */, \
- TRUE /* hideable */, \
- TRUE /* dockable */}
+ view_size /* view_size */, \
+ FALSE /* singleton */, \
+ FALSE /* session_managed */, \
+ FALSE /* remember_size */, \
+ TRUE /* remember_if_open */, \
+ TRUE /* hideable */, \
+ TRUE /* dockable */}
static const GimpDialogFactoryEntry entries[] =
diff --git a/app/widgets/gimphelp-ids.h b/app/widgets/gimphelp-ids.h
index b9a369e..e8054dd 100644
--- a/app/widgets/gimphelp-ids.h
+++ b/app/widgets/gimphelp-ids.h
@@ -392,13 +392,13 @@
#define GIMP_HELP_BUFFER_PASTE_AS_NEW "gimp-buffer-paste-as-new"
#define GIMP_HELP_BUFFER_DELETE "gimp-buffer-delete"
-#define GIMP_HELP_TOOL_PRESET_DIALOG "gimp-tool-preset-dialog"
-#define GIMP_HELP_TOOL_PRESET_EDIT "gimp-tool-preset-edit"
-#define GIMP_HELP_TOOL_PRESET_NEW "gimp-tool-preset-new"
-#define GIMP_HELP_TOOL_PRESET_DUPLICATE "gimp-tool-preset-duplicate"
-#define GIMP_HELP_TOOL_PRESET_COPY_LOCATION "gimp-tool-preset-copy-location"
-#define GIMP_HELP_TOOL_PRESET_DELETE "gimp-tool-preset-delete"
-#define GIMP_HELP_TOOL_PRESET_REFRESH "gimp-tool-preset-refresh"
+#define GIMP_HELP_TOOL_PRESET_DIALOG "gimp-tool-preset-dialog"
+#define GIMP_HELP_TOOL_PRESET_EDIT "gimp-tool-preset-edit"
+#define GIMP_HELP_TOOL_PRESET_NEW "gimp-tool-preset-new"
+#define GIMP_HELP_TOOL_PRESET_DUPLICATE "gimp-tool-preset-duplicate"
+#define GIMP_HELP_TOOL_PRESET_COPY_LOCATION "gimp-tool-preset-copy-location"
+#define GIMP_HELP_TOOL_PRESET_DELETE "gimp-tool-preset-delete"
+#define GIMP_HELP_TOOL_PRESET_REFRESH "gimp-tool-preset-refresh"
#define GIMP_HELP_DOCUMENT_CLEAR "gimp-document-clear"
#define GIMP_HELP_DOCUMENT_COPY_LOCATION "gimp-document-copy-location"
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]