[epiphany] Disable actions that open new windows



commit 76ac0b28bc4bcb513bf1da6e921ba5a606225c45
Author: Carlos Garcia Campos <cgarcia igalia com>
Date:   Wed Feb 12 12:40:32 2014 +0100

    Disable actions that open new windows

 src/bookmarks/ephy-bookmarks-editor.c |    5 ++++-
 src/ephy-lockdown.c                   |    8 ++++++--
 src/ephy-shell.c                      |    9 ++++-----
 src/ephy-window.c                     |    8 ++++++--
 4 files changed, 20 insertions(+), 10 deletions(-)
---
diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c
index 48b7143..560d1b1 100644
--- a/src/bookmarks/ephy-bookmarks-editor.c
+++ b/src/bookmarks/ephy-bookmarks-editor.c
@@ -1082,6 +1082,7 @@ ephy_bookmarks_editor_update_menu (EphyBookmarksEditor *editor)
        gboolean key_normal = FALSE;
        gboolean cut, copy, paste, select_all;
        gboolean mutable = TRUE;
+        gboolean fullscreen_lockdown;
 
        GtkActionGroup *action_group;
        GtkAction *action;
@@ -1171,7 +1172,9 @@ ephy_bookmarks_editor_update_menu (EphyBookmarksEditor *editor)
                copy_label = _("_Copy");
        }
 
-       open_in_window = (bmk_focus && bmk_selection);
+        fullscreen_lockdown = g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
+                                                      EPHY_PREFS_LOCKDOWN_FULLSCREEN);
+       open_in_window = (bmk_focus && bmk_selection && !fullscreen_lockdown);
        open_in_tab = (bmk_focus && bmk_selection);
        rename = (bmk_focus && single_bmk_selected && mutable) ||
                 (key_selection && key_focus && key_normal);
diff --git a/src/ephy-lockdown.c b/src/ephy-lockdown.c
index 0acaba6..b60dbdd 100644
--- a/src/ephy-lockdown.c
+++ b/src/ephy-lockdown.c
@@ -103,13 +103,17 @@ static const BindAction window_actions[] = {
   { EPHY_PREFS_LOCKDOWN_SAVE_TO_DISK, "FileSaveAs", "sensitive" },
 
   { EPHY_PREFS_LOCKDOWN_FULLSCREEN, "ViewFullscreen", "sensitive" },
-  { EPHY_PREFS_LOCKDOWN_FULLSCREEN, "TabsDetach", "sensitive" }
+  { EPHY_PREFS_LOCKDOWN_FULLSCREEN, "TabsDetach", "sensitive" },
+  { EPHY_PREFS_LOCKDOWN_FULLSCREEN, "FileNewWindow", "sensitive" },
+  { EPHY_PREFS_LOCKDOWN_FULLSCREEN, "FileNewWindowIncognito", "sensitive" }
 };
 
 static const BindAction popup_actions[] = {
   { EPHY_PREFS_LOCKDOWN_SAVE_TO_DISK, "DownloadLinkAs", "sensitive" },
   { EPHY_PREFS_LOCKDOWN_SAVE_TO_DISK, "SaveImageAs", "sensitive" },
-  { EPHY_PREFS_LOCKDOWN_BOOKMARK_EDITING, "ContextBookmarkPage", "sensitive" }
+  { EPHY_PREFS_LOCKDOWN_BOOKMARK_EDITING, "ContextBookmarkPage", "sensitive" },
+
+  { EPHY_PREFS_LOCKDOWN_FULLSCREEN, "OpenLinkInNewWindow", "sensitive" }
 };
 
 static const BindAction special_toolbar_actions[] = {
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 9b66551..7c4699c 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -668,7 +668,6 @@ ephy_shell_new_tab_full (EphyShell *shell,
   EphyEmbedShell *embed_shell;
   EphyWindow *window;
   EphyEmbed *embed = NULL;
-  gboolean fullscreen_lockdown = FALSE;
   gboolean in_new_window = TRUE;
   gboolean open_page = FALSE;
   gboolean delayed_open_page = FALSE;
@@ -690,9 +689,6 @@ ephy_shell_new_tab_full (EphyShell *shell,
   if (flags & EPHY_NEW_TAB_IN_EXISTING_WINDOW) in_new_window = FALSE;
   if (flags & EPHY_NEW_TAB_JUMP) jump_to = TRUE;
 
-  fullscreen_lockdown = g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
-                                                EPHY_PREFS_LOCKDOWN_FULLSCREEN);
-  in_new_window = in_new_window && !fullscreen_lockdown;
   g_return_val_if_fail ((open_page || delayed_open_page) == (gboolean)(request != NULL), NULL);
 
   LOG ("Opening new tab parent-window %p parent-embed %p in-new-window:%s jump-to:%s",
@@ -1065,6 +1061,7 @@ open_uris_data_new (EphyShell *shell,
 {
   OpenURIsData *data;
   gboolean new_windows_in_tabs;
+  gboolean fullscreen_lockdown;
   gboolean have_uris;
 
   data = g_slice_new0 (OpenURIsData);
@@ -1077,13 +1074,15 @@ open_uris_data_new (EphyShell *shell,
 
   new_windows_in_tabs = g_settings_get_boolean (EPHY_SETTINGS_MAIN,
                                                 EPHY_PREFS_NEW_WINDOWS_IN_TABS);
+  fullscreen_lockdown = g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
+                                                EPHY_PREFS_LOCKDOWN_FULLSCREEN);
 
   have_uris = ! (g_strv_length ((char **)uris) == 1 && g_str_equal (uris[0], ""));
 
   if (startup_flags & EPHY_STARTUP_NEW_TAB)
     data->flags |= EPHY_NEW_TAB_FROM_EXTERNAL;
 
-  if (startup_flags & EPHY_STARTUP_NEW_WINDOW) {
+  if (startup_flags & EPHY_STARTUP_NEW_WINDOW && !fullscreen_lockdown) {
     data->window = NULL;
     data->flags |= EPHY_NEW_TAB_IN_NEW_WINDOW;
   } else if (startup_flags & EPHY_STARTUP_NEW_TAB || (new_windows_in_tabs && have_uris)) {
diff --git a/src/ephy-window.c b/src/ephy-window.c
index 6f04f17..a7c8c1d 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -2026,7 +2026,9 @@ create_web_view_cb (WebKitWebView *web_view,
        EphyWindow *parent_window;
 
        if (g_settings_get_boolean (EPHY_SETTINGS_MAIN,
-                                   EPHY_PREFS_NEW_WINDOWS_IN_TABS))
+                                   EPHY_PREFS_NEW_WINDOWS_IN_TABS) ||
+           g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
+                                   EPHY_PREFS_LOCKDOWN_FULLSCREEN))
        {
                parent_window = window;
                flags = EPHY_NEW_TAB_IN_EXISTING_WINDOW |
@@ -2175,7 +2177,9 @@ decide_policy_cb (WebKitWebView *web_view,
                                              EPHY_PAGE_VISIT_LINK);
 
                /* New tab in new window for control+shift+click */
-               if (button == 1 && state == (GDK_SHIFT_MASK | GDK_CONTROL_MASK))
+               if (button == 1 && state == (GDK_SHIFT_MASK | GDK_CONTROL_MASK) &&
+                   !g_settings_get_boolean (EPHY_SETTINGS_LOCKDOWN,
+                                            EPHY_PREFS_LOCKDOWN_FULLSCREEN))
                {
                        flags |= EPHY_NEW_TAB_IN_NEW_WINDOW;
                }


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