Commit 9775b208 authored by Michael Natterer's avatar Michael Natterer 😴
Browse files

app: simplify display update when the color management config changes

gimp_image_constructed(): connect to "notify" on GimpColorConfig
and call gimp_color_managed_profile_changed() on the image.

Remove the "notify" handler on GimpColorConfig from
gimpdisplayshell-handlers.c because it already connects to the
image's "profile-changed" signal.

Additionally, implement GimpColorManaged::profile_changed() in
GimpImage and invalidate the image and all layer previews. One step
closer to color managing image and layer previews.
parent fa584ef1
......@@ -182,6 +182,8 @@ static const guint8 *
gsize *len);
static GimpColorProfile *
gimp_image_color_managed_get_color_profile (GimpColorManaged *managed);
static void
gimp_image_color_managed_profile_changed (GimpColorManaged *managed);
static void gimp_image_projectable_flush (GimpProjectable *projectable,
gboolean invalidate_preview);
......@@ -635,6 +637,7 @@ gimp_color_managed_iface_init (GimpColorManagedInterface *iface)
{
iface->get_icc_profile = gimp_image_color_managed_get_icc_profile;
iface->get_color_profile = gimp_image_color_managed_get_color_profile;
iface->profile_changed = gimp_image_color_managed_profile_changed;
}
static void
......@@ -825,6 +828,10 @@ gimp_image_constructed (GObject *object)
G_CALLBACK (gimp_viewable_size_changed),
image, G_CONNECT_SWAPPED);
g_signal_connect_object (config->color_management, "notify",
G_CALLBACK (gimp_color_managed_profile_changed),
image, G_CONNECT_SWAPPED);
gimp_container_add (image->gimp->images, GIMP_OBJECT (image));
}
......@@ -1395,6 +1402,16 @@ gimp_image_color_managed_get_color_profile (GimpColorManaged *managed)
return g_object_ref (profile);
}
static void
gimp_image_color_managed_profile_changed (GimpColorManaged *managed)
{
GimpImage *image = GIMP_IMAGE (managed);
GimpItemStack *layers = GIMP_ITEM_STACK (gimp_image_get_layers (image));
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (image));
gimp_item_stack_invalidate_previews (layers);
}
static void
gimp_image_projectable_flush (GimpProjectable *projectable,
gboolean invalidate_preview)
......
......@@ -165,9 +165,6 @@ static void gimp_display_shell_ants_speed_notify_handler (GObject *c
static void gimp_display_shell_quality_notify_handler (GObject *config,
GParamSpec *param_spec,
GimpDisplayShell *shell);
static void gimp_display_shell_color_config_notify_handler(GObject *config,
GParamSpec *param_spec,
GimpDisplayShell *shell);
/* public functions */
......@@ -360,11 +357,6 @@ gimp_display_shell_connect (GimpDisplayShell *shell)
G_CALLBACK (gimp_display_shell_quality_notify_handler),
shell);
g_signal_connect (GIMP_CORE_CONFIG (shell->display->config)->color_management,
"notify",
G_CALLBACK (gimp_display_shell_color_config_notify_handler),
shell);
gimp_display_shell_invalidate_preview_handler (image, shell);
gimp_display_shell_quick_mask_changed_handler (image, shell);
gimp_display_shell_profile_changed_handler (GIMP_COLOR_MANAGED (image),
......@@ -395,10 +387,6 @@ gimp_display_shell_disconnect (GimpDisplayShell *shell)
gimp_canvas_layer_boundary_set_layer (GIMP_CANVAS_LAYER_BOUNDARY (shell->layer_boundary),
NULL);
g_signal_handlers_disconnect_by_func (GIMP_CORE_CONFIG (shell->display->config)->color_management,
gimp_display_shell_color_config_notify_handler,
shell);
g_signal_handlers_disconnect_by_func (shell->display->config,
gimp_display_shell_quality_notify_handler,
shell);
......@@ -1073,12 +1061,3 @@ gimp_display_shell_quality_notify_handler (GObject *config,
{
gimp_display_shell_expose_full (shell);
}
static void
gimp_display_shell_color_config_notify_handler (GObject *config,
GParamSpec *param_spec,
GimpDisplayShell *shell)
{
gimp_display_shell_profile_update (shell);
gimp_display_shell_expose_full (shell);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment