[epiphany] ephy-window: add a method to toggle visibility of default actions



commit 373899ffdddc869f3852b04e058ac82c9deac2ba
Author: Claudio Saavedra <csaavedra igalia com>
Date:   Wed May 9 19:06:18 2012 +0300

    ephy-window: add a method to toggle visibility of default actions
    
    Where default actions are the ones that should be disabled when we
    display a blank page or anything that is not a webpage.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=678405

 src/ephy-window.c |   30 +++++++++++++++++++-----------
 1 files changed, 19 insertions(+), 11 deletions(-)
---
diff --git a/src/ephy-window.c b/src/ephy-window.c
index c7c6728..d80ea26 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -1571,14 +1571,13 @@ sync_tab_navigation (EphyWebView *view,
 }
 
 static void
-sync_tab_is_blank (EphyWebView *view,
-		   GParamSpec *pspec,
-		   EphyWindow *window)
+_ephy_window_set_default_actions_sensitive (EphyWindow *window,
+					    guint flags,
+					    gboolean set)
 {
 	EphyWindowPrivate *priv = window->priv;
 	GtkActionGroup *action_group;
 	GtkAction *action;
-	gboolean is_blank = TRUE;
 	int i;
 	const char *action_group_actions[] = { "FileSaveAs", "FileSaveAsApplication", "FilePrint",
 					       "FileSendTo", "FileBookmarkPage", "EditFind",
@@ -1586,9 +1585,6 @@ sync_tab_is_blank (EphyWebView *view,
 					       "ViewZoomIn", "ViewZoomOut", "ViewPageSource",
 					       NULL };
 
-	if (window->priv->closing) return;
-
-	is_blank = ephy_web_view_get_is_blank (view);
 	action_group = priv->action_group;
 
 	/* Page menu */
@@ -1597,25 +1593,37 @@ sync_tab_is_blank (EphyWebView *view,
 		action = gtk_action_group_get_action (action_group,
 						      action_group_actions[i]);
 		ephy_action_change_sensitivity_flags (action,
-						      SENS_FLAG_IS_BLANK, is_blank);
+						      flags, set);
 	}
 
 	/* Page context popup */
 	action = gtk_action_group_get_action (priv->popups_action_group,
 					      "ContextBookmarkPage");
 	ephy_action_change_sensitivity_flags (action,
-					      SENS_FLAG_IS_BLANK, is_blank);
+					      flags, set);
 
 	action = gtk_action_group_get_action (priv->popups_action_group,
 					      "InspectElement");
 	ephy_action_change_sensitivity_flags (action,
-					      SENS_FLAG_IS_BLANK, is_blank);
+					      flags, set);
 
 	/* Toolbar */
 	action = gtk_action_group_get_action (priv->toolbar_action_group,
 					      "ViewCombinedStopReload");
 	ephy_action_change_sensitivity_flags (action,
-					      SENS_FLAG_IS_BLANK, is_blank);
+					      flags, set);
+}
+
+static void
+sync_tab_is_blank (EphyWebView *view,
+		   GParamSpec *pspec,
+		   EphyWindow *window)
+{
+	if (window->priv->closing) return;
+
+	_ephy_window_set_default_actions_sensitive (window,
+						    SENS_FLAG_IS_BLANK,
+						    ephy_web_view_get_is_blank (view));
 }
 
 static void



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