[epiphany] ephy-window: simplify handling of back/forward sensitivity



commit 224bb2418135604c08e0918c2757bd6b52882acb
Author: Xan Lopez <xan igalia com>
Date:   Fri Jan 27 22:49:51 2012 +0100

    ephy-window: simplify handling of back/forward sensitivity
    
    Back/Forward sensitivity only depends on one factor (whether you can
    actually go back or forward), so there is no need to use the ephy
    action helper method. This allows to simplify the code quite a bit.

 src/ephy-window.c |   36 ++++++------------------------------
 1 files changed, 6 insertions(+), 30 deletions(-)
---
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 6ee9961..26e7a82 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -1517,46 +1517,22 @@ sync_tab_icon (EphyWebView *view,
 }
 
 static void
-_ephy_window_set_navigation_actions (EphyWindow *window,
-				     gboolean back,
-				     gboolean forward,
-				     gboolean up)
-{
-	EphyWindowPrivate *priv = window->priv;
-	GtkAction *action;
-
-	action = gtk_action_group_get_action (priv->toolbar_action_group, "NavigationBack");
-	ephy_action_change_sensitivity_flags (action, SENS_FLAG, !back);
-	action = gtk_action_group_get_action (priv->toolbar_action_group, "NavigationForward");
-	ephy_action_change_sensitivity_flags (action, SENS_FLAG, !forward);
-}
-
-static void
 sync_tab_navigation (EphyWebView *view,
 		     GParamSpec *pspec,
 		     EphyWindow *window)
 {
 	EphyWebViewNavigationFlags flags;
-	gboolean up = FALSE, back = FALSE, forward = FALSE;
+	GtkAction *action;
+	EphyWindowPrivate *priv = window->priv;
 
 	if (window->priv->closing) return;
 
 	flags = ephy_web_view_get_navigation_flags (view);
 
-	if (flags & EPHY_WEB_VIEW_NAV_UP)
-	{
-		up = TRUE;
-	}
-	if (flags & EPHY_WEB_VIEW_NAV_BACK)
-	{
-		back = TRUE;
-	}
-	if (flags & EPHY_WEB_VIEW_NAV_FORWARD)
-	{
-		forward = TRUE;
-	}
-
-	_ephy_window_set_navigation_actions (window, back, forward, up);
+	action = gtk_action_group_get_action (priv->toolbar_action_group, "NavigationBack");
+	gtk_action_set_sensitive (action, flags & EPHY_WEB_VIEW_NAV_BACK);
+	action = gtk_action_group_get_action (priv->toolbar_action_group, "NavigationForward");
+	gtk_action_set_sensitive (action, flags & EPHY_WEB_VIEW_NAV_FORWARD);
 }
 
 static void



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