Commit 3c7fcf4c authored by Michael Natterer's avatar Michael Natterer 😴

Bug 599573 - Remember dialog defaults between Gimp sessions

Remember the "Convert to Color Profile" dialog's "intent" and "black
point compensation" in GimpDialogConfig.
parent e703f848
......@@ -48,6 +48,9 @@ enum
PROP_COLOR_PROFILE_POLICY,
PROP_IMAGE_CONVERT_PROFILE_INTENT,
PROP_IMAGE_CONVERT_PROFILE_BPC,
PROP_LAYER_NEW_NAME,
PROP_LAYER_NEW_FILL_TYPE,
......@@ -142,6 +145,22 @@ gimp_dialog_config_class_init (GimpDialogConfigClass *klass)
GIMP_COLOR_PROFILE_POLICY_ASK,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_ENUM (object_class, PROP_IMAGE_CONVERT_PROFILE_INTENT,
"image-convert-profile-intent",
"Default rendering intent fo color profile conversion",
IMAGE_CONVERT_PROFILE_INTENT_BLURB,
GIMP_TYPE_COLOR_RENDERING_INTENT,
GIMP_COLOR_RENDERING_INTENT_RELATIVE_COLORIMETRIC,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_IMAGE_CONVERT_PROFILE_BPC,
"image-convert-profile-black-point-compensation",
"Default 'Black point compensation' for "
"color profile conversion",
IMAGE_CONVERT_PROFILE_BPC_BLURB,
TRUE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_STRING (object_class, PROP_LAYER_NEW_NAME,
"layer-new-name",
"Default new layer name",
......@@ -377,6 +396,13 @@ gimp_dialog_config_set_property (GObject *object,
config->color_profile_policy = g_value_get_enum (value);
break;
case PROP_IMAGE_CONVERT_PROFILE_INTENT:
config->image_convert_profile_intent = g_value_get_enum (value);
break;
case PROP_IMAGE_CONVERT_PROFILE_BPC:
config->image_convert_profile_bpc = g_value_get_boolean (value);
break;
case PROP_LAYER_NEW_NAME:
if (config->layer_new_name)
g_free (config->layer_new_name);
......@@ -479,6 +505,13 @@ gimp_dialog_config_get_property (GObject *object,
g_value_set_enum (value, config->color_profile_policy);
break;
case PROP_IMAGE_CONVERT_PROFILE_INTENT:
g_value_set_enum (value, config->image_convert_profile_intent);
break;
case PROP_IMAGE_CONVERT_PROFILE_BPC:
g_value_set_boolean (value, config->image_convert_profile_bpc);
break;
case PROP_LAYER_NEW_NAME:
g_value_set_string (value, config->layer_new_name);
break;
......
......@@ -42,38 +42,41 @@ typedef struct _GimpDialogConfigClass GimpDialogConfigClass;
struct _GimpDialogConfig
{
GimpGuiConfig parent_instance;
GimpGuiConfig parent_instance;
GimpColorProfilePolicy color_profile_policy;
GimpColorProfilePolicy color_profile_policy;
gchar *layer_new_name;
GimpFillType layer_new_fill_type;
GimpColorRenderingIntent image_convert_profile_intent;
gboolean image_convert_profile_bpc;
GimpAddMaskType layer_add_mask_type;
gboolean layer_add_mask_invert;
gchar *layer_new_name;
GimpFillType layer_new_fill_type;
GimpMergeType layer_merge_type;
gboolean layer_merge_active_group_only;
gboolean layer_merge_discard_invisible;
GimpAddMaskType layer_add_mask_type;
gboolean layer_add_mask_invert;
gchar *channel_new_name;
GimpRGB channel_new_color;
GimpMergeType layer_merge_type;
gboolean layer_merge_active_group_only;
gboolean layer_merge_discard_invisible;
gchar *vectors_new_name;
gchar *channel_new_name;
GimpRGB channel_new_color;
gdouble selection_feather_radius;
gchar *vectors_new_name;
gdouble selection_grow_radius;
gdouble selection_feather_radius;
gdouble selection_shrink_radius;
gboolean selection_shrink_edge_lock;
gdouble selection_grow_radius;
gdouble selection_border_radius;
gboolean selection_border_edge_lock;
GimpChannelBorderStyle selection_border_style;
gdouble selection_shrink_radius;
gboolean selection_shrink_edge_lock;
GimpFillOptions *fill_options;
GimpStrokeOptions *stroke_options;
gdouble selection_border_radius;
gboolean selection_border_edge_lock;
GimpChannelBorderStyle selection_border_style;
GimpFillOptions *fill_options;
GimpStrokeOptions *stroke_options;
};
struct _GimpDialogConfigClass
......
......@@ -420,6 +420,13 @@ _("Sets the folder for temporary storage. Files will appear here " \
#define ICON_THEME_PATH_BLURB \
"Sets the icon theme search path."
#define IMAGE_CONVERT_PROFILE_INTENT_BLURB \
_("Sets the default rendering intent for the 'Convert to Color Profile' dialog.")
#define IMAGE_CONVERT_PROFILE_BPC_BLURB \
_("Sets the default 'Black Point Compensation' state for the " \
"'Convert to Color Profile' dialog.")
#define LAYER_NEW_NAME_BLURB \
_("Sets the default layer name for the 'New Layer' dialog.")
......
......@@ -33,7 +33,7 @@
#include "dialogs-types.h"
#include "config/gimpcoreconfig.h"
#include "config/gimpdialogconfig.h"
#include "gegl/gimp-babl.h"
......@@ -82,12 +82,6 @@ static void color_profile_dest_changed (GtkWidget *combo,
static void color_profile_dialog_free (ProfileDialog *dialog);
/* defaults */
static GimpColorRenderingIntent saved_intent = -1;
static gboolean saved_bpc = FALSE;
/* public functions */
GtkWidget *
......@@ -98,6 +92,7 @@ color_profile_dialog_new (ColorProfileDialogType dialog_type,
GimpProgress *progress)
{
ProfileDialog *dialog;
GimpDialogConfig *config;
GtkWidget *frame;
GtkWidget *vbox;
GtkWidget *expander;
......@@ -109,23 +104,16 @@ color_profile_dialog_new (ColorProfileDialogType dialog_type,
g_return_val_if_fail (GTK_IS_WIDGET (parent), NULL);
g_return_val_if_fail (progress == NULL || GIMP_IS_PROGRESS (progress), NULL);
config = GIMP_DIALOG_CONFIG (image->gimp->config);
dialog = g_slice_new0 (ProfileDialog);
dialog->dialog_type = dialog_type;
dialog->image = image;
dialog->progress = progress;
dialog->config = image->gimp->config->color_management;
if (saved_intent == -1)
{
dialog->intent = GIMP_COLOR_RENDERING_INTENT_RELATIVE_COLORIMETRIC;
dialog->bpc = TRUE;
}
else
{
dialog->intent = saved_intent;
dialog->bpc = saved_bpc;
}
dialog->intent = config->image_convert_profile_intent;
dialog->bpc = config->image_convert_profile_bpc;
switch (dialog_type)
{
......@@ -464,8 +452,16 @@ color_profile_dialog_response (GtkWidget *widget,
if (success)
{
saved_intent = dialog->intent;
saved_bpc = dialog->bpc;
GimpDialogConfig *config;
config = GIMP_DIALOG_CONFIG (dialog->image->gimp->config);
g_object_set (config,
"image-convert-profile-intent",
dialog->intent,
"image-convert-profile-black-point-compensation",
dialog->bpc,
NULL);
}
}
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment