From 224bb2418135604c08e0918c2757bd6b52882acb Mon Sep 17 00:00:00 2001 From: Xan Lopez Date: Fri, 27 Jan 2012 22:49:51 +0100 Subject: 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 file changed, 6 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/ephy-window.c b/src/ephy-window.c index 6ee99613d..26e7a825f 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -1516,47 +1516,23 @@ sync_tab_icon (EphyWebView *view, _ephy_window_action_set_favicon (window, icon); } -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 -- cgit v1.2.3