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.
This commit is contained in:
Michael Natterer 2013-03-13 10:37:25 +01:00
parent 4f7cb88132
commit bc190a6bab
3 changed files with 41 additions and 6 deletions

View File

@ -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);

View File

@ -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)
{

View File

@ -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__ */