[gthumb] "Esc" hides the file tool options if activated



commit 32827d70a2cd705f4448ca7ac9522fac8a009518
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sun Feb 21 15:58:11 2010 +0100

    "Esc" hides the file tool options if activated

 gthumb/gth-browser-actions-callbacks.c |   11 +++++++++--
 gthumb/gth-sidebar.c                   |    7 +++++++
 gthumb/gth-sidebar.h                   |    1 +
 3 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/gthumb/gth-browser-actions-callbacks.c b/gthumb/gth-browser-actions-callbacks.c
index 5f46dd1..c0f0aef 100644
--- a/gthumb/gth-browser-actions-callbacks.c
+++ b/gthumb/gth-browser-actions-callbacks.c
@@ -34,8 +34,9 @@
 #include "gth-folder-tree.h"
 #include "gth-main.h"
 #include "gth-preferences.h"
-#include "gth-viewer-page.h"
+#include "gth-sidebar.h"
 #include "gtk-utils.h"
+#include "gth-viewer-page.h"
 
 
 void
@@ -313,7 +314,13 @@ void
 gth_browser_activate_action_browser_mode (GtkAction  *action,
 					  GthBrowser *browser)
 {
-	gth_window_set_current_page (GTH_WINDOW (browser), GTH_BROWSER_PAGE_BROWSER);
+	GtkWidget *viewer_sidebar;
+
+	viewer_sidebar = gth_browser_get_viewer_sidebar (browser);
+	if (gth_sidebar_is_tool_active (GTH_SIDEBAR (viewer_sidebar)))
+		gth_sidebar_deactivate_tool (GTH_SIDEBAR (viewer_sidebar));
+	else
+		gth_window_set_current_page (GTH_WINDOW (browser), GTH_BROWSER_PAGE_BROWSER);
 }
 
 
diff --git a/gthumb/gth-sidebar.c b/gthumb/gth-sidebar.c
index 8727875..f3ce934 100644
--- a/gthumb/gth-sidebar.c
+++ b/gthumb/gth-sidebar.c
@@ -187,6 +187,13 @@ gth_sidebar_is_tool_active (GthSidebar *sidebar)
 
 
 void
+gth_sidebar_deactivate_tool (GthSidebar *sidebar)
+{
+	gth_toolbox_deactivate_tool (GTH_TOOLBOX (sidebar->priv->toolbox));
+}
+
+
+void
 gth_sidebar_update_sensitivity (GthSidebar *sidebar)
 {
 	gth_toolbox_update_sensitivity (GTH_TOOLBOX (sidebar->priv->toolbox));
diff --git a/gthumb/gth-sidebar.h b/gthumb/gth-sidebar.h
index 4fe45b1..a36cab4 100644
--- a/gthumb/gth-sidebar.h
+++ b/gthumb/gth-sidebar.h
@@ -71,6 +71,7 @@ void           gth_sidebar_set_file            (GthSidebar      *sidebar,
 void           gth_sidebar_show_properties     (GthSidebar      *sidebar);
 void           gth_sidebar_show_tools          (GthSidebar      *sidebar);
 gboolean       gth_sidebar_is_tool_active      (GthSidebar      *sidebar);
+void           gth_sidebar_deactivate_tool     (GthSidebar      *sidebar);
 void           gth_sidebar_update_sensitivity  (GthSidebar      *sidebar);
 
 GType          gth_property_view_get_type      (void);



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