[gimp] libgimpconfig: add getters for all GimpColorConfig members
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] libgimpconfig: add getters for all GimpColorConfig members
- Date: Sun, 5 Jun 2016 21:59:06 +0000 (UTC)
commit 8abf1aab5ecd1e83a083f6c4604189fcb5eaf271
Author: Michael Natterer <mitch gimp org>
Date: Sun Jun 5 23:58:02 2016 +0200
libgimpconfig: add getters for all GimpColorConfig members
and use them instead of peeking the public object struct.
app/actions/view-actions.c | 12 ++--
app/actions/view-commands.c | 18 ++--
app/display/gimpdisplayshell-profile.c | 12 ++--
libgimpconfig/gimpcolorconfig.c | 139 ++++++++++++++++++++++++++++++++
libgimpconfig/gimpcolorconfig.h | 13 +++
libgimpconfig/gimpconfig.def | 7 ++
libgimpwidgets/gimpwidgetsutils.c | 20 +++---
modules/display-filter-lcms.c | 2 +-
8 files changed, 191 insertions(+), 32 deletions(-)
---
diff --git a/app/actions/view-actions.c b/app/actions/view-actions.c
index e240ecf..63388f6 100644
--- a/app/actions/view-actions.c
+++ b/app/actions/view-actions.c
@@ -814,7 +814,7 @@ view_actions_update (GimpActionGroup *group,
color_config = gimp_display_shell_get_color_config (shell);
- switch (color_config->mode)
+ switch (gimp_color_config_get_mode (color_config))
{
case GIMP_COLOR_MANAGEMENT_OFF:
break;
@@ -829,7 +829,7 @@ view_actions_update (GimpActionGroup *group,
break;
}
- switch (color_config->display_intent)
+ switch (gimp_color_config_get_display_intent (color_config))
{
case GIMP_COLOR_RENDERING_INTENT_PERCEPTUAL:
action = "view-display-intent-perceptual";
@@ -850,7 +850,7 @@ view_actions_update (GimpActionGroup *group,
gimp_action_group_set_action_active (group, action, TRUE);
- switch (color_config->simulation_intent)
+ switch (gimp_color_config_get_simulation_intent (color_config))
{
case GIMP_COLOR_RENDERING_INTENT_PERCEPTUAL:
action = "view-softproof-intent-perceptual";
@@ -871,9 +871,9 @@ view_actions_update (GimpActionGroup *group,
gimp_action_group_set_action_active (group, action, TRUE);
- d_bpc = color_config->display_use_black_point_compensation;
- s_bpc = color_config->simulation_use_black_point_compensation;
- gammut = color_config->simulation_gamut_check;
+ d_bpc = gimp_color_config_get_display_bpc (color_config);
+ s_bpc = gimp_color_config_get_simulation_bpc (color_config);
+ gammut = gimp_color_config_get_simulation_gamut_check (color_config);
}
#define SET_ACTIVE(action,condition) \
diff --git a/app/actions/view-commands.c b/app/actions/view-commands.c
index 7a3cc05..1d18635 100644
--- a/app/actions/view-commands.c
+++ b/app/actions/view-commands.c
@@ -518,7 +518,7 @@ view_color_management_enable_cmd_callback (GtkAction *action,
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
- mode = color_config->mode;
+ mode = gimp_color_config_get_mode (color_config);
if (active)
{
@@ -530,7 +530,7 @@ view_color_management_enable_cmd_callback (GtkAction *action,
mode = GIMP_COLOR_MANAGEMENT_OFF;
}
- if (mode != color_config->mode)
+ if (mode != gimp_color_config_get_mode (color_config))
{
g_object_set (color_config,
"mode", mode,
@@ -553,7 +553,7 @@ view_color_management_softproof_cmd_callback (GtkAction *action,
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
- mode = color_config->mode;
+ mode = gimp_color_config_get_mode (color_config);
if (active)
{
@@ -565,7 +565,7 @@ view_color_management_softproof_cmd_callback (GtkAction *action,
mode = GIMP_COLOR_MANAGEMENT_DISPLAY;
}
- if (mode != color_config->mode)
+ if (mode != gimp_color_config_get_mode (color_config))
{
g_object_set (color_config,
"mode", mode,
@@ -588,7 +588,7 @@ view_display_intent_cmd_callback (GtkAction *action,
value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action));
- if (value != color_config->display_intent)
+ if (value != gimp_color_config_get_display_intent (color_config))
{
g_object_set (color_config,
"display-rendering-intent", value,
@@ -611,7 +611,7 @@ view_softproof_intent_cmd_callback (GtkAction *action,
value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action));
- if (value != color_config->simulation_intent)
+ if (value != gimp_color_config_get_simulation_intent (color_config))
{
g_object_set (color_config,
"simulation-rendering-intent", value,
@@ -633,7 +633,7 @@ view_display_bpc_cmd_callback (GtkAction *action,
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
- if (active != color_config->display_use_black_point_compensation)
+ if (active != gimp_color_config_get_display_bpc (color_config))
{
g_object_set (color_config,
"display-use-black-point-compensation", active,
@@ -655,7 +655,7 @@ view_softproof_bpc_cmd_callback (GtkAction *action,
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
- if (active != color_config->simulation_use_black_point_compensation)
+ if (active != gimp_color_config_get_simulation_bpc (color_config))
{
g_object_set (color_config,
"simulation-use-black-point-compensation", active,
@@ -677,7 +677,7 @@ view_softproof_gamut_check_cmd_callback (GtkAction *action,
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
- if (active != color_config->simulation_gamut_check)
+ if (active != gimp_color_config_get_simulation_gamut_check (color_config))
{
g_object_set (color_config,
"simulation-gamut-check", active,
diff --git a/app/display/gimpdisplayshell-profile.c b/app/display/gimpdisplayshell-profile.c
index 03b4e5d..d096c56 100644
--- a/app/display/gimpdisplayshell-profile.c
+++ b/app/display/gimpdisplayshell-profile.c
@@ -224,7 +224,7 @@ gimp_display_shell_color_config_notify (GimpColorConfig *config,
#define SET_ACTIVE(action, active) \
gimp_display_shell_set_action_active (shell, action, active);
- switch (config->mode)
+ switch (gimp_color_config_get_mode (config))
{
case GIMP_COLOR_MANAGEMENT_OFF:
break;
@@ -242,7 +242,7 @@ gimp_display_shell_color_config_notify (GimpColorConfig *config,
SET_ACTIVE ("view-color-management-enable", managed);
SET_ACTIVE ("view-color-management-softproof", softproof);
- switch (config->display_intent)
+ switch (gimp_color_config_get_display_intent (config))
{
case GIMP_COLOR_RENDERING_INTENT_PERCEPTUAL:
action = "view-display-intent-perceptual";
@@ -270,9 +270,9 @@ gimp_display_shell_color_config_notify (GimpColorConfig *config,
SET_SENSITIVE ("view-display-black-point-compensation", managed);
SET_ACTIVE ("view-display-black-point-compensation",
- config->display_use_black_point_compensation);
+ gimp_color_config_get_display_bpc (config));
- switch (config->simulation_intent)
+ switch (gimp_color_config_get_simulation_intent (config))
{
case GIMP_COLOR_RENDERING_INTENT_PERCEPTUAL:
action = "view-softproof-intent-perceptual";
@@ -300,11 +300,11 @@ gimp_display_shell_color_config_notify (GimpColorConfig *config,
SET_SENSITIVE ("view-softproof-black-point-compensation", softproof);
SET_ACTIVE ("view-softproof-black-point-compensation",
- config->simulation_use_black_point_compensation);
+ gimp_color_config_get_simulation_bpc (config));
SET_SENSITIVE ("view-softproof-gamut-check", softproof);
SET_ACTIVE ("view-softproof-gamut-check",
- config->simulation_gamut_check);
+ gimp_color_config_get_simulation_gamut_check (config));
}
gimp_color_managed_profile_changed (GIMP_COLOR_MANAGED (shell));
diff --git a/libgimpconfig/gimpcolorconfig.c b/libgimpconfig/gimpcolorconfig.c
index 17324ea..45773f1 100644
--- a/libgimpconfig/gimpcolorconfig.c
+++ b/libgimpconfig/gimpcolorconfig.c
@@ -439,6 +439,117 @@ gimp_color_config_get_property (GObject *object,
}
}
+
+/* public functions */
+
+/**
+ * gimp_color_config_get_mode:
+ * @config: a #GimpColorConfig
+ *
+ * Since: 2.10
+ **/
+GimpColorManagementMode
+gimp_color_config_get_mode (GimpColorConfig *config)
+{
+ g_return_val_if_fail (GIMP_IS_COLOR_CONFIG (config),
+ GIMP_COLOR_MANAGEMENT_OFF);
+
+ return config->mode;
+}
+
+/**
+ * gimp_color_config_get_display_intent:
+ * @config: a #GimpColorConfig
+ *
+ * Since: 2.10
+ **/
+GimpColorRenderingIntent
+gimp_color_config_get_display_intent (GimpColorConfig *config)
+{
+ g_return_val_if_fail (GIMP_IS_COLOR_CONFIG (config),
+ GIMP_COLOR_RENDERING_INTENT_PERCEPTUAL);
+
+ return config->display_intent;
+}
+
+/**
+ * gimp_color_config_get_display_bpc:
+ * @config: a #GimpColorConfig
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_color_config_get_display_bpc (GimpColorConfig *config)
+{
+ g_return_val_if_fail (GIMP_IS_COLOR_CONFIG (config), FALSE);
+
+ return config->display_use_black_point_compensation;
+}
+
+/**
+ * gimp_color_config_get_display_profile_from_gdk:
+ * @config: a #GimpColorConfig
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_color_config_get_display_profile_from_gdk (GimpColorConfig *config)
+{
+ g_return_val_if_fail (GIMP_IS_COLOR_CONFIG (config), FALSE);
+
+ return config->display_profile_from_gdk;
+}
+
+/**
+ * gimp_color_config_get_simulation_intent:
+ * @config: a #GimpColorConfig
+ *
+ * Since: 2.10
+ **/
+GimpColorRenderingIntent
+gimp_color_config_get_simulation_intent (GimpColorConfig *config)
+{
+ g_return_val_if_fail (GIMP_IS_COLOR_CONFIG (config),
+ GIMP_COLOR_RENDERING_INTENT_PERCEPTUAL);
+
+ return config->simulation_intent;
+}
+
+/**
+ * gimp_color_config_get_simulation_bpc:
+ * @config: a #GimpColorConfig
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_color_config_get_simulation_bpc (GimpColorConfig *config)
+{
+ g_return_val_if_fail (GIMP_IS_COLOR_CONFIG (config), FALSE);
+
+ return config->simulation_use_black_point_compensation;
+}
+
+/**
+ * gimp_color_config_get_simulation_gamut_check:
+ * @config: a #GimpColorConfig
+ *
+ * Since: 2.10
+ **/
+gboolean
+gimp_color_config_get_simulation_gamut_check (GimpColorConfig *config)
+{
+ g_return_val_if_fail (GIMP_IS_COLOR_CONFIG (config), FALSE);
+
+ return config->simulation_gamut_check;
+}
+
+/**
+ * gimp_color_config_get_rgb_color_profile:
+ * @config: a #GimpColorConfig
+ * @error: return location for a #GError
+ *
+ * Since: 2.10
+ **/
GimpColorProfile *
gimp_color_config_get_rgb_color_profile (GimpColorConfig *config,
GError **error)
@@ -470,6 +581,13 @@ gimp_color_config_get_rgb_color_profile (GimpColorConfig *config,
return profile;
}
+/**
+ * gimp_color_config_get_gray_color_profile:
+ * @config: a #GimpColorConfig
+ * @error: return location for a #GError
+ *
+ * Since: 2.10
+ **/
GimpColorProfile *
gimp_color_config_get_gray_color_profile (GimpColorConfig *config,
GError **error)
@@ -501,6 +619,13 @@ gimp_color_config_get_gray_color_profile (GimpColorConfig *config,
return profile;
}
+/**
+ * gimp_color_config_get_cmyk_color_profile:
+ * @config: a #GimpColorConfig
+ * @error: return location for a #GError
+ *
+ * Since: 2.10
+ **/
GimpColorProfile *
gimp_color_config_get_cmyk_color_profile (GimpColorConfig *config,
GError **error)
@@ -532,6 +657,13 @@ gimp_color_config_get_cmyk_color_profile (GimpColorConfig *config,
return profile;
}
+/**
+ * gimp_color_config_get_display_color_profile:
+ * @config: a #GimpColorConfig
+ * @error: return location for a #GError
+ *
+ * Since: 2.10
+ **/
GimpColorProfile *
gimp_color_config_get_display_color_profile (GimpColorConfig *config,
GError **error)
@@ -552,6 +684,13 @@ gimp_color_config_get_display_color_profile (GimpColorConfig *config,
return profile;
}
+/**
+ * gimp_color_config_get_simulation_color_profile:
+ * @config: a #GimpColorConfig
+ * @error: return location for a #GError
+ *
+ * Since: 2.10
+ **/
GimpColorProfile *
gimp_color_config_get_simulation_color_profile (GimpColorConfig *config,
GError **error)
diff --git a/libgimpconfig/gimpcolorconfig.h b/libgimpconfig/gimpcolorconfig.h
index 0622e86..ce8d96c 100644
--- a/libgimpconfig/gimpcolorconfig.h
+++ b/libgimpconfig/gimpcolorconfig.h
@@ -80,6 +80,19 @@ struct _GimpColorConfigClass
GType gimp_color_config_get_type (void) G_GNUC_CONST;
+GimpColorManagementMode
+ gimp_color_config_get_mode (GimpColorConfig *config);
+
+GimpColorRenderingIntent
+ gimp_color_config_get_display_intent (GimpColorConfig *config);
+gboolean gimp_color_config_get_display_bpc (GimpColorConfig *config);
+gboolean gimp_color_config_get_display_profile_from_gdk (GimpColorConfig *config);
+
+GimpColorRenderingIntent
+ gimp_color_config_get_simulation_intent (GimpColorConfig *config);
+gboolean gimp_color_config_get_simulation_bpc (GimpColorConfig *config);
+gboolean gimp_color_config_get_simulation_gamut_check (GimpColorConfig *config);
+
GimpColorProfile * gimp_color_config_get_rgb_color_profile (GimpColorConfig *config,
GError **error);
GimpColorProfile * gimp_color_config_get_gray_color_profile (GimpColorConfig *config,
diff --git a/libgimpconfig/gimpconfig.def b/libgimpconfig/gimpconfig.def
index b99f3a7..537ae0d 100644
--- a/libgimpconfig/gimpconfig.def
+++ b/libgimpconfig/gimpconfig.def
@@ -1,9 +1,16 @@
EXPORTS
gimp_color_config_get_cmyk_color_profile
+ gimp_color_config_get_display_bpc
gimp_color_config_get_display_color_profile
+ gimp_color_config_get_display_intent
+ gimp_color_config_get_display_profile_from_gdk
gimp_color_config_get_gray_color_profile
+ gimp_color_config_get_mode
gimp_color_config_get_rgb_color_profile
+ gimp_color_config_get_simulation_bpc
gimp_color_config_get_simulation_color_profile
+ gimp_color_config_get_simulation_gamut_check
+ gimp_color_config_get_simulation_intent
gimp_color_config_get_type
gimp_color_management_mode_get_type
gimp_color_rendering_intent_get_type
diff --git a/libgimpwidgets/gimpwidgetsutils.c b/libgimpwidgets/gimpwidgetsutils.c
index d09f8d9..391d49f 100644
--- a/libgimpwidgets/gimpwidgetsutils.c
+++ b/libgimpwidgets/gimpwidgetsutils.c
@@ -584,7 +584,7 @@ get_display_profile (GtkWidget *widget,
{
GimpColorProfile *profile = NULL;
- if (config->display_profile_from_gdk)
+ if (gimp_color_config_get_display_profile_from_gdk (config))
/* get the toplevel's profile so all a window's colors look the same */
profile = gimp_widget_get_color_profile (gtk_widget_get_toplevel (widget));
@@ -705,7 +705,7 @@ gimp_widget_get_color_transform (GtkWidget *widget,
debug_cache = g_getenv ("GIMP_DEBUG_TRANSFORM_CACHE") != NULL;
}
- switch (config->mode)
+ switch (gimp_color_config_get_mode (config))
{
case GIMP_COLOR_MANAGEMENT_OFF:
return NULL;
@@ -771,16 +771,16 @@ gimp_widget_get_color_transform (GtkWidget *widget,
{
GimpColorTransformFlags flags = 0;
- if (config->simulation_use_black_point_compensation)
+ if (gimp_color_config_get_simulation_bpc (config))
flags |= GIMP_COLOR_TRANSFORM_FLAGS_BLACK_POINT_COMPENSATION;
#if 0
/* FIXME add this to GimpColorConfig */
- if (config->simulation_nooptimize)
+ if (gimp_color_config_get_simulation_nooptimize (config))
flags |= GIMP_COLOR_TRANSFORM_FLAGS_NOOPTIMIZE;
#endif
- if (config->simulation_gamut_check)
+ if (gimp_color_config_get_simulation_gamut_check (config))
{
cmsUInt16Number alarmCodes[cmsMAXCHANNELS] = { 0, };
guchar r, g, b;
@@ -802,20 +802,20 @@ gimp_widget_get_color_transform (GtkWidget *widget,
cache->dest_profile,
cache->dest_format,
cache->proof_profile,
- config->simulation_intent,
- config->display_intent,
+ gimp_color_config_get_simulation_intent (config),
+ gimp_color_config_get_display_intent (config),
flags);
}
else
{
GimpColorTransformFlags flags = 0;
- if (config->display_use_black_point_compensation)
+ if (gimp_color_config_get_display_bpc (config))
flags |= GIMP_COLOR_TRANSFORM_FLAGS_BLACK_POINT_COMPENSATION;
#if 0
/* FIXME add this to GimpColorConfig */
- if (config->display_nooptimize)
+ if (gimp_color_config_get_display_nooptimize (config))
flags |= GIMP_COLOR_TRANSFORM_FLAGS_NOOPTIMIZE;
#endif
@@ -824,7 +824,7 @@ gimp_widget_get_color_transform (GtkWidget *widget,
cache->src_format,
cache->dest_profile,
cache->dest_format,
- config->display_intent,
+ gimp_color_config_get_display_intent (config),
flags);
}
diff --git a/modules/display-filter-lcms.c b/modules/display-filter-lcms.c
index b293c58..f7e41ef 100644
--- a/modules/display-filter-lcms.c
+++ b/modules/display-filter-lcms.c
@@ -278,7 +278,7 @@ cdisplay_lcms_get_display_profile (CdisplayLcms *lcms)
if (GTK_IS_WIDGET (managed))
widget = gtk_widget_get_toplevel (GTK_WIDGET (managed));
- if (config->display_profile_from_gdk)
+ if (gimp_color_config_get_display_profile_from_gdk (config))
profile = gimp_widget_get_color_profile (widget);
if (! profile)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]