[gthumb] reset the default viewer tool after closing an editor tool



commit c9832241dd9ac8925390cc976871c5a023c2f4f6
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Thu Oct 31 16:34:37 2013 +0100

    reset the default viewer tool after closing an editor tool

 .../file_tools/gth-file-tool-adjust-colors.c       |    4 +---
 extensions/file_tools/gth-file-tool-crop.c         |    5 +++--
 extensions/file_tools/gth-file-tool-grayscale.c    |    4 +---
 extensions/file_tools/gth-file-tool-resize.c       |    4 ++--
 extensions/file_tools/gth-file-tool-rotate.c       |    4 +---
 extensions/image_viewer/gth-image-viewer-page.c    |   16 ++++++++++++----
 extensions/image_viewer/gth-image-viewer-page.h    |    1 +
 extensions/red_eye_removal/gth-file-tool-red-eye.c |    4 +---
 8 files changed, 22 insertions(+), 20 deletions(-)
---
diff --git a/extensions/file_tools/gth-file-tool-adjust-colors.c 
b/extensions/file_tools/gth-file-tool-adjust-colors.c
index 9359953..26a8376 100644
--- a/extensions/file_tools/gth-file-tool-adjust-colors.c
+++ b/extensions/file_tools/gth-file-tool-adjust-colors.c
@@ -529,7 +529,6 @@ gth_file_tool_adjust_colors_destroy_options (GthFileTool *base)
 {
        GthFileToolAdjustColors *self;
        GtkWidget               *viewer_page;
-       GtkWidget               *viewer;
 
        self = (GthFileToolAdjustColors *) base;
 
@@ -539,8 +538,7 @@ gth_file_tool_adjust_colors_destroy_options (GthFileTool *base)
        }
 
        viewer_page = gth_image_viewer_page_tool_get_page (GTH_IMAGE_VIEWER_PAGE_TOOL (self));
-       viewer = gth_image_viewer_page_get_image_viewer (GTH_IMAGE_VIEWER_PAGE (viewer_page));
-       gth_image_viewer_set_tool (GTH_IMAGE_VIEWER (viewer), NULL);
+       gth_image_viewer_page_reset_viewer_tool (GTH_IMAGE_VIEWER_PAGE (viewer_page));
        gth_viewer_page_update_sensitivity (GTH_VIEWER_PAGE (viewer_page));
 
        _cairo_clear_surface (&self->priv->preview);
diff --git a/extensions/file_tools/gth-file-tool-crop.c b/extensions/file_tools/gth-file-tool-crop.c
index 2442966..a0b03d9 100644
--- a/extensions/file_tools/gth-file-tool-crop.c
+++ b/extensions/file_tools/gth-file-tool-crop.c
@@ -636,10 +636,11 @@ gth_file_tool_crop_destroy_options (GthFileTool *base)
 
        window = gth_file_tool_get_window (GTH_FILE_TOOL (self));
        viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
-       viewer = gth_image_viewer_page_get_image_viewer (GTH_IMAGE_VIEWER_PAGE (viewer_page));
-       gth_image_viewer_set_tool (GTH_IMAGE_VIEWER (viewer), NULL);
+       gth_image_viewer_page_reset_viewer_tool (GTH_IMAGE_VIEWER_PAGE (viewer_page));
 
        /* restore the zoom quality */
+
+       viewer = gth_image_viewer_page_get_image_viewer (GTH_IMAGE_VIEWER_PAGE (viewer_page));
        viewer_settings = g_settings_new (GTHUMB_IMAGE_VIEWER_SCHEMA);
        gth_image_viewer_set_zoom_quality (GTH_IMAGE_VIEWER (viewer),
                                           g_settings_get_enum (viewer_settings, 
PREF_IMAGE_VIEWER_ZOOM_QUALITY));
diff --git a/extensions/file_tools/gth-file-tool-grayscale.c b/extensions/file_tools/gth-file-tool-grayscale.c
index 434a7b8..4af065a 100644
--- a/extensions/file_tools/gth-file-tool-grayscale.c
+++ b/extensions/file_tools/gth-file-tool-grayscale.c
@@ -401,7 +401,6 @@ gth_file_tool_grayscale_destroy_options (GthFileTool *base)
        GthFileToolGrayscale *self;
        GtkWidget             *window;
        GtkWidget             *viewer_page;
