[epiphany/overview] ephy-window: toggle the overview on alt+home



commit 79c8d97c7f90517268a73511f74895de503ada06
Author: Claudio Saavedra <csaavedra igalia com>
Date:   Wed Aug 8 16:01:55 2012 +0300

    ephy-window: toggle the overview on alt+home
    
    Connect sensitivity of the 'Pages' button directly with the
    overview-mode property and change the action associated to it to
    toggle the overview instead. This way even if the button is
    insensitive, the overview can be hidden using the same associated
    shortcut.

 src/ephy-toolbar.c    |    4 ++++
 src/ephy-window.c     |    9 ++-------
 src/window-commands.c |    7 ++++---
 src/window-commands.h |    4 ++--
 4 files changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/src/ephy-toolbar.c b/src/ephy-toolbar.c
index 24df817..421311a 100644
--- a/src/ephy-toolbar.c
+++ b/src/ephy-toolbar.c
@@ -149,6 +149,10 @@ ephy_toolbar_constructed (GObject *object)
   gtk_container_add (GTK_CONTAINER (toolbar), GTK_WIDGET (tool_item));
   gtk_widget_show_all (GTK_WIDGET (tool_item));
   gtk_widget_set_margin_right (GTK_WIDGET (tool_item), 12);
+	g_object_bind_property (priv->window, "overview-mode",
+                          tool_button, "sensitive",
+                          G_BINDING_SYNC_CREATE
+                          | G_BINDING_INVERT_BOOLEAN);
 
   /* Location and Reload/Stop */
   location_stop_reload = gtk_tool_item_new ();
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 5c09790..a258bb5 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -1352,10 +1352,10 @@ setup_ui_manager (EphyWindow *window)
 	action_group = gtk_action_group_new ("SpecialToolbarActions");
 	action = GTK_ACTION (gtk_action_new ("ViewOverviewMode",
 					     _("Pages"),
-					     _("Shows the pages overview"),
+					     _("Toggles the pages overview"),
 					     NULL));
 	g_signal_connect (action, "activate",
-			  G_CALLBACK (window_cmd_show_overview),
+			  G_CALLBACK (window_cmd_toggle_overview),
 			  window);
 	gtk_action_group_add_action_with_accel (action_group, action,
 						"<alt>Home");
@@ -3590,11 +3590,6 @@ ephy_window_constructor (GType type,
 				| G_BINDING_BIDIRECTIONAL);
 	action = gtk_action_group_get_action (window->priv->toolbar_action_group,
 					      "ViewOverviewMode");
-	g_object_bind_property (window, "overview-mode",
-				action, "sensitive",
-				G_BINDING_SYNC_CREATE
-				| G_BINDING_INVERT_BOOLEAN
-				| G_BINDING_BIDIRECTIONAL);
 
 	priv->downloads_box = setup_downloads_box (window);
 	gtk_box_pack_start (GTK_BOX (priv->main_vbox),
diff --git a/src/window-commands.c b/src/window-commands.c
index b43208b..7173f37 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -1534,8 +1534,9 @@ window_cmd_browse_with_caret (GtkAction *action,
 }
 
 void
-window_cmd_show_overview (GtkAction *action,
-			  EphyWindow *window)
+window_cmd_toggle_overview (GtkAction *action,
+			    EphyWindow *window)
 {
-	ephy_window_set_overview_mode (window, TRUE);
+	ephy_window_set_overview_mode (window,
+				       !ephy_window_get_overview_mode (window));
 }
diff --git a/src/window-commands.h b/src/window-commands.h
index ccb6b33..06b4692 100644
--- a/src/window-commands.h
+++ b/src/window-commands.h
@@ -100,8 +100,8 @@ void window_cmd_load_location            (GtkAction  *action,
                                           EphyWindow *window);
 void window_cmd_browse_with_caret        (GtkAction  *action,
                                           EphyWindow *window);
-void window_cmd_show_overview            (GtkAction *action,
-                                          EphyWindow *window);
+void window_cmd_toggle_overview          (GtkAction *action,
+					  EphyWindow *window);
 
 G_END_DECLS
 



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