[gimp] app: turn the "Gamma Hack" into a non-serializable property
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: turn the "Gamma Hack" into a non-serializable property
- Date: Wed, 11 May 2016 12:34:44 +0000 (UTC)
commit 9bb03073b64ca5252176044070fecfe7f9ba010d
Author: Michael Natterer <mitch gimp org>
Date: Wed May 11 14:33:08 2016 +0200
app: turn the "Gamma Hack" into a non-serializable property
To make it at least behave like other widgets in the dialogs while it
exits.
app/tools/gimpfilteroptions.c | 17 +++++++++++++++++
app/tools/gimpfilteroptions.h | 2 ++
app/tools/gimpfiltertool.c | 24 ++++++++----------------
3 files changed, 27 insertions(+), 16 deletions(-)
---
diff --git a/app/tools/gimpfilteroptions.c b/app/tools/gimpfilteroptions.c
index 436cca7..2ea7d51 100644
--- a/app/tools/gimpfilteroptions.c
+++ b/app/tools/gimpfilteroptions.c
@@ -37,6 +37,7 @@ enum
PROP_PREVIEW_ALIGNMENT,
PROP_PREVIEW_POSITION,
PROP_REGION,
+ PROP_GAMMA_HACK,
PROP_SETTINGS
};
@@ -105,6 +106,14 @@ gimp_filter_options_class_init (GimpFilterOptionsClass *klass)
GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
+ g_object_class_install_property (object_class, PROP_GAMMA_HACK,
+ g_param_spec_boolean ("gamma-hack",
+ "Gamma hack (temp hack, please ignore)",
+ NULL,
+ FALSE,
+ GIMP_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
g_object_class_install_property (object_class, PROP_SETTINGS,
g_param_spec_object ("settings",
NULL, NULL,
@@ -162,6 +171,10 @@ gimp_filter_options_set_property (GObject *object,
options->region = g_value_get_enum (value);
break;
+ case PROP_GAMMA_HACK:
+ options->gamma_hack = g_value_get_boolean (value);
+ break;
+
case PROP_SETTINGS:
if (options->settings)
g_object_unref (options->settings);
@@ -204,6 +217,10 @@ gimp_filter_options_get_property (GObject *object,
g_value_set_enum (value, options->region);
break;
+ case PROP_GAMMA_HACK:
+ g_value_set_boolean (value, options->gamma_hack);
+ break;
+
case PROP_SETTINGS:
g_value_set_object (value, options->settings);
break;
diff --git a/app/tools/gimpfilteroptions.h b/app/tools/gimpfilteroptions.h
index 22b409d..c20adc8 100644
--- a/app/tools/gimpfilteroptions.h
+++ b/app/tools/gimpfilteroptions.h
@@ -41,6 +41,8 @@ struct _GimpFilterOptions
GimpAlignmentType preview_alignment;
gdouble preview_position;
GimpImageMapRegion region;
+ gboolean gamma_hack;
+
GFile *settings;
};
diff --git a/app/tools/gimpfiltertool.c b/app/tools/gimpfiltertool.c
index 26782db..020075c 100644
--- a/app/tools/gimpfiltertool.c
+++ b/app/tools/gimpfiltertool.c
@@ -278,17 +278,6 @@ gimp_filter_tool_finalize (GObject *object)
G_OBJECT_CLASS (parent_class)->finalize (object);
}
-static void
-gamma_hack (GtkToggleButton *button,
- GimpFilterTool *filter_tool)
-{
- if (filter_tool->filter)
- {
- gimp_image_map_set_gamma_hack (filter_tool->filter,
- gtk_toggle_button_get_active (button));
- }
-}
-
#define RESPONSE_RESET 1
static gboolean
@@ -411,14 +400,11 @@ gimp_filter_tool_initialize (GimpTool *tool,
}
/* The gamma hack toggle */
- toggle = gtk_check_button_new_with_label ("Gamma hack (temp hack, please ignore)");
+ toggle = gimp_prop_check_button_new (G_OBJECT (tool_info->tool_options),
+ "gamma-hack", NULL);
gtk_box_pack_end (GTK_BOX (vbox), toggle, FALSE, FALSE, 0);
gtk_widget_show (toggle);
- g_signal_connect (toggle, "toggled",
- G_CALLBACK (gamma_hack),
- filter_tool);
-
/* The preview and split view toggles */
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
gtk_box_pack_end (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
@@ -793,6 +779,12 @@ gimp_filter_tool_options_notify (GimpTool *tool,
gimp_image_map_set_region (filter_tool->filter,
filter_options->region);
}
+ else if (! strcmp (pspec->name, "gamma-hack") &&
+ filter_tool->filter)
+ {
+ gimp_image_map_set_gamma_hack (filter_tool->filter,
+ filter_options->gamma_hack);
+ }
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]