[gthumb] added toolbar button to control color profile activation
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] added toolbar button to control color profile activation
- Date: Fri, 6 Feb 2015 09:58:32 +0000 (UTC)
commit 804680a9f0ec62eb3ec3d44dec82c3c96b6be697
Author: Paolo Bacchilega <paobac src gnome org>
Date: Tue Feb 3 15:24:21 2015 +0100
added toolbar button to control color profile activation
data/icons/hicolor/16x16/actions/Makefile.am | 3 +-
data/icons/hicolor/16x16/actions/color-profile.svg | 146 ++++++++++++++++++++
extensions/image_viewer/actions.c | 12 ++
extensions/image_viewer/actions.h | 1 +
extensions/image_viewer/gth-image-viewer-page.c | 104 ++++++++++----
extensions/image_viewer/gth-image-viewer-page.h | 2 +
gthumb/glib-utils.c | 14 ++
gthumb/glib-utils.h | 2 +
gthumb/gth-browser-actions-callbacks.c | 14 --
gthumb/gth-browser-actions-callbacks.h | 1 -
gthumb/gth-browser.c | 1 +
gthumb/gth-image-preloader.c | 8 +
gthumb/gth-image-preloader.h | 1 +
gthumb/gth-image-viewer.c | 3 +-
gthumb/gth-image.c | 1 +
15 files changed, 267 insertions(+), 46 deletions(-)
---
diff --git a/data/icons/hicolor/16x16/actions/Makefile.am b/data/icons/hicolor/16x16/actions/Makefile.am
index ca060eb..699e8c2 100644
--- a/data/icons/hicolor/16x16/actions/Makefile.am
+++ b/data/icons/hicolor/16x16/actions/Makefile.am
@@ -6,6 +6,7 @@ iconsdir = $(themedir)/$(size)/$(context)
icons_DATA = \
change-date-symbolic.svg \
+ color-profile.svg \
comment-symbolic.svg \
convert-format-symbolic.svg \
curves-symbolic.svg \
@@ -22,7 +23,7 @@ icons_DATA = \
filter-symbolic.svg \
format-linear-symbolic.svg \
format-logarithmic-symbolic.svg \
- histogram-symbolic.svg \
+ histogram-symbolic.svg \
image-adjust-colors-symbolic.svg \
image-adjust-contrast-symbolic.svg \
image-crop-symbolic.svg \
diff --git a/data/icons/hicolor/16x16/actions/color-profile.svg
b/data/icons/hicolor/16x16/actions/color-profile.svg
new file mode 100644
index 0000000..a1223f8
--- /dev/null
+++ b/data/icons/hicolor/16x16/actions/color-profile.svg
@@ -0,0 +1,146 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ height="16"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ sodipodi:docname="icc-profile.svg">
+ <defs
+ id="defs4">
+ <linearGradient
+ id="linearGradient3946">
+ <stop
+ id="stop3948"
+ offset="0"
+ style="stop-color:#000000;stop-opacity:0.74698794;" />
+ <stop
+ id="stop3950"
+ offset="1"
+ style="stop-color:#000000;stop-opacity:0.02409638;" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient3830-9">
+ <stop
+ style="stop-color:#000000;stop-opacity:0.74698794;"
+ offset="0"
+ id="stop3832-7" />
+ <stop
+ style="stop-color:#000000;stop-opacity:0.02409638;"
+ offset="1"
+ id="stop3834-5" />
+ </linearGradient>
+ <linearGradient
+ id="linearGradient3984">
+ <stop
+ style="stop-color:#f4deba;stop-opacity:1;"
+ offset="0"
+ id="stop3986" />
+ <stop
+ style="stop-color:#de9625;stop-opacity:0;"
+ offset="1"
+ id="stop3988" />
+ </linearGradient>
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#555753"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ inkscape:pageopacity="1"
+ inkscape:pageshadow="2"
+ inkscape:zoom="15.471429"
+ inkscape:cx="7.7208382"
+ inkscape:cy="13.528323"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ inkscape:snap-grids="true"
+ inkscape:window-width="1680"
+ inkscape:window-height="984"
+ inkscape:window-x="0"
+ inkscape:window-y="27"
+ inkscape:window-maximized="1"
+ showborder="true"
+ fit-margin-top="0"
+ fit-margin-right="0"
+ fit-margin-left="0"
+ fit-margin-bottom="0"
+ showguides="true"
+ inkscape:guide-bbox="true">
+ <inkscape:grid
+ type="xygrid"
+ id="grid7044"
+ empspacing="8"
+ visible="true"
+ enabled="true"
+ snapvisiblegridlinesonly="true"
+ originx="-31.97559px"
+ originy="-816.00002px" />
+ </sodipodi:namedview>
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Livello 1"
+ inkscape:groupmode="layer"
+ id="layer1"
+ transform="translate(-31.97559,-220.36218)">
+ <path
+
style="opacity:0.8;fill:#bebebe;fill-opacity:1;stroke:none;stroke-width:26.45669365;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 8 0 L 8 5 A 3 3 0 0 1 8.0234375 5 A 3 3 0 0 1 11.023438 8 L 16 8 A 8 8 0 0 0 8 0 z "
+ transform="translate(31.97559,220.36218)"
+ id="path4865" />
+ <path
+
style="opacity:0.4;fill:#bebebe;fill-opacity:1;stroke:none;stroke-width:26.45669365;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 8 0 A 8 8 0 0 0 0 8 L 5.0234375 8 A 3 3 0 0 1 8 5 L 8 0 z "
+ transform="translate(31.97559,220.36218)"
+ id="path4876" />
+ <path
+
style="opacity:0.2;fill:#bebebe;fill-opacity:1;stroke:none;stroke-width:26.45669365;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 0 8 A 8 8 0 0 0 8 16 L 8 10.998047 A 3 3 0 0 1 5.0234375 8 L 0 8 z "
+ transform="translate(31.97559,220.36218)"
+ id="path4878" />
+ <path
+
style="opacity:0.6;fill:#bebebe;fill-opacity:1;stroke:none;stroke-width:26.45669365;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ d="M 11.023438 8 A 3 3 0 0 1 8.0234375 11 A 3 3 0 0 1 8 10.998047 L 8 16 A 8 8 0 0 0 16 8 L 11.023438
8 z "
+ transform="translate(31.97559,220.36218)"
+ id="path4880" />
+ <circle
+
style="opacity:1;fill:none;fill-opacity:1;stroke:#bebebe;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="path4894"
+ cx="40"
+ cy="228.3622"
+ r="7.5152354" />
+ <circle
+
style="opacity:1;fill:none;fill-opacity:1;stroke:none;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="path4896"
+ cx="40"
+ cy="228.3622"
+ r="4" />
+ <circle
+
style="opacity:1;fill:none;fill-opacity:1;stroke:#bebebe;stroke-width:1;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
+ id="path4914"
+ cx="40"
+ cy="228.3622"
+ r="3" />
+ </g>
+</svg>
diff --git a/extensions/image_viewer/actions.c b/extensions/image_viewer/actions.c
index 3a98c6e..ff8f6f8 100644
--- a/extensions/image_viewer/actions.c
+++ b/extensions/image_viewer/actions.c
@@ -124,3 +124,15 @@ gth_browser_activate_paste_image (GSimpleAction *action,
GthBrowser *browser = user_data;
gth_image_viewer_page_paste_image (GTH_IMAGE_VIEWER_PAGE (gth_browser_get_viewer_page (browser)));
}
+
+
+void
+gth_browser_activate_apply_icc_profile (GSimpleAction *action,
+ GVariant *state,
+ gpointer user_data)
+{
+ GthBrowser *browser = user_data;
+
+ g_simple_action_set_state (action, state);
+ gth_image_viewer_page_apply_icc_profile (GTH_IMAGE_VIEWER_PAGE (gth_browser_get_viewer_page
(browser)), g_variant_get_boolean (state));
+}
diff --git a/extensions/image_viewer/actions.h b/extensions/image_viewer/actions.h
index 5ff4498..89d0803 100644
--- a/extensions/image_viewer/actions.h
+++ b/extensions/image_viewer/actions.h
@@ -33,5 +33,6 @@ DEF_ACTION_CALLBACK (gth_browser_activate_image_undo)
DEF_ACTION_CALLBACK (gth_browser_activate_image_redo)
DEF_ACTION_CALLBACK (gth_browser_activate_copy_image)
DEF_ACTION_CALLBACK (gth_browser_activate_paste_image)
+DEF_ACTION_CALLBACK (gth_browser_activate_apply_icc_profile)
#endif /* ACTIONS_H */
diff --git a/extensions/image_viewer/gth-image-viewer-page.c b/extensions/image_viewer/gth-image-viewer-page.c
index 1106711..7ad6a5c 100644
--- a/extensions/image_viewer/gth-image-viewer-page.c
+++ b/extensions/image_viewer/gth-image-viewer-page.c
@@ -30,7 +30,7 @@
#define UPDATE_QUALITY_DELAY 200
#define UPDATE_VISIBILITY_DELAY 100
-#define N_HEADER_BAR_BUTTONS 3
+#define N_HEADER_BAR_BUTTONS 4
#define HIDE_OVERVIEW_TIMEOUT 2 /* in seconds */
#define OVERLAY_MARGIN 10
#undef ALWAYS_LOAD_ORIGINAL_SIZE
@@ -56,6 +56,7 @@ static const GActionEntry actions[] = {
{ "image-redo", gth_browser_activate_image_redo },
{ "copy-image", gth_browser_activate_copy_image },
{ "paste-image", gth_browser_activate_paste_image },
+ { "apply-icc-profile", toggle_action_activated, NULL, "true", gth_browser_activate_apply_icc_profile
},
};
@@ -96,6 +97,7 @@ struct _GthImageViewerPagePrivate {
gboolean pointer_on_viewer;
gboolean pointer_on_overview;
guint hide_overview_id;
+ gboolean apply_icc_profile;
};
@@ -295,7 +297,10 @@ _g_mime_type_can_load_different_quality (const char *mime_type)
static void
_gth_image_preloader_init_preloader (GthImageViewerPage *self)
{
- gth_image_preloader_set_out_profile (self->priv->preloader, gth_browser_get_screen_profile
(self->priv->browser));
+ if (self->priv->apply_icc_profile)
+ gth_image_preloader_set_out_profile (self->priv->preloader, gth_browser_get_screen_profile
(self->priv->browser));
+ else
+ gth_image_preloader_set_out_profile (self->priv->preloader, NULL);
}
@@ -853,6 +858,14 @@ gth_image_viewer_page_real_activate (GthViewerPage *base,
_("Fit to width"),
"win.image-zoom-fit-width",
NULL);
+ self->priv->buttons[3] =
+ gth_browser_add_header_bar_toggle_button (browser,
+ GTH_BROWSER_HEADER_SECTION_VIEWER_TOOLS,
+ "color-profile",
+ _("Apply the embedded color profile"),
+ "win.apply-icc-profile",
+ NULL);
+
gth_window_add_accelerators (GTH_WINDOW (browser), accelerators, G_N_ELEMENTS (accelerators));
self->priv->preloader = gth_browser_get_image_preloader (browser);
@@ -1085,34 +1098,19 @@ clear_data:
static void
-gth_image_viewer_page_real_view (GthViewerPage *base,
- GthFileData *file_data)
-{
- GthImageViewerPage *self;
- GthFileStore *file_store;
- GtkTreeIter iter;
- int i;
- GthFileData *next_file_data[N_FORWARD_PRELOADERS];
- GthFileData *prev_file_data[N_BACKWARD_PRELOADERS];
-
- self = (GthImageViewerPage*) base;
- g_return_if_fail (file_data != NULL);
-
- gth_viewer_page_focus (GTH_VIEWER_PAGE (self));
-
- _g_clear_object (&self->priv->last_loaded);
-
- if ((self->priv->file_data != NULL)
- && g_file_equal (file_data->file, self->priv->file_data->file)
- && (gth_file_data_get_mtime (file_data) == gth_file_data_get_mtime (self->priv->file_data))
- && ! self->priv->image_changed)
- {
- gth_image_viewer_page_file_loaded (self, TRUE);
- return;
+_gth_image_viewer_page_load (GthImageViewerPage *self,
+ GthFileData *file_data)
+{
+ GthFileStore *file_store;
+ GtkTreeIter iter;
+ int i;
+ GthFileData *next_file_data[N_FORWARD_PRELOADERS];
+ GthFileData *prev_file_data[N_BACKWARD_PRELOADERS];
+
+ if (self->priv->file_data != file_data) {
+ _g_object_unref (self->priv->file_data);
+ self->priv->file_data = gth_file_data_dup (file_data);
}
-
- _g_object_unref (self->priv->file_data);
- self->priv->file_data = gth_file_data_dup (file_data);
self->priv->image_changed = FALSE;
self->priv->loading_image = TRUE;
@@ -1158,6 +1156,33 @@ gth_image_viewer_page_real_view (GthViewerPage *base,
next_file_data[1],
prev_file_data[0],
prev_file_data[1]);
+
+}
+
+
+static void
+gth_image_viewer_page_real_view (GthViewerPage *base,
+ GthFileData *file_data)
+{
+ GthImageViewerPage *self;
+
+ self = (GthImageViewerPage*) base;
+ g_return_if_fail (file_data != NULL);
+
+ gth_viewer_page_focus (GTH_VIEWER_PAGE (self));
+
+ _g_clear_object (&self->priv->last_loaded);
+
+ if ((self->priv->file_data != NULL)
+ && g_file_equal (file_data->file, self->priv->file_data->file)
+ && (gth_file_data_get_mtime (file_data) == gth_file_data_get_mtime (self->priv->file_data))
+ && ! self->priv->image_changed)
+ {
+ gth_image_viewer_page_file_loaded (self, TRUE);
+ return;
+ }
+
+ _gth_image_viewer_page_load (self, file_data);
}
@@ -1210,6 +1235,7 @@ gth_image_viewer_page_real_update_sensitivity (GthViewerPage *base)
gboolean zoom_enabled;
double zoom;
GthFit fit_mode;
+ GthImage *image;
self = (GthImageViewerPage*) base;
@@ -1227,6 +1253,10 @@ gth_image_viewer_page_real_update_sensitivity (GthViewerPage *base)
gth_window_enable_action (GTH_WINDOW (self->priv->browser), "image-zoom-fit", zoom_enabled &&
(fit_mode != GTH_FIT_SIZE));
gth_window_enable_action (GTH_WINDOW (self->priv->browser), "image-zoom-fit-width", zoom_enabled &&
(fit_mode != GTH_FIT_WIDTH));
+ image = gth_image_viewer_get_image (GTH_IMAGE_VIEWER (self->priv->viewer));
+ gtk_widget_set_visible (self->priv->buttons[3], (image != NULL) && (gth_image_get_icc_profile (image)
!= NULL));
+ gth_window_enable_action (GTH_WINDOW (self->priv->browser), "apply-icc-profile", (image != NULL) &&
(gth_image_get_icc_profile (image) != NULL));
+
_gth_image_viewer_page_update_paste_command_sensitivity (self, NULL);
}
@@ -1644,6 +1674,7 @@ gth_image_viewer_page_init (GthImageViewerPage *self)
self->priv->pointer_on_overview = FALSE;
self->priv->pointer_on_viewer = FALSE;
self->priv->hide_overview_id = 0;
+ self->priv->apply_icc_profile = TRUE;
}
@@ -2052,3 +2083,18 @@ gth_original_image_task_get_image (GthTask *task)
{
return gth_image_task_get_destination_surface (GTH_IMAGE_TASK (task));
}
+
+
+void
+gth_image_viewer_page_apply_icc_profile (GthImageViewerPage *self,
+ gboolean apply)
+{
+ GthFileData *file_data;
+
+ self->priv->apply_icc_profile = apply;
+ gth_image_preloader_clear_cache (self->priv->preloader);
+
+ file_data = gth_browser_get_current_file (self->priv->browser);
+ if (file_data != NULL)
+ _gth_image_viewer_page_load (self, file_data);
+}
diff --git a/extensions/image_viewer/gth-image-viewer-page.h b/extensions/image_viewer/gth-image-viewer-page.h
index c32bf3f..8711f15 100644
--- a/extensions/image_viewer/gth-image-viewer-page.h
+++ b/extensions/image_viewer/gth-image-viewer-page.h
@@ -75,6 +75,8 @@ gboolean gth_image_viewer_page_get_original_finish (GthImageViewerPage
GError **error);
GthTask * gth_original_image_task_new (GthImageViewerPage *self);
cairo_surface_t * gth_original_image_task_get_image (GthTask *task);
+void gth_image_viewer_page_apply_icc_profile (GthImageViewerPage *self,
+ gboolean apply);
G_END_DECLS
diff --git a/gthumb/glib-utils.c b/gthumb/glib-utils.c
index 8fb6573..82a5d43 100644
--- a/gthumb/glib-utils.c
+++ b/gthumb/glib-utils.c
@@ -3257,3 +3257,17 @@ _g_error_free (GError *error)
if (error != NULL)
g_error_free (error);
}
+
+
+void
+toggle_action_activated (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer data)
+{
+ GVariant *state;
+
+ state = g_action_get_state (G_ACTION (action));
+ g_action_change_state (G_ACTION (action), g_variant_new_boolean (! g_variant_get_boolean (state)));
+
+ g_variant_unref (state);
+}
diff --git a/gthumb/glib-utils.h b/gthumb/glib-utils.h
index 0f0552e..de249bf 100644
--- a/gthumb/glib-utils.h
+++ b/gthumb/glib-utils.h
@@ -356,6 +356,8 @@ GList * _g_list_prepend_link (GList *list,
GList *link);
void _g_error_free (GError *error);
+DEF_ACTION_CALLBACK (toggle_action_activated)
+
G_END_DECLS
#endif /* _GLIB_UTILS_H */
diff --git a/gthumb/gth-browser-actions-callbacks.c b/gthumb/gth-browser-actions-callbacks.c
index 0aff0c3..e0a2ffc 100644
--- a/gthumb/gth-browser-actions-callbacks.c
+++ b/gthumb/gth-browser-actions-callbacks.c
@@ -39,20 +39,6 @@
#include "main.h"
-void
-toggle_action_activated (GSimpleAction *action,
- GVariant *parameter,
- gpointer data)
-{
- GVariant *state;
-
- state = g_action_get_state (G_ACTION (action));
- g_action_change_state (G_ACTION (action), g_variant_new_boolean (! g_variant_get_boolean (state)));
-
- g_variant_unref (state);
-}
-
-
static GtkWidget *
_gth_application_get_current_window (GApplication *application)
{
diff --git a/gthumb/gth-browser-actions-callbacks.h b/gthumb/gth-browser-actions-callbacks.h
index a3b5391..4967156 100644
--- a/gthumb/gth-browser-actions-callbacks.h
+++ b/gthumb/gth-browser-actions-callbacks.h
@@ -25,7 +25,6 @@
#include <gtk/gtk.h>
#include "glib-utils.h"
-DEF_ACTION_CALLBACK (toggle_action_activated)
DEF_ACTION_CALLBACK (gth_application_activate_new_window)
DEF_ACTION_CALLBACK (gth_application_activate_preferences)
DEF_ACTION_CALLBACK (gth_application_activate_show_shortcuts)
diff --git a/gthumb/gth-browser.c b/gthumb/gth-browser.c
index 5762667..48dc1d0 100644
--- a/gthumb/gth-browser.c
+++ b/gthumb/gth-browser.c
@@ -4278,6 +4278,7 @@ gth_browser_init (GthBrowser *browser)
gtk_widget_set_margin_left
(browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_VIEWER_VIEW], GTH_BROWSER_HEADER_BAR_BIG_MARGIN);
gtk_widget_set_margin_left
(browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_VIEWER_COMMANDS],
GTH_BROWSER_HEADER_BAR_BIG_MARGIN);
gtk_widget_set_margin_right
(browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_EDITOR_COMMANDS],
GTH_BROWSER_HEADER_BAR_BIG_MARGIN);
+ gtk_widget_set_margin_right
(browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_VIEWER_TOOLS], GTH_BROWSER_HEADER_BAR_BIG_MARGIN);
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar),
browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_BROWSER_NAVIGATION]);
gtk_header_bar_pack_start (GTK_HEADER_BAR (header_bar),
browser->priv->header_sections[GTH_BROWSER_HEADER_SECTION_BROWSER_LOCATIONS]);
diff --git a/gthumb/gth-image-preloader.c b/gthumb/gth-image-preloader.c
index 7c493d1..537d10f 100644
--- a/gthumb/gth-image-preloader.c
+++ b/gthumb/gth-image-preloader.c
@@ -912,3 +912,11 @@ gth_image_preloader_get_modified_image (GthImagePreloader *self)
return NULL;
}
+
+
+void
+gth_image_preloader_clear_cache (GthImagePreloader *self)
+{
+ g_queue_free_full (self->priv->cache, (GDestroyNotify) cache_data_unref);
+ self->priv->cache = g_queue_new ();
+}
diff --git a/gthumb/gth-image-preloader.h b/gthumb/gth-image-preloader.h
index 98d29f9..94e9e1f 100644
--- a/gthumb/gth-image-preloader.h
+++ b/gthumb/gth-image-preloader.h
@@ -72,5 +72,6 @@ gboolean gth_image_preloader_load_finish (GthImagePreloader
*
void gth_image_preloader_set_modified_image (GthImagePreloader *self,
cairo_surface_t *image);
cairo_surface_t * gth_image_preloader_get_modified_image (GthImagePreloader *self);
+void gth_image_preloader_clear_cache (GthImagePreloader *self);
#endif /* GTH_IMAGE_PRELOADER_H */
diff --git a/gthumb/gth-image-viewer.c b/gthumb/gth-image-viewer.c
index 0068fff..c22350e 100644
--- a/gthumb/gth-image-viewer.c
+++ b/gthumb/gth-image-viewer.c
@@ -1779,6 +1779,8 @@ gth_image_viewer_set_image (GthImageViewer *self,
if (self->priv->image != image)
_g_clear_object (&self->priv->image);
+ self->priv->image = g_object_ref (image);
+
if (gth_image_get_is_animation (image)) {
GdkPixbufAnimation *animation;
@@ -1791,7 +1793,6 @@ gth_image_viewer_set_image (GthImageViewer *self,
cairo_surface_t *surface;
if (gth_image_get_is_zoomable (image)) {
- self->priv->image = g_object_ref (image);
gth_image_set_zoom (self->priv->image,
self->priv->zoom_level,
&original_width,
diff --git a/gthumb/gth-image.c b/gthumb/gth-image.c
index c082644..1cee383 100644
--- a/gthumb/gth-image.c
+++ b/gthumb/gth-image.c
@@ -380,6 +380,7 @@ gth_image_set_icc_profile (GthImage *image,
GthICCProfile
gth_image_get_icc_profile (GthImage *image)
{
+ g_return_val_if_fail (image != NULL, NULL);
return image->priv->icc_profile;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]