-       GtkWidget             *viewer;
 
        self = (GthFileToolGrayscale *) base;
 
@@ -412,8 +411,7 @@ gth_file_tool_grayscale_destroy_options (GthFileTool *base)
 
        window = gth_file_tool_get_window (GTH_FILE_TOOL (self));
        viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
-       viewer = gth_image_viewer_page_get_image_viewer (GTH_IMAGE_VIEWER_PAGE (viewer_page));
-       gth_image_viewer_set_tool (GTH_IMAGE_VIEWER (viewer), NULL);
+       gth_image_viewer_page_reset_viewer_tool (GTH_IMAGE_VIEWER_PAGE (viewer_page));
        gth_viewer_page_update_sensitivity (GTH_VIEWER_PAGE (viewer_page));
 
        _cairo_clear_surface (&self->priv->preview);
diff --git a/extensions/file_tools/gth-file-tool-resize.c b/extensions/file_tools/gth-file-tool-resize.c
index 0e01692..971a493 100644
--- a/extensions/file_tools/gth-file-tool-resize.c
+++ b/extensions/file_tools/gth-file-tool-resize.c
@@ -728,11 +728,11 @@ gth_file_tool_resize_destroy_options (GthFileTool *base)
 
        window = gth_file_tool_get_window (GTH_FILE_TOOL (self));
        viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
-       viewer = gth_image_viewer_page_get_image_viewer (GTH_IMAGE_VIEWER_PAGE (viewer_page));
-       gth_image_viewer_set_tool (GTH_IMAGE_VIEWER (viewer), NULL);
+       gth_image_viewer_page_reset_viewer_tool (GTH_IMAGE_VIEWER_PAGE (viewer_page));
 
        /* restore the zoom quality */
 
+       viewer = gth_image_viewer_page_get_image_viewer (GTH_IMAGE_VIEWER_PAGE (viewer_page));
        viewer_settings = g_settings_new (GTHUMB_IMAGE_VIEWER_SCHEMA);
        gth_image_viewer_set_zoom_quality (GTH_IMAGE_VIEWER (viewer),
                                           g_settings_get_enum (viewer_settings, 
PREF_IMAGE_VIEWER_ZOOM_QUALITY));
diff --git a/extensions/file_tools/gth-file-tool-rotate.c b/extensions/file_tools/gth-file-tool-rotate.c
index c4a6d5e..14bb4df 100644
--- a/extensions/file_tools/gth-file-tool-rotate.c
+++ b/extensions/file_tools/gth-file-tool-rotate.c
@@ -565,7 +565,6 @@ gth_file_tool_rotate_destroy_options (GthFileTool *base)
        GthFileToolRotate *self;
        GtkWidget         *window;
        GtkWidget         *viewer_page;
-       GtkWidget         *viewer;
 
        self = (GthFileToolRotate *) base;
 
@@ -588,8 +587,7 @@ gth_file_tool_rotate_destroy_options (GthFileTool *base)
 
        window = gth_file_tool_get_window (GTH_FILE_TOOL (self));
        viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
-       viewer = gth_image_viewer_page_get_image_viewer (GTH_IMAGE_VIEWER_PAGE (viewer_page));
-       gth_image_viewer_set_tool (GTH_IMAGE_VIEWER (viewer), NULL);
+       gth_image_viewer_page_reset_viewer_tool (GTH_IMAGE_VIEWER_PAGE (viewer_page));
        gth_viewer_page_update_sensitivity (GTH_VIEWER_PAGE (viewer_page));
 
        cairo_surface_destroy (self->priv->image);
