[gthumb] derive all file tools from GthImageViewerPageTool



commit 625a92b55138465c42111887d3bb187120519f7c
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Wed Oct 9 20:20:55 2013 +0200

    derive all file tools from GthImageViewerPageTool

 .../file_tools/gth-file-tool-adjust-colors.c       |   27 +----
 .../file_tools/gth-file-tool-adjust-contrast.c     |   28 +----
 .../file_tools/gth-file-tool-adjust-contrast.h     |    5 +-
 extensions/file_tools/gth-file-tool-crop.c         |   94 ++++++++--------
 extensions/file_tools/gth-file-tool-crop.h         |    5 +-
 extensions/file_tools/gth-file-tool-equalize.c     |   18 +---
 extensions/file_tools/gth-file-tool-equalize.h     |    5 +-
 extensions/file_tools/gth-file-tool-flip.c         |   18 +---
 extensions/file_tools/gth-file-tool-flip.h         |    5 +-
 extensions/file_tools/gth-file-tool-grayscale.c    |   78 +++++---------
 extensions/file_tools/gth-file-tool-grayscale.h    |    5 +-
 extensions/file_tools/gth-file-tool-mirror.c       |   18 +---
 extensions/file_tools/gth-file-tool-mirror.h       |    5 +-
 extensions/file_tools/gth-file-tool-negative.c     |   18 +---
 extensions/file_tools/gth-file-tool-negative.h     |    5 +-
 extensions/file_tools/gth-file-tool-resize.c       |  116 ++++----------------
 extensions/file_tools/gth-file-tool-resize.h       |    5 +-
 extensions/file_tools/gth-file-tool-rotate-left.c  |   18 +---
 extensions/file_tools/gth-file-tool-rotate-left.h  |    5 +-
 extensions/file_tools/gth-file-tool-rotate-right.c |   18 +---
 extensions/file_tools/gth-file-tool-rotate-right.h |    5 +-
 extensions/file_tools/gth-file-tool-rotate.c       |   54 +++-------
 extensions/file_tools/gth-file-tool-rotate.h       |    5 +-
 extensions/file_tools/gth-file-tool-save-as.c      |    2 +-
 extensions/file_tools/gth-file-tool-save-as.h      |    5 +-
 extensions/file_tools/gth-file-tool-save.c         |    2 +-
 extensions/file_tools/gth-file-tool-save.h         |    5 +-
 extensions/file_tools/gth-file-tool-sharpen.c      |   30 +-----
 extensions/file_tools/gth-image-rotator.c          |   25 +++--
 .../image_viewer/gth-image-viewer-page-tool.c      |   21 +++-
 extensions/image_viewer/gth-image-viewer-page.c    |    2 +-
 31 files changed, 202 insertions(+), 450 deletions(-)
---
diff --git a/extensions/file_tools/gth-file-tool-adjust-colors.c 
b/extensions/file_tools/gth-file-tool-adjust-colors.c
index 347dcd7..06a5aa7 100644
--- a/extensions/file_tools/gth-file-tool-adjust-colors.c
+++ b/extensions/file_tools/gth-file-tool-adjust-colors.c
@@ -231,21 +231,6 @@ adjust_data_free (gpointer user_data)
 }
 
 
-static void
-gth_file_tool_adjust_colors_update_sensitivity (GthFileTool *base)
-{
-       GtkWidget *window;
-       GtkWidget *viewer_page;
-
-       window = gth_file_tool_get_window (base);
-       viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
-       if (! GTH_IS_IMAGE_VIEWER_PAGE (viewer_page))
-               gtk_widget_set_sensitive (GTK_WIDGET (base), FALSE);
-       else
-               gtk_widget_set_sensitive (GTK_WIDGET (base), TRUE);
-}
-
-
 static void apply_changes (GthFileToolAdjustColors *self);
 
 
