app: add new config class GimpDialogConfig

which will keep all settings of the "don't ask me again" kind. For
now, moved the "color-profile-policy" there.
This commit is contained in:
Michael Natterer 2016-08-14 22:21:59 +02:00
parent 1027c71f36
commit 3a14a646f5
9 changed files with 178 additions and 21 deletions

View file

@ -40,6 +40,8 @@ libappconfig_a_sources = \
gimpconfig-utils.h \
gimpcoreconfig.c \
gimpcoreconfig.h \
gimpdialogconfig.c \
gimpdialogconfig.h \
gimpdisplayconfig.c \
gimpdisplayconfig.h \
gimpdisplayoptions.c \

View file

@ -35,6 +35,7 @@ typedef struct _GimpGeglConfig GimpGeglConfig;
typedef struct _GimpCoreConfig GimpCoreConfig;
typedef struct _GimpDisplayConfig GimpDisplayConfig;
typedef struct _GimpGuiConfig GimpGuiConfig;
typedef struct _GimpDialogConfig GimpDialogConfig;
typedef struct _GimpPluginConfig GimpPluginConfig;
typedef struct _GimpRc GimpRc;

View file

@ -104,7 +104,6 @@ enum
PROP_THUMBNAIL_SIZE,
PROP_THUMBNAIL_FILESIZE_LIMIT,
PROP_COLOR_MANAGEMENT,
PROP_COLOR_PROFILE_POLICY,
PROP_SAVE_DOCUMENT_HISTORY,
PROP_QUICK_MASK_COLOR,
@ -605,14 +604,6 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
GIMP_PARAM_STATIC_STRINGS |
GIMP_CONFIG_PARAM_AGGREGATE);
GIMP_CONFIG_PROP_ENUM (object_class, PROP_COLOR_PROFILE_POLICY,
"color-profile-policy",
"Color profile policy",
COLOR_PROFILE_POLICY_BLURB,
GIMP_TYPE_COLOR_PROFILE_POLICY,
GIMP_COLOR_PROFILE_POLICY_ASK,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_SAVE_DOCUMENT_HISTORY,
"save-document-history",
"Save document history",
@ -905,9 +896,6 @@ gimp_core_config_set_property (GObject *object,
gimp_config_sync (g_value_get_object (value),
G_OBJECT (core_config->color_management), 0);
break;
case PROP_COLOR_PROFILE_POLICY:
core_config->color_profile_policy = g_value_get_enum (value);
break;
case PROP_SAVE_DOCUMENT_HISTORY:
core_config->save_document_history = g_value_get_boolean (value);
break;
@ -1083,9 +1071,6 @@ gimp_core_config_get_property (GObject *object,
case PROP_COLOR_MANAGEMENT:
g_value_set_object (value, core_config->color_management);
break;
case PROP_COLOR_PROFILE_POLICY:
g_value_set_enum (value, core_config->color_profile_policy);
break;
case PROP_SAVE_DOCUMENT_HISTORY:
g_value_set_boolean (value, core_config->save_document_history);
break;

View file

@ -88,7 +88,6 @@ struct _GimpCoreConfig
GimpThumbnailSize thumbnail_size;
guint64 thumbnail_filesize_limit;
GimpColorConfig *color_management;
GimpColorProfilePolicy color_profile_policy;
gboolean save_document_history;
GimpRGB quick_mask_color;
};

View file

@ -0,0 +1,118 @@
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* GimpDialogConfig class
* Copyright (C) 2016 Michael Natterer <mitch@gimp.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <gio/gio.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpconfig/gimpconfig.h"
#include "config-types.h"
#include "gimprc-blurbs.h"
#include "gimpdialogconfig.h"
#include "gimp-intl.h"
enum
{
PROP_0,
PROP_COLOR_PROFILE_POLICY
};
static void gimp_dialog_config_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_dialog_config_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
G_DEFINE_TYPE (GimpDialogConfig, gimp_dialog_config, GIMP_TYPE_GUI_CONFIG)
#define parent_class gimp_dialog_config_parent_class
static void
gimp_dialog_config_class_init (GimpDialogConfigClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->set_property = gimp_dialog_config_set_property;
object_class->get_property = gimp_dialog_config_get_property;
GIMP_CONFIG_PROP_ENUM (object_class, PROP_COLOR_PROFILE_POLICY,
"color-profile-policy",
"Color profile policy",
COLOR_PROFILE_POLICY_BLURB,
GIMP_TYPE_COLOR_PROFILE_POLICY,
GIMP_COLOR_PROFILE_POLICY_ASK,
GIMP_PARAM_STATIC_STRINGS);
}
static void
gimp_dialog_config_init (GimpDialogConfig *config)
{
}
static void
gimp_dialog_config_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
GimpDialogConfig *dialog_config = GIMP_DIALOG_CONFIG (object);
switch (property_id)
{
case PROP_COLOR_PROFILE_POLICY:
dialog_config->color_profile_policy = g_value_get_enum (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
gimp_dialog_config_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
GimpDialogConfig *dialog_config = GIMP_DIALOG_CONFIG (object);
switch (property_id)
{
case PROP_COLOR_PROFILE_POLICY:
g_value_set_enum (value, dialog_config->color_profile_policy);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}

View file

@ -0,0 +1,52 @@
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* GimpDialogConfig class
* Copyright (C) 2016 Michael Natterer <mitch@gimp.org>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __GIMP_DIALOG_CONFIG_H__
#define __GIMP_DIALOG_CONFIG_H__
#include "config/gimpguiconfig.h"
#define GIMP_TYPE_DIALOG_CONFIG (gimp_dialog_config_get_type ())
#define GIMP_DIALOG_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_DIALOG_CONFIG, GimpDialogConfig))
#define GIMP_DIALOG_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_DIALOG_CONFIG, GimpDialogConfigClass))
#define GIMP_IS_DIALOG_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_DIALOG_CONFIG))
#define GIMP_IS_DIALOG_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_DIALOG_CONFIG))
typedef struct _GimpDialogConfigClass GimpDialogConfigClass;
struct _GimpDialogConfig
{
GimpGuiConfig parent_instance;
GimpColorProfilePolicy color_profile_policy;
};
struct _GimpDialogConfigClass
{
GimpGuiConfigClass parent_class;
};
GType gimp_dialog_config_get_type (void) G_GNUC_CONST;
#endif /* GIMP_DIALOG_CONFIG_H__ */

View file

@ -53,7 +53,7 @@ static void gimp_plugin_config_get_property (GObject *object,
GParamSpec *pspec);
G_DEFINE_TYPE (GimpPluginConfig, gimp_plugin_config, GIMP_TYPE_GUI_CONFIG)
G_DEFINE_TYPE (GimpPluginConfig, gimp_plugin_config, GIMP_TYPE_DIALOG_CONFIG)
#define parent_class gimp_plugin_config_parent_class

View file

@ -21,7 +21,7 @@
#ifndef __GIMP_PLUGIN_CONFIG_H__
#define __GIMP_PLUGIN_CONFIG_H__
#include "config/gimpguiconfig.h"
#include "config/gimpdialogconfig.h"
#define GIMP_TYPE_PLUGIN_CONFIG (gimp_plugin_config_get_type ())
@ -35,7 +35,7 @@ typedef struct _GimpPluginConfigClass GimpPluginConfigClass;
struct _GimpPluginConfig
{
GimpGuiConfig parent_instance;
GimpDialogConfig parent_instance;
gchar *fractalexplorer_path;
gchar *gfig_path;

View file

@ -32,7 +32,7 @@
#include "core-types.h"
#include "config/gimpcoreconfig.h"
#include "config/gimpdialogconfig.h"
#include "gegl/gimp-babl.h"
#include "gegl/gimp-gegl-loops.h"
@ -450,7 +450,7 @@ gimp_image_import_color_profile (GimpImage *image,
GimpColorRenderingIntent intent;
gboolean bpc;
policy = image->gimp->config->color_profile_policy;
policy = GIMP_DIALOG_CONFIG (image->gimp->config)->color_profile_policy;
intent = GIMP_COLOR_RENDERING_INTENT_RELATIVE_COLORIMETRIC;
bpc = TRUE;