[gimp/gimp-2-8] Bug 397359 - Can't access color management parameters



commit de8830ed4bd5bbf10eba981dc390079c0c68aa86
Author: Michael Natterer <mitch gimp org>
Date:   Wed Mar 13 10:37:25 2013 +0100

    Bug 397359 - Can't access color management parameters
    
    Create all display filters with "color-config" and "color-managed"
    parameters set, not only the automatically added color management
    display filter. This way we don't only support removing and adding the
    filter again, but also support potential other color management
    modules.
    (cherry picked from commit bc190a6baba1f1205a78c4bd76cdf5eebd7c8bcf)

 app/display/gimpdisplayshell-filter-dialog.c |   11 +++++++-
 app/widgets/gimpcolordisplayeditor.c         |   30 +++++++++++++++++++++++--
 app/widgets/gimpcolordisplayeditor.h         |    6 ++++-
 3 files changed, 41 insertions(+), 6 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-filter-dialog.c b/app/display/gimpdisplayshell-filter-dialog.c
index b181d1b..bdaa9be 100644
--- a/app/display/gimpdisplayshell-filter-dialog.c
+++ b/app/display/gimpdisplayshell-filter-dialog.c
@@ -20,10 +20,13 @@
 #include <gegl.h>
 #include <gtk/gtk.h>
 
+#include "libgimpcolor/gimpcolor.h"
 #include "libgimpwidgets/gimpwidgets.h"
 
 #include "display-types.h"
 
+#include "config/gimpcoreconfig.h"
+
 #include "core/gimp.h"
 #include "core/gimpimage.h"
 
@@ -62,13 +65,15 @@ static void gimp_display_shell_filter_dialog_free     (ColorDisplayDialog *cdd);
 GtkWidget *
 gimp_display_shell_filter_dialog_new (GimpDisplayShell *shell)
 {
+  GimpDisplayConfig  *config;
   GimpImage          *image;
   ColorDisplayDialog *cdd;
   GtkWidget          *editor;
 
   g_return_val_if_fail (GIMP_IS_DISPLAY_SHELL (shell), NULL);
 
-  image = gimp_display_get_image (shell->display);
+  config = shell->display->config;
+  image  = gimp_display_get_image (shell->display);
 
   cdd = g_slice_new0 (ColorDisplayDialog);
 
@@ -117,7 +122,9 @@ gimp_display_shell_filter_dialog_new (GimpDisplayShell *shell)
       g_object_unref (stack);
     }
 
-  editor = gimp_color_display_editor_new (shell->filter_stack);
+  editor = gimp_color_display_editor_new (shell->filter_stack,
+                                          GIMP_CORE_CONFIG (config)->color_management,
+                                          GIMP_COLOR_MANAGED (shell));
   gtk_container_set_border_width (GTK_CONTAINER (editor), 12);
   gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (cdd->dialog))),
                       editor, TRUE, TRUE, 0);
diff --git a/app/widgets/gimpcolordisplayeditor.c b/app/widgets/gimpcolordisplayeditor.c
index 3b8c875..9e842ea 100644
--- a/app/widgets/gimpcolordisplayeditor.c
+++ b/app/widgets/gimpcolordisplayeditor.c
@@ -20,8 +20,11 @@
 
 #include "config.h"
 
+#include <gegl.h>
 #include <gtk/gtk.h>
 
+#include "libgimpcolor/gimpcolor.h"
+#include "libgimpconfig/gimpconfig.h"
 #include "libgimpwidgets/gimpwidgets.h"
 
 #include "widgets-types.h"
@@ -347,11 +350,25 @@ gimp_color_display_editor_dispose (GObject *object)
       editor->stack = NULL;
     }
 
+  if (editor->config)
+    {
+      g_object_unref (editor->config);
+      editor->config = NULL;
+    }
+
+  if (editor->managed)
+    {
+      g_object_unref (editor->managed);
+      editor->managed = NULL;
+    }
+
   G_OBJECT_CLASS (parent_class)->dispose (object);
 }
 
 GtkWidget *
-gimp_color_display_editor_new (GimpColorDisplayStack *stack)
+gimp_color_display_editor_new (GimpColorDisplayStack *stack,
+                               GimpColorConfig       *config,
+                               GimpColorManaged      *managed)
 {
   GimpColorDisplayEditor *editor;
   GType                  *display_types;
@@ -360,10 +377,14 @@ gimp_color_display_editor_new (GimpColorDisplayStack *stack)
   GList                  *list;
 
   g_return_val_if_fail (GIMP_IS_COLOR_DISPLAY_STACK (stack), NULL);
+  g_return_val_if_fail (GIMP_IS_COLOR_CONFIG (config), NULL);
+  g_return_val_if_fail (GIMP_IS_COLOR_MANAGED (managed), NULL);
 
   editor = g_object_new (GIMP_TYPE_COLOR_DISPLAY_EDITOR, NULL);
 
-  editor->stack = g_object_ref (stack);
+  editor->stack   = g_object_ref (stack);
+  editor->config  = g_object_ref (config);
+  editor->managed = g_object_ref (managed);
 
   display_types = g_type_children (GIMP_TYPE_COLOR_DISPLAY, &n_display_types);
 
@@ -441,7 +462,10 @@ gimp_color_display_editor_add_clicked (GtkWidget              *widget,
 
       gtk_tree_model_get (model, &iter, SRC_COLUMN_TYPE, &type, -1);
 
-      display = g_object_new (type, NULL);
+      display = g_object_new (type,
+                              "color-config",  editor->config,
+                              "color-managed", editor->managed,
+                              NULL);
 
       if (display)
         {
diff --git a/app/widgets/gimpcolordisplayeditor.h b/app/widgets/gimpcolordisplayeditor.h
index 046b549..e81d8fe 100644
--- a/app/widgets/gimpcolordisplayeditor.h
+++ b/app/widgets/gimpcolordisplayeditor.h
@@ -37,6 +37,8 @@ struct _GimpColorDisplayEditor
   GtkBox                 parent_instance;
 
   GimpColorDisplayStack *stack;
+  GimpColorConfig       *config;
+  GimpColorManaged      *managed;
 
   GtkListStore          *src;
   GtkListStore          *dest;
@@ -67,7 +69,9 @@ struct _GimpColorDisplayEditorClass
 
 GType       gimp_color_display_editor_get_type (void) G_GNUC_CONST;
 
-GtkWidget * gimp_color_display_editor_new      (GimpColorDisplayStack *stack);
+GtkWidget * gimp_color_display_editor_new      (GimpColorDisplayStack *stack,
+                                                GimpColorConfig       *config,
+                                                GimpColorManaged      *managed);
 
 
 #endif  /*  __GIMP_COLOR_DISPLAY_EDITOR_H__  */


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