@@ -286,7 +271,7 @@ image_task_completed_cb (GthTask  *task,
 
        self->priv->image_task = NULL;
 
-       if (gth_file_tool_is_cancelled (GTH_FILE_TOOL (self))) {
+       if (self->priv->closing) {
                g_object_unref (task);
                gth_image_viewer_page_tool_reset_image (GTH_IMAGE_VIEWER_PAGE_TOOL (self));
                return;
@@ -565,18 +550,12 @@ gth_file_tool_adjust_colors_destroy_options (GthFileTool *base)
 
 
 static void
-gth_file_tool_sharpen_modify_image (GthImageViewerPageTool *base)
-{
-       gth_file_tool_show_options (GTH_FILE_TOOL (base));
-}
-
-
-static void
 gth_file_tool_sharpen_reset_image (GthImageViewerPageTool *base)
 {
        GthFileToolAdjustColors *self = (GthFileToolAdjustColors *) base;
 
        if (self->priv->image_task != NULL) {
+               self->priv->closing = TRUE;
                gth_task_cancel (self->priv->image_task);
                return;
        }
@@ -637,12 +616,10 @@ gth_file_tool_adjust_colors_class_init (GthFileToolAdjustColorsClass *klass)
        gobject_class = (GObjectClass*) klass;
        gobject_class->finalize = gth_file_tool_adjust_colors_finalize;
 
-       file_tool_class->update_sensitivity = gth_file_tool_adjust_colors_update_sensitivity;
        file_tool_class = (GthFileToolClass *) klass;
        file_tool_class->get_options = gth_file_tool_adjust_colors_get_options;
        file_tool_class->destroy_options = gth_file_tool_adjust_colors_destroy_options;
 
        image_viewer_page_tool_class = (GthImageViewerPageToolClass *) klass;
-       image_viewer_page_tool_class->modify_image = gth_file_tool_sharpen_modify_image;
        image_viewer_page_tool_class->reset_image = gth_file_tool_sharpen_reset_image;
 }
diff --git a/extensions/file_tools/gth-file-tool-adjust-contrast.c 
b/extensions/file_tools/gth-file-tool-adjust-contrast.c
index 2e194a4..6665e64 100644
--- a/extensions/file_tools/gth-file-tool-adjust-contrast.c
+++ b/extensions/file_tools/gth-file-tool-adjust-contrast.c
@@ -21,22 +21,20 @@
 
 #include <config.h>
 #include <math.h>
-#include <gthumb.h>
-#include <extensions/image_viewer/image-viewer.h>
 #include "gth-file-tool-adjust-contrast.h"
 
 
 #define HISTOGRAM_CROP 0.005
 
 
-G_DEFINE_TYPE (GthFileToolAdjustContrast, gth_file_tool_adjust_contrast, GTH_TYPE_FILE_TOOL)
+G_DEFINE_TYPE (GthFileToolAdjustContrast, gth_file_tool_adjust_contrast, GTH_TYPE_IMAGE_VIEWER_PAGE_TOOL)
 
 
 typedef struct {
-       GtkWidget        *viewer_page;
-       int              *lowest;
-       int              *highest;
-       double           *factor;
+       GtkWidget *viewer_page;
+       int       *lowest;
+       int       *highest;
+       double    *factor;
 } AdjustContrastData;
 
 
@@ -241,21 +239,6 @@ gth_file_tool_adjust_contrast_activate (GthFileTool *base)
 
 
 static void
-gth_file_tool_adjust_contrast_update_sensitivity (GthFileTool *base)
-{
-       GtkWidget *window;
-       GtkWidget *viewer_page;
-
-       window = gth_file_tool_get_window (base);
-       viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
-       if (! GTH_IS_IMAGE_VIEWER_PAGE (viewer_page))
-               gtk_widget_set_sensitive (GTK_WIDGET (base), FALSE);
-       else
-               gtk_widget_set_sensitive (GTK_WIDGET (base), TRUE);
-}
-
-
-static void
 gth_file_tool_adjust_contrast_init (GthFileToolAdjustContrast *self)
 {
        gth_file_tool_construct (GTH_FILE_TOOL (self), "tool-adjust-contrast", _("Adjust Contrast"), NULL, 
TRUE);
@@ -269,6 +252,5 @@ gth_file_tool_adjust_contrast_class_init (GthFileToolAdjustContrastClass *klass)
        GthFileToolClass *file_tool_class;
 
        file_tool_class = GTH_FILE_TOOL_CLASS (klass);
-       file_tool_class->update_sensitivity = gth_file_tool_adjust_contrast_update_sensitivity;
        file_tool_class->activate = gth_file_tool_adjust_contrast_activate;
 }
diff --git a/extensions/file_tools/gth-file-tool-adjust-contrast.h 
b/extensions/file_tools/gth-file-tool-adjust-contrast.h
index 1fda109..d878020 100644
--- a/extensions/file_tools/gth-file-tool-adjust-contrast.h
+++ b/extensions/file_tools/gth-file-tool-adjust-contrast.h
@@ -23,6 +23,7 @@
 #define GTH_FILE_TOOL_ADJUST_CONTRAST_H
 
 #include <gthumb.h>
+#include <extensions/image_viewer/image-viewer.h>
 
 G_BEGIN_DECLS
 
@@ -37,11 +38,11 @@ typedef struct _GthFileToolAdjustContrast GthFileToolAdjustContrast;
 typedef struct _GthFileToolAdjustContrastClass GthFileToolAdjustContrastClass;
 
 struct _GthFileToolAdjustContrast {
-       GthFileTool parent_instance;
+       GthImageViewerPageTool parent_instance;
 };
 
 struct _GthFileToolAdjustContrastClass {
-       GthFileToolClass parent_class;
+       GthImageViewerPageToolClass parent_class;
 };
 
 GType  gth_file_tool_adjust_contrast_get_type  (void);
diff --git a/extensions/file_tools/gth-file-tool-crop.c b/extensions/file_tools/gth-file-tool-crop.c
index a59fd94..d602708 100644
--- a/extensions/file_tools/gth-file-tool-crop.c
+++ b/extensions/file_tools/gth-file-tool-crop.c
@@ -30,7 +30,7 @@
 #define GET_WIDGET(x) (_gtk_builder_get_widget (self->priv->builder, (x)))
 
 
-G_DEFINE_TYPE (GthFileToolCrop, gth_file_tool_crop, GTH_TYPE_FILE_TOOL)
+G_DEFINE_TYPE (GthFileToolCrop, gth_file_tool_crop, GTH_TYPE_IMAGE_VIEWER_PAGE_TOOL)
 
 
 struct _GthFileToolCropPrivate {
@@ -50,21 +50,6 @@ struct _GthFileToolCropPrivate {
 };
 
 
-static void
-gth_file_tool_crop_update_sensitivity (GthFileTool *base)
-{
-       GtkWidget *window;
-       GtkWidget *viewer_page;
-
-       window = gth_file_tool_get_window (base);
-       viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
-       if (! GTH_IS_IMAGE_VIEWER_PAGE (viewer_page))
-               gtk_widget_set_sensitive (GTK_WIDGET (base), FALSE);
-       else
-               gtk_widget_set_sensitive (GTK_WIDGET (base), TRUE);
-}
-
-
 static gpointer
 crop_exec (GthAsyncTask *task,
           gpointer      user_data)
@@ -99,10 +84,26 @@ image_task_completed_cb (GthTask  *task,
                         gpointer  user_data)
 {
        GthFileToolCrop *self = user_data;
+       cairo_surface_t *destination;
+       GtkWidget       *viewer_page;
+
+       if (error != NULL) {
+               g_object_unref (task);
+               return;
+       }
+
+       destination = gth_image_task_get_destination_surface (GTH_IMAGE_TASK (task));
+       if (destination == NULL) {
+               g_object_unref (task);
+               return;
+       }
+
+       viewer_page = gth_image_viewer_page_tool_get_page (GTH_IMAGE_VIEWER_PAGE_TOOL (self));
+       gth_image_viewer_page_set_image (GTH_IMAGE_VIEWER_PAGE (viewer_page), destination, TRUE);
+       gth_file_tool_hide_options (GTH_FILE_TOOL (self));
 
-       gth_image_viewer_task_set_destination (task, error, user_data);
-       if (error == NULL)
-               gth_file_tool_hide_options (GTH_FILE_TOOL (self));
+       cairo_surface_destroy (destination);
+       g_object_unref (task);
 }
 
 
@@ -111,29 +112,24 @@ crop_button_clicked_cb (GtkButton       *button,
                        GthFileToolCrop *self)
 {
        cairo_rectangle_int_t  selection;
-       GtkWidget             *window;
-       GtkWidget             *viewer_page;
        GthTask               *task;
 
        gth_image_selector_get_selection (self->priv->selector, &selection);
        if ((selection.width == 0) || (selection.height == 0))
                return;
 
-       window = gth_file_tool_get_window (GTH_FILE_TOOL (self));
-       viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
-
-       task = gth_image_viewer_task_new (GTH_IMAGE_VIEWER_PAGE (viewer_page),
-                                         _("Applying changes"),
-                                         NULL,
-                                         crop_exec,
-                                         NULL,
-                                         self,
-                                         NULL);
+       task = gth_image_task_new (_("Applying changes"),
+                                  NULL,
+                                  crop_exec,
+                                  NULL,
+                                  self,
+                                  NULL);
+       gth_image_task_set_source_surface (GTH_IMAGE_TASK (task), gth_image_viewer_page_tool_get_source 
(GTH_IMAGE_VIEWER_PAGE_TOOL (self)));
        g_signal_connect (task,
                          "completed",
                          G_CALLBACK (image_task_completed_cb),
                          self);
-       gth_browser_exec_task (GTH_BROWSER (window), task, FALSE);
+       gth_browser_exec_task (GTH_BROWSER (gth_file_tool_get_window (GTH_FILE_TOOL (self))), task, FALSE);
 }
 
 
@@ -421,6 +417,7 @@ gth_file_tool_crop_get_options (GthFileTool *base)
        GtkWidget       *window;
        GtkWidget       *viewer_page;
        GtkWidget       *viewer;
+       cairo_surface_t *source;
        GtkWidget       *options;
        char            *text;
 
@@ -432,10 +429,11 @@ gth_file_tool_crop_get_options (GthFileTool *base)
                return NULL;
 
        viewer = gth_image_viewer_page_get_image_viewer (GTH_IMAGE_VIEWER_PAGE (viewer_page));
-       if (gth_image_viewer_get_current_image (GTH_IMAGE_VIEWER (viewer)) == NULL)
+       source = gth_image_viewer_page_tool_get_source (GTH_IMAGE_VIEWER_PAGE_TOOL (self));
+       if (source == NULL)
                return NULL;
 
-       gth_image_viewer_get_original_size(GTH_IMAGE_VIEWER (viewer), &self->priv->original_width, 
&self->priv->original_height);
+       gth_image_viewer_get_original_size (GTH_IMAGE_VIEWER (viewer), &self->priv->original_width, 
&self->priv->original_height);
        _gtk_widget_get_screen_size (window, &self->priv->screen_width, &self->priv->screen_height);
 
        self->priv->builder = _gtk_builder_new_from_file ("crop-options.ui", "file_tools");
@@ -568,7 +566,8 @@ gth_file_tool_crop_get_options (GthFileTool *base)
                          G_CALLBACK (selector_selection_changed_cb),
                          self);
 
-       gth_image_viewer_set_tool (GTH_IMAGE_VIEWER (viewer), (GthImageViewerTool *) self->priv->selector);
+       gth_image_viewer_page_set_image (GTH_IMAGE_VIEWER_PAGE (viewer_page), source, FALSE);
+       gth_image_viewer_set_tool (GTH_IMAGE_VIEWER (viewer), GTH_IMAGE_VIEWER_TOOL (self->priv->selector));
        gth_image_viewer_set_zoom_quality (GTH_IMAGE_VIEWER (viewer), GTH_ZOOM_QUALITY_LOW);
        gth_image_viewer_set_fit_mode (GTH_IMAGE_VIEWER (viewer), GTH_FIT_SIZE_IF_LARGER);
        ratio_combobox_changed_cb (NULL, self);
@@ -628,9 +627,12 @@ gth_file_tool_crop_destroy_options (GthFileTool *base)
 
 
 static void
-gth_file_tool_crop_activate (GthFileTool *base)
+gth_file_tool_crop_reset_image (GthImageViewerPageTool *base)
 {
-       gth_file_tool_show_options (base);
+       GthFileToolCrop *self = (GthFileToolCrop *) base;
+
+       gth_image_viewer_page_reset (GTH_IMAGE_VIEWER_PAGE (gth_image_viewer_page_tool_get_page 
(GTH_IMAGE_VIEWER_PAGE_TOOL (self))));
+       gth_file_tool_hide_options (GTH_FILE_TOOL (self));
 }
 
 
@@ -663,19 +665,21 @@ gth_file_tool_crop_finalize (GObject *object)
 
 
 static void
-gth_file_tool_crop_class_init (GthFileToolCropClass *class)
+gth_file_tool_crop_class_init (GthFileToolCropClass *klass)
 {
-       GObjectClass     *gobject_class;
-       GthFileToolClass *file_tool_class;
+       GObjectClass                *gobject_class;
+       GthFileToolClass            *file_tool_class;
+       GthImageViewerPageToolClass *image_viewer_page_tool_class;
 
-       g_type_class_add_private (class, sizeof (GthFileToolCropPrivate));
+       g_type_class_add_private (klass, sizeof (GthFileToolCropPrivate));
 
-       gobject_class = (GObjectClass*) class;
+       gobject_class = (GObjectClass*) klass;
        gobject_class->finalize = gth_file_tool_crop_finalize;
 
-       file_tool_class = (GthFileToolClass *) class;
-       file_tool_class->update_sensitivity = gth_file_tool_crop_update_sensitivity;
-       file_tool_class->activate = gth_file_tool_crop_activate;
+       file_tool_class = (GthFileToolClass *) klass;
        file_tool_class->get_options = gth_file_tool_crop_get_options;
        file_tool_class->destroy_options = gth_file_tool_crop_destroy_options;
+
+       image_viewer_page_tool_class = (GthImageViewerPageToolClass *) klass;
+       image_viewer_page_tool_class->reset_image = gth_file_tool_crop_reset_image;
 }
diff --git a/extensions/file_tools/gth-file-tool-crop.h b/extensions/file_tools/gth-file-tool-crop.h
index f55684e..ae1054e 100644
--- a/extensions/file_tools/gth-file-tool-crop.h
+++ b/extensions/file_tools/gth-file-tool-crop.h
@@ -23,6 +23,7 @@
 #define GTH_FILE_TOOL_CROP_H
 
 #include <gthumb.h>
+#include <extensions/image_viewer/image-viewer.h>
 
 G_BEGIN_DECLS
 
@@ -38,12 +39,12 @@ typedef struct _GthFileToolCropClass GthFileToolCropClass;
 typedef struct _GthFileToolCropPrivate GthFileToolCropPrivate;
 
 struct _GthFileToolCrop {
-       GthFileTool parent_instance;
+       GthImageViewerPageTool parent_instance;
        GthFileToolCropPrivate *priv;
 };
 
 struct _GthFileToolCropClass {
-       GthFileToolClass parent_class;
+       GthImageViewerPageToolClass parent_class;
 };
 
 GType  gth_file_tool_crop_get_type  (void);
diff --git a/extensions/file_tools/gth-file-tool-equalize.c b/extensions/file_tools/gth-file-tool-equalize.c
index 7e5507a..4a7f814 100644
--- a/extensions/file_tools/gth-file-tool-equalize.c
+++ b/extensions/file_tools/gth-file-tool-equalize.c
@@ -26,7 +26,7 @@
 #include "gth-file-tool-equalize.h"
 
 
-G_DEFINE_TYPE (GthFileToolEqualize, gth_file_tool_equalize, GTH_TYPE_FILE_TOOL)
+G_DEFINE_TYPE (GthFileToolEqualize, gth_file_tool_equalize, GTH_TYPE_IMAGE_VIEWER_PAGE_TOOL)
 
 
 typedef struct {
@@ -170,27 +170,11 @@ gth_file_tool_equalize_activate (GthFileTool *base)
 
 
 static void
-gth_file_tool_equalize_update_sensitivity (GthFileTool *base)
-{
-       GtkWidget *window;
-       GtkWidget *viewer_page;
-
-       window = gth_file_tool_get_window (base);
-       viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
-       if (! GTH_IS_IMAGE_VIEWER_PAGE (viewer_page))
-               gtk_widget_set_sensitive (GTK_WIDGET (base), FALSE);
-       else
-               gtk_widget_set_sensitive (GTK_WIDGET (base), TRUE);
-}
-
-
-static void
 gth_file_tool_equalize_class_init (GthFileToolEqualizeClass *klass)
 {
        GthFileToolClass *file_tool_class;
 
        file_tool_class = GTH_FILE_TOOL_CLASS (klass);
-       file_tool_class->update_sensitivity = gth_file_tool_equalize_update_sensitivity;
        file_tool_class->activate = gth_file_tool_equalize_activate;
 }
 
diff --git a/extensions/file_tools/gth-file-tool-equalize.h b/extensions/file_tools/gth-file-tool-equalize.h
index 0a04988..4ec1520 100644
--- a/extensions/file_tools/gth-file-tool-equalize.h
+++ b/extensions/file_tools/gth-file-tool-equalize.h
@@ -23,6 +23,7 @@
 #define GTH_FILE_TOOL_EQUALIZE_H
 
 #include <gthumb.h>
+#include <extensions/image_viewer/image-viewer.h>
 
 G_BEGIN_DECLS
 
@@ -37,11 +38,11 @@ typedef struct _GthFileToolEqualize GthFileToolEqualize;
 typedef struct _GthFileToolEqualizeClass GthFileToolEqualizeClass;
 
 struct _GthFileToolEqualize {
-       GthFileTool parent_instance;
+       GthImageViewerPageTool parent_instance;
 };
 
 struct _GthFileToolEqualizeClass {
-       GthFileToolClass parent_class;
+       GthImageViewerPageToolClass parent_class;
 };
 
 GType  gth_file_tool_equalize_get_type  (void);
diff --git a/extensions/file_tools/gth-file-tool-flip.c b/extensions/file_tools/gth-file-tool-flip.c
index 357b33b..0d5ae6b 100644
--- a/extensions/file_tools/gth-file-tool-flip.c
+++ b/extensions/file_tools/gth-file-tool-flip.c
@@ -26,7 +26,7 @@
 #include "gth-file-tool-flip.h"
 
 
-G_DEFINE_TYPE (GthFileToolFlip, gth_file_tool_flip, GTH_TYPE_FILE_TOOL)
+G_DEFINE_TYPE (GthFileToolFlip, gth_file_tool_flip, GTH_TYPE_IMAGE_VIEWER_PAGE_TOOL)
 
 
 static gpointer
@@ -75,27 +75,11 @@ gth_file_tool_flip_activate (GthFileTool *base)
 
 
 static void
-gth_file_tool_flip_update_sensitivity (GthFileTool *base)
-{
-       GtkWidget *window;
-       GtkWidget *viewer_page;
-
-       window = gth_file_tool_get_window (base);
-       viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
-       if (! GTH_IS_IMAGE_VIEWER_PAGE (viewer_page))
-               gtk_widget_set_sensitive (GTK_WIDGET (base), FALSE);
-       else
-               gtk_widget_set_sensitive (GTK_WIDGET (base), TRUE);
-}
-
-
-static void
 gth_file_tool_flip_class_init (GthFileToolFlipClass *klass)
 {
        GthFileToolClass *file_tool_class;
 
        file_tool_class = GTH_FILE_TOOL_CLASS (klass);
-       file_tool_class->update_sensitivity = gth_file_tool_flip_update_sensitivity;
        file_tool_class->activate = gth_file_tool_flip_activate;
 }
 
diff --git a/extensions/file_tools/gth-file-tool-flip.h b/extensions/file_tools/gth-file-tool-flip.h
index 2ab1fc1..760f83d 100644
--- a/extensions/file_tools/gth-file-tool-flip.h
+++ b/extensions/file_tools/gth-file-tool-flip.h
@@ -23,6 +23,7 @@
 #define GTH_FILE_TOOL_FLIP_H
 
 #include <gthumb.h>
+#include <extensions/image_viewer/image-viewer.h>
 
 G_BEGIN_DECLS
 
@@ -37,11 +38,11 @@ typedef struct _GthFileToolFlip GthFileToolFlip;
 typedef struct _GthFileToolFlipClass GthFileToolFlipClass;
 
 struct _GthFileToolFlip {
-       GthFileTool parent_instance;
+       GthImageViewerPageTool parent_instance;
 };
 
 struct _GthFileToolFlipClass {
-       GthFileToolClass parent_class;
+       GthImageViewerPageToolClass parent_class;
 };
 
 GType  gth_file_tool_flip_get_type  (void);
diff --git a/extensions/file_tools/gth-file-tool-grayscale.c b/extensions/file_tools/gth-file-tool-grayscale.c
index a7bc77c..6da8637 100644
--- a/extensions/file_tools/gth-file-tool-grayscale.c
+++ b/extensions/file_tools/gth-file-tool-grayscale.c
@@ -31,7 +31,7 @@
 #define PREVIEW_SIZE 0.9
 
 
-G_DEFINE_TYPE (GthFileToolGrayscale, gth_file_tool_grayscale, GTH_TYPE_FILE_TOOL)
+G_DEFINE_TYPE (GthFileToolGrayscale, gth_file_tool_grayscale, GTH_TYPE_IMAGE_VIEWER_PAGE_TOOL)
 
 
 typedef enum {
@@ -151,7 +151,6 @@ grayscale_exec (GthAsyncTask *task,
 
 
 static void apply_changes (GthFileToolGrayscale *self);
-static void gth_file_tool_grayscale_cancel (GthFileTool *file_tool);
 
 
 static void
@@ -166,7 +165,7 @@ image_task_completed_cb (GthTask  *task,
 
        if (self->priv->closing) {
                g_object_unref (task);
-               gth_file_tool_grayscale_cancel (GTH_FILE_TOOL (self));
+               gth_image_viewer_page_tool_reset_image (GTH_IMAGE_VIEWER_PAGE_TOOL (self));
                return;
        }
 
@@ -234,17 +233,17 @@ apply_cb (gpointer user_data)
        if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (GET_WIDGET ("average_radiobutton"))))
                grayscale_data->method = METHOD_AVARAGE;
 
-       self->priv->image_task = gth_image_viewer_task_new (GTH_IMAGE_VIEWER_PAGE 
(gth_browser_get_viewer_page (GTH_BROWSER (window))),
-                                                           _("Applying changes"),
-                                                           NULL,
-                                                           grayscale_exec,
-                                                           NULL,
-                                                           grayscale_data,
-                                                           grayscale_data_free);
-       if (! self->priv->apply_to_original) {
-               gth_image_viewer_task_set_load_original (GTH_IMAGE_VIEWER_TASK (self->priv->image_task), 
FALSE);
+       self->priv->image_task = gth_image_task_new (_("Applying changes"),
+                                                    NULL,
+                                                    grayscale_exec,
+                                                    NULL,
+                                                    grayscale_data,
+                                                    grayscale_data_free);
+       if (self->priv->apply_to_original)
+               gth_image_task_set_source_surface (GTH_IMAGE_TASK (self->priv->image_task), 
gth_image_viewer_page_tool_get_source (GTH_IMAGE_VIEWER_PAGE_TOOL (self)));
+       else
                gth_image_task_set_source_surface (GTH_IMAGE_TASK (self->priv->image_task), 
self->priv->preview);
-       }
+
        g_signal_connect (self->priv->image_task,
                          "completed",
                          G_CALLBACK (image_task_completed_cb),
@@ -267,33 +266,9 @@ apply_changes (GthFileToolGrayscale *self)
 
 
 static void
-gth_file_tool_grayscale_update_sensitivity (GthFileTool *base)
-{
-       GtkWidget *window;
-       GtkWidget *viewer_page;
-
-       window = gth_file_tool_get_window (base);
-       viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
-       if (! GTH_IS_IMAGE_VIEWER_PAGE (viewer_page))
-               gtk_widget_set_sensitive (GTK_WIDGET (base), FALSE);
-       else
-               gtk_widget_set_sensitive (GTK_WIDGET (base), TRUE);
-}
-
-
-static void
-gth_file_tool_grayscale_activate (GthFileTool *base)
-{
-       gth_file_tool_show_options (base);
-}
-
-
-static void
-gth_file_tool_grayscale_cancel (GthFileTool *file_tool)
+gth_file_tool_grayscale_reset_image (GthImageViewerPageTool *base)
 {
-       GthFileToolGrayscale *self = GTH_FILE_TOOL_GRAYSCALE (file_tool);
-       GtkWidget             *window;
-       GtkWidget             *viewer_page;
+       GthFileToolGrayscale *self = GTH_FILE_TOOL_GRAYSCALE (base);
 
        if (self->priv->image_task != NULL) {
                self->priv->closing = TRUE;
@@ -305,9 +280,8 @@ gth_file_tool_grayscale_cancel (GthFileTool *file_tool)
                self->priv->apply_event = 0;
        }
 
-       window = gth_file_tool_get_window (GTH_FILE_TOOL (self));
-       viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
-       gth_image_viewer_page_reset (GTH_IMAGE_VIEWER_PAGE (viewer_page));
+       gth_image_viewer_page_reset (GTH_IMAGE_VIEWER_PAGE (gth_image_viewer_page_tool_get_page 
(GTH_IMAGE_VIEWER_PAGE_TOOL (self))));
+       gth_file_tool_hide_options (GTH_FILE_TOOL (self));
 }
 
 
@@ -340,7 +314,6 @@ method_changed_cb (GtkButton *button,
                   gpointer   user_data)
 {
        GthFileToolGrayscale *self = user_data;
-
        apply_changes (self);
 }
 
@@ -368,7 +341,7 @@ gth_file_tool_grayscale_get_options (GthFileTool *base)
        cairo_surface_destroy (self->priv->preview);
 
        viewer = gth_image_viewer_page_get_image_viewer (GTH_IMAGE_VIEWER_PAGE (viewer_page));
-       source = gth_image_viewer_get_current_image (GTH_IMAGE_VIEWER (viewer));
+       source = gth_image_viewer_page_tool_get_source (GTH_IMAGE_VIEWER_PAGE_TOOL (self));
        if (source == NULL)
                return NULL;
 
@@ -470,8 +443,9 @@ gth_file_tool_grayscale_finalize (GObject *object)
 static void
 gth_file_tool_grayscale_class_init (GthFileToolGrayscaleClass *klass)
 {
-       GObjectClass     *gobject_class;
-       GthFileToolClass *file_tool_class;
+       GObjectClass                *gobject_class;
+       GthFileToolClass            *file_tool_class;
+       GthImageViewerPageToolClass *image_viewer_page_tool_class;
 
        g_type_class_add_private (klass, sizeof (GthFileToolGrayscalePrivate));
 
@@ -479,11 +453,11 @@ gth_file_tool_grayscale_class_init (GthFileToolGrayscaleClass *klass)
        gobject_class->finalize = gth_file_tool_grayscale_finalize;
 
        file_tool_class = GTH_FILE_TOOL_CLASS (klass);
-       file_tool_class->update_sensitivity = gth_file_tool_grayscale_update_sensitivity;
-       file_tool_class->activate = gth_file_tool_grayscale_activate;
-       file_tool_class->cancel = gth_file_tool_grayscale_cancel;
        file_tool_class->get_options = gth_file_tool_grayscale_get_options;
        file_tool_class->destroy_options = gth_file_tool_grayscale_destroy_options;
+
+       image_viewer_page_tool_class = (GthImageViewerPageToolClass *) klass;
+       image_viewer_page_tool_class->reset_image = gth_file_tool_grayscale_reset_image;
 }
 
 
@@ -495,5 +469,9 @@ gth_file_tool_grayscale_init (GthFileToolGrayscale *self)
        self->priv->destination = NULL;
        self->priv->builder = NULL;
 
-       gth_file_tool_construct (GTH_FILE_TOOL (self), "tool-grayscale", _("Grayscale..."), _("Grayscale"), 
FALSE);
+       gth_file_tool_construct (GTH_FILE_TOOL (self),
+                                "tool-grayscale",
+                                _("Grayscale..."),
+                                _("Grayscale"),
+                                FALSE);
 }
diff --git a/extensions/file_tools/gth-file-tool-grayscale.h b/extensions/file_tools/gth-file-tool-grayscale.h
index ee77e52..4523d27 100644
--- a/extensions/file_tools/gth-file-tool-grayscale.h
+++ b/extensions/file_tools/gth-file-tool-grayscale.h
@@ -23,6 +23,7 @@
 #define GTH_FILE_TOOL_GRAYSCALE_H
 
 #include <gthumb.h>
+#include <extensions/image_viewer/image-viewer.h>
 
 G_BEGIN_DECLS
 
@@ -38,12 +39,12 @@ typedef struct _GthFileToolGrayscaleClass GthFileToolGrayscaleClass;
 typedef struct _GthFileToolGrayscalePrivate GthFileToolGrayscalePrivate;
 
 struct _GthFileToolGrayscale {
-       GthFileTool parent_instance;
+       GthImageViewerPageTool parent_instance;
        GthFileToolGrayscalePrivate *priv;
 };
 
 struct _GthFileToolGrayscaleClass {
-       GthFileToolClass parent_class;
+       GthImageViewerPageToolClass parent_class;
 };
 
 GType  gth_file_tool_grayscale_get_type  (void);
diff --git a/extensions/file_tools/gth-file-tool-mirror.c b/extensions/file_tools/gth-file-tool-mirror.c
index 0f79dc9..c29a1bc 100644
--- a/extensions/file_tools/gth-file-tool-mirror.c
+++ b/extensions/file_tools/gth-file-tool-mirror.c
@@ -26,7 +26,7 @@
 #include "gth-file-tool-mirror.h"
 
 
-G_DEFINE_TYPE (GthFileToolMirror, gth_file_tool_mirror, GTH_TYPE_FILE_TOOL)
+G_DEFINE_TYPE (GthFileToolMirror, gth_file_tool_mirror, GTH_TYPE_IMAGE_VIEWER_PAGE_TOOL)
 
 
 static gpointer
@@ -75,27 +75,11 @@ gth_file_tool_mirror_activate (GthFileTool *base)
 
 
 static void
-gth_file_tool_mirror_update_sensitivity (GthFileTool *base)
-{
-       GtkWidget *window;
-       GtkWidget *viewer_page;
-
-       window = gth_file_tool_get_window (base);
-       viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
-       if (! GTH_IS_IMAGE_VIEWER_PAGE (viewer_page))
-               gtk_widget_set_sensitive (GTK_WIDGET (base), FALSE);
-       else
-               gtk_widget_set_sensitive (GTK_WIDGET (base), TRUE);
-}
-
-
-static void
 gth_file_tool_mirror_class_init (GthFileToolMirrorClass *klass)
 {
        GthFileToolClass *file_tool_class;
 
        file_tool_class = GTH_FILE_TOOL_CLASS (klass);
-       file_tool_class->update_sensitivity = gth_file_tool_mirror_update_sensitivity;
        file_tool_class->activate = gth_file_tool_mirror_activate;
 }
 
diff --git a/extensions/file_tools/gth-file-tool-mirror.h b/extensions/file_tools/gth-file-tool-mirror.h
index c69d564..8aa7846 100644
--- a/extensions/file_tools/gth-file-tool-mirror.h
+++ b/extensions/file_tools/gth-file-tool-mirror.h
@@ -23,6 +23,7 @@
 #define GTH_FILE_TOOL_MIRROR_H
 
 #include <gthumb.h>
+#include <extensions/image_viewer/image-viewer.h>
 
 G_BEGIN_DECLS
 
@@ -37,11 +38,11 @@ typedef struct _GthFileToolMirror GthFileToolMirror;
 typedef struct _GthFileToolMirrorClass GthFileToolMirrorClass;
 
 struct _GthFileToolMirror {
-       GthFileTool parent_instance;
+       GthImageViewerPageTool parent_instance;
 };
 
 struct _GthFileToolMirrorClass {
-       GthFileToolClass parent_class;
+       GthImageViewerPageToolClass parent_class;
 };
 
 GType  gth_file_tool_mirror_get_type  (void);
diff --git a/extensions/file_tools/gth-file-tool-negative.c b/extensions/file_tools/gth-file-tool-negative.c
index e16cba8..7c34c8a 100644
--- a/extensions/file_tools/gth-file-tool-negative.c
+++ b/extensions/file_tools/gth-file-tool-negative.c
@@ -25,22 +25,7 @@
 #include "gth-file-tool-negative.h"
 
 
-G_DEFINE_TYPE (GthFileToolNegative, gth_file_tool_negative, GTH_TYPE_FILE_TOOL)
-
-
-static void
-gth_file_tool_negative_update_sensitivity (GthFileTool *base)
-{
-       GtkWidget *window;
-       GtkWidget *viewer_page;
-
-       window = gth_file_tool_get_window (base);
-       viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
-       if (! GTH_IS_IMAGE_VIEWER_PAGE (viewer_page))
-               gtk_widget_set_sensitive (GTK_WIDGET (base), FALSE);
-       else
-               gtk_widget_set_sensitive (GTK_WIDGET (base), TRUE);
-}
+G_DEFINE_TYPE (GthFileToolNegative, gth_file_tool_negative, GTH_TYPE_IMAGE_VIEWER_PAGE_TOOL)
 
 
 static gpointer
@@ -141,7 +126,6 @@ gth_file_tool_negative_class_init (GthFileToolNegativeClass *klass)
        GthFileToolClass *file_tool_class;
 
        file_tool_class = GTH_FILE_TOOL_CLASS (klass);
-       file_tool_class->update_sensitivity = gth_file_tool_negative_update_sensitivity;
        file_tool_class->activate = gth_file_tool_negative_activate;
 }
 
diff --git a/extensions/file_tools/gth-file-tool-negative.h b/extensions/file_tools/gth-file-tool-negative.h
index c7d36eb..358f2ac 100644
--- a/extensions/file_tools/gth-file-tool-negative.h
+++ b/extensions/file_tools/gth-file-tool-negative.h
@@ -23,6 +23,7 @@
 #define GTH_FILE_TOOL_NEGATIVE_H
 
 #include <gthumb.h>
+#include <extensions/image_viewer/image-viewer.h>
 
 G_BEGIN_DECLS
 
@@ -37,11 +38,11 @@ typedef struct _GthFileToolNegative GthFileToolNegative;
 typedef struct _GthFileToolNegativeClass GthFileToolNegativeClass;
 
 struct _GthFileToolNegative {
-       GthFileTool parent_instance;
+       GthImageViewerPageTool parent_instance;
 };
 
 struct _GthFileToolNegativeClass {
-       GthFileToolClass parent_class;
+       GthImageViewerPageToolClass parent_class;
 };
 
 GType  gth_file_tool_negative_get_type  (void);
diff --git a/extensions/file_tools/gth-file-tool-resize.c b/extensions/file_tools/gth-file-tool-resize.c
index fb55cc3..296b019 100644
--- a/extensions/file_tools/gth-file-tool-resize.c
+++ b/extensions/file_tools/gth-file-tool-resize.c
@@ -33,12 +33,11 @@
 #define PIXELS_UNIT_POSITION 0
 
 
-G_DEFINE_TYPE (GthFileToolResize, gth_file_tool_resize, GTH_TYPE_FILE_TOOL)
+G_DEFINE_TYPE (GthFileToolResize, gth_file_tool_resize, GTH_TYPE_IMAGE_VIEWER_PAGE_TOOL)
 
 
 struct _GthFileToolResizePrivate {
        GSettings       *settings;
-       cairo_surface_t *original_image;
        cairo_surface_t *preview;
        cairo_surface_t *new_image;
        GtkBuilder      *builder;
@@ -60,21 +59,6 @@ struct _GthFileToolResizePrivate {
 };
 
 
-static void
-gth_file_tool_resize_update_sensitivity (GthFileTool *base)
-{
-       GtkWidget *window;
-       GtkWidget *viewer_page;
-
-       window = gth_file_tool_get_window (base);
-       viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
-       if (! GTH_IS_IMAGE_VIEWER_PAGE (viewer_page))
-               gtk_widget_set_sensitive (GTK_WIDGET (base), FALSE);
-       else
-               gtk_widget_set_sensitive (GTK_WIDGET (base), TRUE);
-}
-
-
 static void update_image_size (GthFileToolResize *self);
 
 
@@ -106,9 +90,6 @@ update_dimensione_info_label (GthFileToolResize *self,
 }
 
 
-static void gth_file_tool_resize_cancel (GthFileTool *base);
-
-
 static void
 resize_task_completed_cb (GthTask  *task,
                          GError   *error,
@@ -122,7 +103,7 @@ resize_task_completed_cb (GthTask  *task,
 
        if (self->priv->closing) {
                g_object_unref (task);
-               gth_file_tool_resize_cancel (GTH_FILE_TOOL (self));
+               gth_image_viewer_page_tool_reset_image (GTH_IMAGE_VIEWER_PAGE_TOOL (self));
                return;
        }
 
@@ -211,7 +192,10 @@ update_image_size_cb (gpointer user_data)
                                                      NULL,
                                                      self,
                                                      NULL);
-       gth_image_task_set_source_surface (GTH_IMAGE_TASK (self->priv->resize_task), 
self->priv->apply_to_original ? self->priv->original_image : self->priv->preview);
+       if (self->priv->apply_to_original)
+               gth_image_task_set_source_surface (GTH_IMAGE_TASK (self->priv->resize_task), 
gth_image_viewer_page_tool_get_source (GTH_IMAGE_VIEWER_PAGE_TOOL (self)));
+       else
+               gth_image_task_set_source_surface (GTH_IMAGE_TASK (self->priv->resize_task), 
self->priv->preview);
 
        g_signal_connect (self->priv->resize_task,
                          "completed",
@@ -524,6 +508,7 @@ static GtkWidget *
 gth_file_tool_resize_get_options (GthFileTool *base)
 {
        GthFileToolResize *self = (GthFileToolResize *) base;
+       cairo_surface_t   *source;
        GtkWidget         *window;
        GtkWidget         *viewer_page;
        GtkWidget         *viewer;
@@ -533,11 +518,12 @@ gth_file_tool_resize_get_options (GthFileTool *base)
        GtkWidget         *options;
        char              *text;
 
-       if (self->priv->original_image == NULL)
+       source = gth_image_viewer_page_tool_get_source (GTH_IMAGE_VIEWER_PAGE_TOOL (self));
+       if (source == NULL)
                return NULL;
 
-       self->priv->original_width = cairo_image_surface_get_width (self->priv->original_image);
-       self->priv->original_height = cairo_image_surface_get_height (self->priv->original_image);
+       self->priv->original_width = cairo_image_surface_get_width (source);
+       self->priv->original_height = cairo_image_surface_get_height (source);
 
        window = gth_file_tool_get_window (base);
        viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
@@ -547,9 +533,9 @@ gth_file_tool_resize_get_options (GthFileTool *base)
        preview_width = self->priv->original_width;
        preview_height = self->priv->original_height;
        if (scale_keeping_ratio (&preview_width, &preview_height, allocation.width, allocation.height, FALSE))
-               self->priv->preview = _cairo_image_surface_scale_bilinear (self->priv->original_image, 
preview_width, preview_height);
+               self->priv->preview = _cairo_image_surface_scale_bilinear (source, preview_width, 
preview_height);
        else
-               self->priv->preview = cairo_surface_reference (self->priv->original_image);
+               self->priv->preview = cairo_surface_reference (source);
 
        _gtk_widget_get_screen_size (window, &self->priv->screen_width, &self->priv->screen_height);
        self->priv->new_image = NULL;
@@ -713,7 +699,6 @@ gth_file_tool_resize_destroy_options (GthFileTool *base)
 
                _cairo_clear_surface (&self->priv->new_image);
                _cairo_clear_surface (&self->priv->preview);
-               _cairo_clear_surface (&self->priv->original_image);
                _g_clear_object (&self->priv->builder);
        }
 
@@ -733,64 +718,9 @@ gth_file_tool_resize_destroy_options (GthFileTool *base)
 
 
 static void
-original_image_task_completed_cb (GthTask  *task,
-                                 GError   *error,
-                                 gpointer  user_data)
-{
-       GthFileToolResize *self = user_data;
-
-       self->priv->resize_task = NULL;
-
-       if (self->priv->closing) {
-               g_object_unref (task);
-               gth_file_tool_resize_cancel (GTH_FILE_TOOL (self));
-               return;
-       }
-
-       if (error != NULL) {
-               g_object_unref (task);
-               return;
-       }
-
-       self->priv->original_image = gth_original_image_task_get_image (task);
-       if (self->priv->original_image != NULL)
-               gth_file_tool_show_options (GTH_FILE_TOOL (self));
-
-       g_object_unref (task);
-}
-
-
-static void
-gth_file_tool_resize_activate (GthFileTool *base)
+gth_file_tool_resize_reset_image (GthImageViewerPageTool *base)
 {
        GthFileToolResize *self = (GthFileToolResize *) base;
-       GtkWidget         *window;
-       GtkWidget         *viewer_page;
-
-       /* load the original image */
-
-       window = gth_file_tool_get_window (GTH_FILE_TOOL (self));
-       viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
-       if (! GTH_IS_IMAGE_VIEWER_PAGE (viewer_page))
-               return;
-
-       self->priv->resize_task = gth_original_image_task_new (GTH_IMAGE_VIEWER_PAGE (viewer_page));
-       g_signal_connect (self->priv->resize_task,
-                         "completed",
-                         G_CALLBACK (original_image_task_completed_cb),
-                         self);
-       gth_browser_exec_task (GTH_BROWSER (gth_file_tool_get_window (GTH_FILE_TOOL (self))),
-                              self->priv->resize_task,
-                              FALSE);
-}
-
-
-static void
-gth_file_tool_resize_cancel (GthFileTool *base)
-{
-       GthFileToolResize *self = (GthFileToolResize *) base;
-       GtkWidget         *window;
-       GtkWidget         *viewer_page;
 
        if (self->priv->resize_task != NULL) {
                self->priv->closing = TRUE;
@@ -803,9 +733,8 @@ gth_file_tool_resize_cancel (GthFileTool *base)
                self->priv->update_size_id = 0;
        }
 
-       window = gth_file_tool_get_window (GTH_FILE_TOOL (self));
-       viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
-       gth_image_viewer_page_reset (GTH_IMAGE_VIEWER_PAGE (viewer_page));
+       gth_image_viewer_page_reset (GTH_IMAGE_VIEWER_PAGE (gth_image_viewer_page_tool_get_page 
(GTH_IMAGE_VIEWER_PAGE_TOOL (self))));
+       gth_file_tool_hide_options (GTH_FILE_TOOL (self));
 }
 
 
@@ -821,7 +750,6 @@ gth_file_tool_resize_finalize (GObject *object)
 
        cairo_surface_destroy (self->priv->new_image);
        cairo_surface_destroy (self->priv->preview);
-       cairo_surface_destroy (self->priv->original_image);
        _g_object_unref (self->priv->builder);
        _g_object_unref (self->priv->settings);
 
@@ -833,8 +761,9 @@ gth_file_tool_resize_finalize (GObject *object)
 static void
 gth_file_tool_resize_class_init (GthFileToolResizeClass *klass)
 {
-       GObjectClass     *gobject_class;
-       GthFileToolClass *file_tool_class;
+       GObjectClass                *gobject_class;
+       GthFileToolClass            *file_tool_class;
+       GthImageViewerPageToolClass *image_viewer_page_tool_class;
 
        g_type_class_add_private (klass, sizeof (GthFileToolResizePrivate));
 
@@ -842,11 +771,11 @@ gth_file_tool_resize_class_init (GthFileToolResizeClass *klass)
        gobject_class->finalize = gth_file_tool_resize_finalize;
 
        file_tool_class = (GthFileToolClass *) klass;
-       file_tool_class->update_sensitivity = gth_file_tool_resize_update_sensitivity;
-       file_tool_class->activate = gth_file_tool_resize_activate;
-       file_tool_class->cancel = gth_file_tool_resize_cancel;
        file_tool_class->get_options = gth_file_tool_resize_get_options;
        file_tool_class->destroy_options = gth_file_tool_resize_destroy_options;
+
+       image_viewer_page_tool_class = (GthImageViewerPageToolClass *) klass;
+       image_viewer_page_tool_class->reset_image = gth_file_tool_resize_reset_image;
 }
 
 
@@ -856,7 +785,6 @@ gth_file_tool_resize_init (GthFileToolResize *self)
        self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, GTH_TYPE_FILE_TOOL_RESIZE, GthFileToolResizePrivate);
        self->priv->settings = g_settings_new (GTHUMB_RESIZE_SCHEMA);
        self->priv->builder = NULL;
-       self->priv->original_image = NULL;
        self->priv->preview = NULL;
        self->priv->new_image = NULL;
        gth_file_tool_construct (GTH_FILE_TOOL (self), "tool-resize", _("Resize..."), _("Resize"), FALSE);
diff --git a/extensions/file_tools/gth-file-tool-resize.h b/extensions/file_tools/gth-file-tool-resize.h
index 85bd109..a9c481c 100644
--- a/extensions/file_tools/gth-file-tool-resize.h
+++ b/extensions/file_tools/gth-file-tool-resize.h
@@ -23,6 +23,7 @@
 #define GTH_FILE_TOOL_RESIZE_H
 
 #include <gthumb.h>
+#include <extensions/image_viewer/image-viewer.h>
 
 G_BEGIN_DECLS
 
@@ -38,12 +39,12 @@ typedef struct _GthFileToolResizeClass GthFileToolResizeClass;
 typedef struct _GthFileToolResizePrivate GthFileToolResizePrivate;
 
 struct _GthFileToolResize {
-       GthFileTool parent_instance;
+       GthImageViewerPageTool parent_instance;
        GthFileToolResizePrivate *priv;
 };
 
 struct _GthFileToolResizeClass {
-       GthFileToolClass parent_class;
+       GthImageViewerPageToolClass parent_class;
 };
 
 GType  gth_file_tool_resize_get_type  (void);
diff --git a/extensions/file_tools/gth-file-tool-rotate-left.c 
b/extensions/file_tools/gth-file-tool-rotate-left.c
index 0f62169..048b4c5 100644
--- a/extensions/file_tools/gth-file-tool-rotate-left.c
+++ b/extensions/file_tools/gth-file-tool-rotate-left.c
@@ -26,7 +26,7 @@
 #include "gth-file-tool-rotate-left.h"
 
 
-G_DEFINE_TYPE (GthFileToolRotateLeft, gth_file_tool_rotate_left, GTH_TYPE_FILE_TOOL)
+G_DEFINE_TYPE (GthFileToolRotateLeft, gth_file_tool_rotate_left, GTH_TYPE_IMAGE_VIEWER_PAGE_TOOL)
 
 
 static gpointer
@@ -75,27 +75,11 @@ gth_file_tool_rotate_left_activate (GthFileTool *base)
 
 
 static void
-gth_file_tool_rotate_left_update_sensitivity (GthFileTool *base)
-{
-       GtkWidget *window;
-       GtkWidget *viewer_page;
-
-       window = gth_file_tool_get_window (base);
-       viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
-       if (! GTH_IS_IMAGE_VIEWER_PAGE (viewer_page))
-               gtk_widget_set_sensitive (GTK_WIDGET (base), FALSE);
-       else
-               gtk_widget_set_sensitive (GTK_WIDGET (base), TRUE);
-}
-
-
-static void
 gth_file_tool_rotate_left_class_init (GthFileToolRotateLeftClass *klass)
 {
        GthFileToolClass *file_tool_class;
 
        file_tool_class = (GthFileToolClass *) klass;
-       file_tool_class->update_sensitivity = gth_file_tool_rotate_left_update_sensitivity;
        file_tool_class->activate = gth_file_tool_rotate_left_activate;
 }
 
diff --git a/extensions/file_tools/gth-file-tool-rotate-left.h 
b/extensions/file_tools/gth-file-tool-rotate-left.h
index 8d5df1b..4d6defe 100644
--- a/extensions/file_tools/gth-file-tool-rotate-left.h
+++ b/extensions/file_tools/gth-file-tool-rotate-left.h
@@ -23,6 +23,7 @@
 #define GTH_FILE_TOOL_ROTATE_LEFT_H
 
 #include <gthumb.h>
+#include <extensions/image_viewer/image-viewer.h>
 
 G_BEGIN_DECLS
 
@@ -37,11 +38,11 @@ typedef struct _GthFileToolRotateLeft GthFileToolRotateLeft;
 typedef struct _GthFileToolRotateLeftClass GthFileToolRotateLeftClass;
 
 struct _GthFileToolRotateLeft {
-       GthFileTool parent_instance;
+       GthImageViewerPageTool parent_instance;
 };
 
 struct _GthFileToolRotateLeftClass {
-       GthFileToolClass parent_class;
+       GthImageViewerPageToolClass parent_class;
 };
 
 GType  gth_file_tool_rotate_left_get_type  (void);
diff --git a/extensions/file_tools/gth-file-tool-rotate-right.c 
b/extensions/file_tools/gth-file-tool-rotate-right.c
index ce03aa4..28c605e 100644
--- a/extensions/file_tools/gth-file-tool-rotate-right.c
+++ b/extensions/file_tools/gth-file-tool-rotate-right.c
@@ -26,7 +26,7 @@
 #include "gth-file-tool-rotate-right.h"
 
 
-G_DEFINE_TYPE (GthFileToolRotateRight, gth_file_tool_rotate_right, GTH_TYPE_FILE_TOOL)
+G_DEFINE_TYPE (GthFileToolRotateRight, gth_file_tool_rotate_right, GTH_TYPE_IMAGE_VIEWER_PAGE_TOOL)
 
 
 static gpointer
@@ -75,27 +75,11 @@ gth_file_tool_rotate_right_activate (GthFileTool *base)
 
 
 static void
-gth_file_tool_rotate_right_update_sensitivity (GthFileTool *base)
-{
-       GtkWidget *window;
-       GtkWidget *viewer_page;
-
-       window = gth_file_tool_get_window (base);
-       viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
-       if (! GTH_IS_IMAGE_VIEWER_PAGE (viewer_page))
-               gtk_widget_set_sensitive (GTK_WIDGET (base), FALSE);
-       else
-               gtk_widget_set_sensitive (GTK_WIDGET (base), TRUE);
-}
-
-
-static void
 gth_file_tool_rotate_right_class_init (GthFileToolRotateRightClass *klass)
 {
        GthFileToolClass *file_tool_class;
 
        file_tool_class = (GthFileToolClass *) klass;
-       file_tool_class->update_sensitivity = gth_file_tool_rotate_right_update_sensitivity;
        file_tool_class->activate = gth_file_tool_rotate_right_activate;
 }
 
diff --git a/extensions/file_tools/gth-file-tool-rotate-right.h 
b/extensions/file_tools/gth-file-tool-rotate-right.h
index 06e90a1..55bd64c 100644
--- a/extensions/file_tools/gth-file-tool-rotate-right.h
+++ b/extensions/file_tools/gth-file-tool-rotate-right.h
@@ -23,6 +23,7 @@
 #define GTH_FILE_TOOL_ROTATE_RIGHT_H
 
 #include <gthumb.h>
+#include <extensions/image_viewer/image-viewer.h>
 
 G_BEGIN_DECLS
 
@@ -37,11 +38,11 @@ typedef struct _GthFileToolRotateRight GthFileToolRotateRight;
 typedef struct _GthFileToolRotateRightClass GthFileToolRotateRightClass;
 
 struct _GthFileToolRotateRight {
-       GthFileTool parent_instance;
+       GthImageViewerPageTool parent_instance;
 };
 
 struct _GthFileToolRotateRightClass {
-       GthFileToolClass parent_class;
+       GthImageViewerPageToolClass parent_class;
 };
 
 GType  gth_file_tool_rotate_right_get_type  (void);
diff --git a/extensions/file_tools/gth-file-tool-rotate.c b/extensions/file_tools/gth-file-tool-rotate.c
index d820728..e1bca59 100644
--- a/extensions/file_tools/gth-file-tool-rotate.c
+++ b/extensions/file_tools/gth-file-tool-rotate.c
@@ -34,7 +34,7 @@
 #define GET_WIDGET(x) (_gtk_builder_get_widget (self->priv->builder, (x)))
 
 
-G_DEFINE_TYPE (GthFileToolRotate, gth_file_tool_rotate, GTH_TYPE_FILE_TOOL)
+G_DEFINE_TYPE (GthFileToolRotate, gth_file_tool_rotate, GTH_TYPE_IMAGE_VIEWER_PAGE_TOOL)
 
 
 struct _GthFileToolRotatePrivate {
@@ -55,21 +55,6 @@ struct _GthFileToolRotatePrivate {
 
 
 static void
-gth_file_tool_rotate_update_sensitivity (GthFileTool *base)
-{
-       GtkWidget *window;
-       GtkWidget *viewer_page;
-
-       window = gth_file_tool_get_window (base);
-       viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
-       if (! GTH_IS_IMAGE_VIEWER_PAGE (viewer_page))
-               gtk_widget_set_sensitive (GTK_WIDGET (base), FALSE);
-       else
-               gtk_widget_set_sensitive (GTK_WIDGET (base), TRUE);
-}
-
-
-static void
 update_crop_parameters (GthFileToolRotate *self)
 {
        GthTransformResize resize;
@@ -268,6 +253,9 @@ apply_button_clicked_cb (GtkButton         *button,
                                          NULL,
                                          g_object_ref (self->priv->rotator),
                                          g_object_unref);
+       gth_image_viewer_task_set_load_original (GTH_IMAGE_VIEWER_TASK (task), FALSE);
+       gth_image_task_set_source_surface (GTH_IMAGE_TASK (task), gth_image_viewer_page_tool_get_source 
(GTH_IMAGE_VIEWER_PAGE_TOOL (self)));
+
        g_signal_connect (task,
                          "completed",
                          G_CALLBACK (gth_image_viewer_task_set_destination),
@@ -397,8 +385,7 @@ gth_file_tool_rotate_get_options (GthFileTool *base)
 
        cairo_surface_destroy (self->priv->image);
 
-       viewer = gth_image_viewer_page_get_image_viewer (GTH_IMAGE_VIEWER_PAGE (viewer_page));
-       self->priv->image = gth_image_viewer_get_current_image (GTH_IMAGE_VIEWER (viewer));
+       self->priv->image = gth_image_viewer_page_tool_get_source (GTH_IMAGE_VIEWER_PAGE_TOOL (self));
        if (self->priv->image == NULL)
                return NULL;
 
@@ -464,6 +451,8 @@ gth_file_tool_rotate_get_options (GthFileTool *base)
        }
        gth_image_rotator_set_background (GTH_IMAGE_ROTATOR (self->priv->rotator), &background_color);
 
+       gth_image_viewer_page_set_image (GTH_IMAGE_VIEWER_PAGE (viewer_page), self->priv->image, FALSE);
+       viewer = gth_image_viewer_page_get_image_viewer (GTH_IMAGE_VIEWER_PAGE (viewer_page));
        gth_image_viewer_set_tool (GTH_IMAGE_VIEWER (viewer), self->priv->rotator);
        gth_viewer_page_update_sensitivity (GTH_VIEWER_PAGE (viewer_page));
 
@@ -588,22 +577,10 @@ gth_file_tool_rotate_destroy_options (GthFileTool *base)
 
 
 static void
-gth_file_tool_rotate_activate (GthFileTool *base)
+gth_file_tool_rotate_reset_image (GthImageViewerPageTool *self)
 {
-       gth_file_tool_show_options (base);
-}
-
-
-static void
-gth_file_tool_rotate_cancel (GthFileTool *base)
-{
-       GthFileToolRotate *self = (GthFileToolRotate *) base;
-       GtkWidget         *window;
-       GtkWidget         *viewer_page;
-
-       window = gth_file_tool_get_window (GTH_FILE_TOOL (self));
-       viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
-       gth_image_viewer_page_reset (GTH_IMAGE_VIEWER_PAGE (viewer_page));
+       gth_image_viewer_page_reset (GTH_IMAGE_VIEWER_PAGE (gth_image_viewer_page_tool_get_page 
(GTH_IMAGE_VIEWER_PAGE_TOOL (self))));
+       gth_file_tool_hide_options (GTH_FILE_TOOL (self));
 }
 
 
@@ -629,8 +606,9 @@ gth_file_tool_rotate_finalize (GObject *object)
 static void
 gth_file_tool_rotate_class_init (GthFileToolRotateClass *klass)
 {
-       GObjectClass     *gobject_class;
-       GthFileToolClass *file_tool_class;
+       GObjectClass                *gobject_class;
+       GthFileToolClass            *file_tool_class;
+       GthImageViewerPageToolClass *image_viewer_page_tool_class;
 
        g_type_class_add_private (klass, sizeof (GthFileToolRotatePrivate));
 
@@ -638,11 +616,11 @@ gth_file_tool_rotate_class_init (GthFileToolRotateClass *klass)
        gobject_class->finalize = gth_file_tool_rotate_finalize;
 
        file_tool_class = (GthFileToolClass *) klass;
-       file_tool_class->update_sensitivity = gth_file_tool_rotate_update_sensitivity;
-       file_tool_class->activate = gth_file_tool_rotate_activate;
-       file_tool_class->cancel = gth_file_tool_rotate_cancel;
        file_tool_class->get_options = gth_file_tool_rotate_get_options;
        file_tool_class->destroy_options = gth_file_tool_rotate_destroy_options;
+
+       image_viewer_page_tool_class = (GthImageViewerPageToolClass *) klass;
+       image_viewer_page_tool_class->reset_image = gth_file_tool_rotate_reset_image;
 }
 
 
diff --git a/extensions/file_tools/gth-file-tool-rotate.h b/extensions/file_tools/gth-file-tool-rotate.h
index 894818c..c4341c8 100644
--- a/extensions/file_tools/gth-file-tool-rotate.h
+++ b/extensions/file_tools/gth-file-tool-rotate.h
@@ -23,6 +23,7 @@
 #define GTH_FILE_TOOL_ROTATE_H
 
 #include <gthumb.h>
+#include <extensions/image_viewer/image-viewer.h>
 
 G_BEGIN_DECLS
 
@@ -38,12 +39,12 @@ typedef struct _GthFileToolRotateClass GthFileToolRotateClass;
 typedef struct _GthFileToolRotatePrivate GthFileToolRotatePrivate;
 
 struct _GthFileToolRotate {
-       GthFileTool parent_instance;
+       GthImageViewerPageTool parent_instance;
        GthFileToolRotatePrivate *priv;
 };
 
 struct _GthFileToolRotateClass {
-       GthFileToolClass parent_class;
+       GthImageViewerPageToolClass parent_class;
 };
 
 GType  gth_file_tool_rotate_get_type  (void);
diff --git a/extensions/file_tools/gth-file-tool-save-as.c b/extensions/file_tools/gth-file-tool-save-as.c
index 6354406..b77ac2c 100644
--- a/extensions/file_tools/gth-file-tool-save-as.c
+++ b/extensions/file_tools/gth-file-tool-save-as.c
@@ -24,7 +24,7 @@
 #include "gth-file-tool-save-as.h"
 
 
-G_DEFINE_TYPE (GthFileToolSaveAs, gth_file_tool_save_as, GTH_TYPE_FILE_TOOL)
+G_DEFINE_TYPE (GthFileToolSaveAs, gth_file_tool_save_as, GTH_TYPE_IMAGE_VIEWER_PAGE_TOOL)
 
 
 static void
diff --git a/extensions/file_tools/gth-file-tool-save-as.h b/extensions/file_tools/gth-file-tool-save-as.h
index b1f9052..3cfb3d9 100644
--- a/extensions/file_tools/gth-file-tool-save-as.h
+++ b/extensions/file_tools/gth-file-tool-save-as.h
@@ -23,6 +23,7 @@
 #define GTH_FILE_TOOL_SAVE_AS_H
 
 #include <gthumb.h>
+#include <extensions/image_viewer/image-viewer.h>
 
 G_BEGIN_DECLS
 
@@ -37,11 +38,11 @@ typedef struct _GthFileToolSaveAs GthFileToolSaveAs;
 typedef struct _GthFileToolSaveAsClass GthFileToolSaveAsClass;
 
 struct _GthFileToolSaveAs {
-       GthFileTool parent_instance;
+       GthImageViewerPageTool parent_instance;
 };
 
 struct _GthFileToolSaveAsClass {
-       GthFileToolClass parent_class;
+       GthImageViewerPageToolClass parent_class;
 };
 
 GType  gth_file_tool_save_as_get_type  (void);
diff --git a/extensions/file_tools/gth-file-tool-save.c b/extensions/file_tools/gth-file-tool-save.c
index 1b599b5..d339e53 100644
--- a/extensions/file_tools/gth-file-tool-save.c
+++ b/extensions/file_tools/gth-file-tool-save.c
@@ -24,7 +24,7 @@
 #include "gth-file-tool-save.h"
 
 
-G_DEFINE_TYPE (GthFileToolSave, gth_file_tool_save, GTH_TYPE_FILE_TOOL)
+G_DEFINE_TYPE (GthFileToolSave, gth_file_tool_save, GTH_TYPE_IMAGE_VIEWER_PAGE_TOOL)
 
 
 static void
diff --git a/extensions/file_tools/gth-file-tool-save.h b/extensions/file_tools/gth-file-tool-save.h
index 0f6bf21..4a5d874 100644
--- a/extensions/file_tools/gth-file-tool-save.h
+++ b/extensions/file_tools/gth-file-tool-save.h
@@ -23,6 +23,7 @@
 #define GTH_FILE_TOOL_SAVE_H
 
 #include <gthumb.h>
+#include <extensions/image_viewer/image-viewer.h>
 
 G_BEGIN_DECLS
 
@@ -37,11 +38,11 @@ typedef struct _GthFileToolSave GthFileToolSave;
 typedef struct _GthFileToolSaveClass GthFileToolSaveClass;
 
 struct _GthFileToolSave {
-       GthFileTool parent_instance;
+       GthImageViewerPageTool parent_instance;
 };
 
 struct _GthFileToolSaveClass {
-       GthFileToolClass parent_class;
+       GthImageViewerPageToolClass parent_class;
 };
 
 GType  gth_file_tool_save_get_type  (void);
diff --git a/extensions/file_tools/gth-file-tool-sharpen.c b/extensions/file_tools/gth-file-tool-sharpen.c
index a057411..043d065 100644
--- a/extensions/file_tools/gth-file-tool-sharpen.c
+++ b/extensions/file_tools/gth-file-tool-sharpen.c
@@ -46,21 +46,6 @@ struct _GthFileToolSharpenPrivate {
 };
 
 
-static void
-gth_file_tool_sharpen_update_sensitivity (GthFileTool *base)
-{
-       GtkWidget *window;
-       GtkWidget *viewer_page;
-
-       window = gth_file_tool_get_window (base);
-       viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
-       if (! GTH_IS_IMAGE_VIEWER_PAGE (viewer_page))
-               gtk_widget_set_sensitive (GTK_WIDGET (base), FALSE);
-       else
-               gtk_widget_set_sensitive (GTK_WIDGET (base), TRUE);
-}
-
-
 typedef struct {
        int    radius;
        double amount;
@@ -367,13 +352,6 @@ gth_file_tool_sharpen_destroy_options (GthFileTool *base)
 
 
 static void
-gth_file_tool_sharpen_modify_image (GthImageViewerPageTool *base)
-{
-       gth_file_tool_show_options (GTH_FILE_TOOL (base));
-}
-
-
-static void
 gth_file_tool_sharpen_reset_image (GthImageViewerPageTool *base)
 {
        GthFileToolSharpen *self = (GthFileToolSharpen *) base;
@@ -406,9 +384,9 @@ gth_file_tool_sharpen_finalize (GObject *object)
 static void
 gth_file_tool_sharpen_class_init (GthFileToolSharpenClass *klass)
 {
-       GObjectClass                    *gobject_class;
-       GthFileToolClass                *file_tool_class;
-       GthImageViewerPageToolClass     *image_viewer_page_tool_class;
+       GObjectClass                *gobject_class;
+       GthFileToolClass            *file_tool_class;
+       GthImageViewerPageToolClass *image_viewer_page_tool_class;
 
        g_type_class_add_private (klass, sizeof (GthFileToolSharpenPrivate));
 
@@ -416,12 +394,10 @@ gth_file_tool_sharpen_class_init (GthFileToolSharpenClass *klass)
        gobject_class->finalize = gth_file_tool_sharpen_finalize;
 
        file_tool_class = (GthFileToolClass *) klass;
-       file_tool_class->update_sensitivity = gth_file_tool_sharpen_update_sensitivity;
        file_tool_class->get_options = gth_file_tool_sharpen_get_options;
        file_tool_class->destroy_options = gth_file_tool_sharpen_destroy_options;
 
        image_viewer_page_tool_class = (GthImageViewerPageToolClass *) klass;
-       image_viewer_page_tool_class->modify_image = gth_file_tool_sharpen_modify_image;
        image_viewer_page_tool_class->reset_image = gth_file_tool_sharpen_reset_image;
 }
 
diff --git a/extensions/file_tools/gth-image-rotator.c b/extensions/file_tools/gth-image-rotator.c
index 5767cc5..c4a7c7b 100644
--- a/extensions/file_tools/gth-image-rotator.c
+++ b/extensions/file_tools/gth-image-rotator.c
@@ -232,10 +232,12 @@ update_image_surface (GthImageRotator *self)
        if (image == NULL)
                return;
 
-       self->priv->original_width = cairo_image_surface_get_width (image);
-       self->priv->original_height = cairo_image_surface_get_height (image);
-       width = self->priv->original_width;
-       height = self->priv->original_height;
+       if (! _cairo_image_surface_get_original_size (image, &self->priv->original_width, 
&self->priv->original_height)) {
+               self->priv->original_width = cairo_image_surface_get_width (image);
+               self->priv->original_height = cairo_image_surface_get_height (image);
+       }
+       width = cairo_image_surface_get_width (image);
+       height = cairo_image_surface_get_height (image);
        gtk_widget_get_allocation (GTK_WIDGET (self->priv->viewer), &allocation);
        max_size = MAX (allocation.width, allocation.height) / G_SQRT2 + 2;
        if (scale_keeping_ratio (&width, &height, max_size, max_size, FALSE))
@@ -280,21 +282,21 @@ static void
 paint_image (GthImageRotator *self,
             cairo_t         *cr)
 {
-       cairo_save (cr);
+       cairo_matrix_t matrix;
 
-       cairo_set_matrix (cr, &self->priv->matrix);
-       cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE);
+       cairo_save (cr);
+       cairo_get_matrix (cr, &matrix);
+       cairo_matrix_multiply (&matrix, &self->priv->matrix, &matrix);
+       cairo_set_matrix (cr, &matrix);
        cairo_set_source_surface (cr, self->priv->preview_image,
                                  self->priv->preview_image_area.x,
                                  self->priv->preview_image_area.y);
-       cairo_pattern_set_filter (cairo_get_source (cr), CAIRO_FILTER_FAST);
        cairo_rectangle (cr,
                         self->priv->preview_image_area.x,
                         self->priv->preview_image_area.y,
                         self->priv->preview_image_area.width,
                         self->priv->preview_image_area.height);
        cairo_fill (cr);
-
        cairo_restore (cr);
 }
 
@@ -446,6 +448,7 @@ gth_image_rotator_draw (GthImageViewerTool *base,
                               self->priv->background_color.blue,
                               self->priv->background_color.alpha);
        cairo_fill (cr);
+       cairo_restore (cr);
 
        if (self->priv->preview_image == NULL)
                return;
@@ -457,8 +460,10 @@ gth_image_rotator_draw (GthImageViewerTool *base,
        if (self->priv->dragging) {
                GdkPoint center;
 
+               cairo_save (cr);
                cairo_set_antialias (cr, CAIRO_ANTIALIAS_DEFAULT);
                cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
+               cairo_restore (cr);
 
                center.x = self->priv->center.x * self->priv->preview_zoom + self->priv->preview_image_area.x;
                center.y = self->priv->center.y * self->priv->preview_zoom + self->priv->preview_image_area.y;
@@ -469,8 +474,6 @@ gth_image_rotator_draw (GthImageViewerTool *base,
                paint_point (self, cr, &self->priv->drag_p2);
                */
        }
-
-       cairo_restore (cr);
 }
 
 
diff --git a/extensions/image_viewer/gth-image-viewer-page-tool.c 
b/extensions/image_viewer/gth-image-viewer-page-tool.c
index 443c508..b7c12ff 100644
--- a/extensions/image_viewer/gth-image-viewer-page-tool.c
+++ b/extensions/image_viewer/gth-image-viewer-page-tool.c
@@ -43,7 +43,7 @@ original_image_task_completed_cb (GthTask  *task,
        self->priv->image_task = NULL;
 
        if (gth_file_tool_is_cancelled (GTH_FILE_TOOL (self))) {
-               GTH_IMAGE_VIEWER_PAGE_TOOL_GET_CLASS (self)->reset_image (self);
+               gth_image_viewer_page_tool_reset_image (self);
                g_object_unref (task);
                return;
        }
@@ -54,10 +54,8 @@ original_image_task_completed_cb (GthTask  *task,
        }
 
        self->priv->source = gth_original_image_task_get_image (task);
-       if (self->priv->source != NULL) {
+       if (self->priv->source != NULL)
                GTH_IMAGE_VIEWER_PAGE_TOOL_GET_CLASS (self)->modify_image (self);
-               /*gth_file_tool_show_options (GTH_FILE_TOOL (self)); FIXME */
-       }
 
        g_object_unref (task);
 }
@@ -103,16 +101,26 @@ gth_image_viewer_page_tool_cancel (GthFileTool *base)
 
 
 static void
+gth_image_viewer_page_tool_update_sensitivity (GthFileTool *base)
+{
+       GtkWidget *viewer_page;
+
+       viewer_page = gth_image_viewer_page_tool_get_page (GTH_IMAGE_VIEWER_PAGE_TOOL (base));
+       gtk_widget_set_sensitive (GTK_WIDGET (base), viewer_page != NULL);
+}
+
+
+static void
 base_modify_image (GthImageViewerPageTool *self)
 {
-       /* virtual */
+       gth_file_tool_show_options (GTH_FILE_TOOL (self));
 }
 
 
 static void
 base_reset_image (GthImageViewerPageTool *self)
 {
-       /* virtual */
+       gth_file_tool_hide_options (GTH_FILE_TOOL (self));
 }
 
 
@@ -147,6 +155,7 @@ gth_image_viewer_page_tool_class_init (GthImageViewerPageToolClass *klass)
        file_tool_class = (GthFileToolClass *) klass;
        file_tool_class->activate = gth_image_viewer_page_tool_activate;
        file_tool_class->cancel = gth_image_viewer_page_tool_cancel;
+       file_tool_class->update_sensitivity = gth_image_viewer_page_tool_update_sensitivity;
 
        klass->modify_image = base_modify_image;
        klass->reset_image = base_reset_image;
diff --git a/extensions/image_viewer/gth-image-viewer-page.c b/extensions/image_viewer/gth-image-viewer-page.c
index 999cfe4..3b0c72c 100644
--- a/extensions/image_viewer/gth-image-viewer-page.c
+++ b/extensions/image_viewer/gth-image-viewer-page.c
@@ -1907,7 +1907,7 @@ gth_original_image_task_exec (GthTask *base)
 {
        GthOriginalImageTask *self = GTH_ORIGINAL_IMAGE_TASK (base);
 
-       gth_task_progress (base, _("Loading the image"), NULL, TRUE, 0.0);
+       gth_task_progress (base, _("Loading the original image"), NULL, TRUE, 0.0);
        gth_image_viewer_page_get_original (self->viewer_page,
                                            gth_task_get_cancellable (base),
                                            get_original_image_ready_cb,


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