diff --git a/extensions/image_viewer/gth-image-viewer-page.c b/extensions/image_viewer/gth-image-viewer-page.c
index f5fb1a2..9b2ea4c 100644
--- a/extensions/image_viewer/gth-image-viewer-page.c
+++ b/extensions/image_viewer/gth-image-viewer-page.c
@@ -639,10 +639,7 @@ gth_image_viewer_page_real_activate (GthViewerPage *base,
                                          g_settings_get_enum (self->priv->settings, 
PREF_IMAGE_VIEWER_ZOOM_CHANGE));
        gth_image_viewer_set_reset_scrollbars (GTH_IMAGE_VIEWER (self->priv->viewer),
                                               g_settings_get_boolean (self->priv->settings, 
PREF_IMAGE_VIEWER_RESET_SCROLLBARS));
-
-       dragger = gth_image_dragger_new (TRUE);
-       gth_image_viewer_set_tool (GTH_IMAGE_VIEWER (self->priv->viewer), dragger);
-       g_object_unref (dragger);
+       gth_image_viewer_page_reset_viewer_tool (self);
 
        gtk_widget_show (self->priv->viewer);
 
@@ -1514,6 +1511,17 @@ gth_image_viewer_page_reset (GthImageViewerPage *self)
 }
 
 
+void
+gth_image_viewer_page_reset_viewer_tool        (GthImageViewerPage *self)
+{
+       GthImageViewerTool *dragger;
+
+       dragger = gth_image_dragger_new (TRUE);
+       gth_image_viewer_set_tool (GTH_IMAGE_VIEWER (self->priv->viewer), dragger);
+       g_object_unref (dragger);
+}
+
+
 gboolean
 gth_image_viewer_page_get_is_modified (GthImageViewerPage *self)
 {
diff --git a/extensions/image_viewer/gth-image-viewer-page.h b/extensions/image_viewer/gth-image-viewer-page.h
index 01dd37c..c32bf3f 100644
--- a/extensions/image_viewer/gth-image-viewer-page.h
+++ b/extensions/image_viewer/gth-image-viewer-page.h
@@ -61,6 +61,7 @@ void               gth_image_viewer_page_undo                 (GthImageViewerPage      
*page);
 void               gth_image_viewer_page_redo                  (GthImageViewerPage      *page);
 GthImageHistory *  gth_image_viewer_page_get_history           (GthImageViewerPage      *self);
 void               gth_image_viewer_page_reset                 (GthImageViewerPage      *self);
+void               gth_image_viewer_page_reset_viewer_tool     (GthImageViewerPage      *self);
 gboolean           gth_image_viewer_page_get_is_modified        (GthImageViewerPage     *self);
 void               gth_image_viewer_page_copy_image            (GthImageViewerPage      *self);
 void               gth_image_viewer_page_paste_image           (GthImageViewerPage      *self);
diff --git a/extensions/red_eye_removal/gth-file-tool-red-eye.c 
b/extensions/red_eye_removal/gth-file-tool-red-eye.c
index d1ca226..2ff44fc 100644
--- a/extensions/red_eye_removal/gth-file-tool-red-eye.c
+++ b/extensions/red_eye_removal/gth-file-tool-red-eye.c
@@ -419,14 +419,12 @@ gth_file_tool_red_eye_destroy_options (GthFileTool *base)
        GthFileToolRedEye *self;
        GtkWidget         *window;
        GtkWidget         *viewer_page;
-       GtkWidget         *viewer;
 
        self = (GthFileToolRedEye *) base;
 
        window = gth_file_tool_get_window (GTH_FILE_TOOL (self));
        viewer_page = gth_browser_get_viewer_page (GTH_BROWSER (window));
-       viewer = gth_image_viewer_page_get_image_viewer (GTH_IMAGE_VIEWER_PAGE (viewer_page));
-       gth_image_viewer_set_tool (GTH_IMAGE_VIEWER (viewer), NULL);
+       gth_image_viewer_page_reset_viewer_tool (GTH_IMAGE_VIEWER_PAGE (viewer_page));
 
        _g_object_unref (self->priv->builder);
        _g_object_unref (self->priv->selector);


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