[gimp] app: add new config class GimpDialogConfig



commit 3a14a646f5400a7cb2f128d388a47648bff8e802
Author: Michael Natterer <mitch gimp org>
Date:   Sun Aug 14 22:21:59 2016 +0200

    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.

 app/config/Makefile.am             |    2 +
 app/config/config-types.h          |    1 +
 app/config/gimpcoreconfig.c        |   15 -----
 app/config/gimpcoreconfig.h        |    1 -
 app/config/gimpdialogconfig.c      |  118 ++++++++++++++++++++++++++++++++++++
 app/config/gimpdialogconfig.h      |   52 ++++++++++++++++
 app/config/gimppluginconfig.c      |    2 +-
 app/config/gimppluginconfig.h      |    4 +-
 app/core/gimpimage-color-profile.c |    4 +-
 9 files changed, 178 insertions(+), 21 deletions(-)
---
diff --git a/app/config/Makefile.am b/app/config/Makefile.am
index 9e177c1..800d92f 100644
--- a/app/config/Makefile.am
+++ b/app/config/Makefile.am
@@ -40,6 +40,8 @@ libappconfig_a_sources = \
        gimpconfig-utils.h              \
        gimpcoreconfig.c                \
        gimpcoreconfig.h                \
+       gimpdialogconfig.c              \
+       gimpdialogconfig.h              \
        gimpdisplayconfig.c             \
        gimpdisplayconfig.h             \
        gimpdisplayoptions.c            \
diff --git a/app/config/config-types.h b/app/config/config-types.h
index 55a1dc6..b672cd5 100644
--- a/app/config/config-types.h
+++ b/app/config/config-types.h
@@ -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;
 
diff --git a/app/config/gimpcoreconfig.c b/app/config/gimpcoreconfig.c
index 8277e2a..5178978 100644
--- a/app/config/gimpcoreconfig.c
+++ b/app/config/gimpcoreconfig.c
@@ -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;
diff --git a/app/config/gimpcoreconfig.h b/app/config/gimpcoreconfig.h
index c0ae721..7f9a664 100644
--- a/app/config/gimpcoreconfig.h
+++ b/app/config/gimpcoreconfig.h
@@ -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;
 };
diff --git a/app/config/gimpdialogconfig.c b/app/config/gimpdialogconfig.c
new file mode 100644
index 0000000..7c6f93f
--- /dev/null
+++ b/app/config/gimpdialogconfig.c
@@ -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;
+    }
+}
diff --git a/app/config/gimpdialogconfig.h b/app/config/gimpdialogconfig.h
new file mode 100644
index 0000000..6fa9305
--- /dev/null
+++ b/app/config/gimpdialogconfig.h
@@ -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__ */
diff --git a/app/config/gimppluginconfig.c b/app/config/gimppluginconfig.c
index 3e5e141..4e69a59 100644
--- a/app/config/gimppluginconfig.c
+++ b/app/config/gimppluginconfig.c
@@ -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
 
diff --git a/app/config/gimppluginconfig.h b/app/config/gimppluginconfig.h
index bf34fd9..7a4e34f 100644
--- a/app/config/gimppluginconfig.h
+++ b/app/config/gimppluginconfig.h
@@ -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;
diff --git a/app/core/gimpimage-color-profile.c b/app/core/gimpimage-color-profile.c
index 54a270e..854a01f 100644
--- a/app/core/gimpimage-color-profile.c
+++ b/app/core/gimpimage-color-profile.c
@@ -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;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]