[epiphany] "New Window" should never open incognito window



commit 1bf51d133667985ee7f89168e2d68e8bed8c4f03
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Fri Oct 28 06:50:20 2016 -0500

    "New Window" should never open incognito window
    
    There is already a different menu item to get an incognito window.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=723185

 lib/ephy-file-helpers.c |   13 +++++++++++++
 lib/ephy-file-helpers.h |    1 +
 src/window-commands.c   |   12 +++++++++---
 3 files changed, 23 insertions(+), 3 deletions(-)
---
diff --git a/lib/ephy-file-helpers.c b/lib/ephy-file-helpers.c
index 5b401b5..6b54d9a 100644
--- a/lib/ephy-file-helpers.c
+++ b/lib/ephy-file-helpers.c
@@ -977,6 +977,19 @@ ephy_sanitize_filename (char *filename)
 }
 
 void
+ephy_open_default_instance_window (void)
+{
+  GError *error = NULL;
+
+  g_spawn_command_line_async ("epiphany", &error);
+
+  if (error) {
+    g_warning ("Couldn't open default instance: %s", error->message);
+    g_error_free (error);
+  }
+}
+
+void
 ephy_open_incognito_window (const char *uri)
 {
   char *command;
diff --git a/lib/ephy-file-helpers.h b/lib/ephy-file-helpers.h
index 11b8fe1..c530a92 100644
--- a/lib/ephy-file-helpers.h
+++ b/lib/ephy-file-helpers.h
@@ -92,6 +92,7 @@ char       *       ephy_file_create_data_uri_for_filename   (const char
 char       *       ephy_sanitize_filename                   (char                  *filename);
 GAppInfo   *       ephy_file_launcher_get_app_info_for_file (GFile                 *file,
                                                              const char            *mime_type);
+void               ephy_open_default_instance_window        (void);
 void               ephy_open_incognito_window               (const char *uri);
 
 G_END_DECLS
diff --git a/src/window-commands.c b/src/window-commands.c
index be4c996..4011382 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -70,11 +70,17 @@ window_cmd_new_window (GSimpleAction *action,
                        GVariant      *parameter,
                        gpointer       user_data)
 {
+  EphyWindow *new_window;
   EphyEmbed *embed;
-  EphyWindow *new_window = ephy_window_new ();
+  EphyShell *shell = ephy_shell_get_default ();
 
-  embed = ephy_shell_new_tab (ephy_shell_get_default (),
-                              new_window, NULL, 0);
+  if (ephy_embed_shell_get_mode (EPHY_EMBED_SHELL (shell)) == EPHY_EMBED_SHELL_MODE_INCOGNITO) {
+    ephy_open_default_instance_window ();
+    return;
+  }
+
+  new_window = ephy_window_new ();
+  embed = ephy_shell_new_tab (shell, new_window, NULL, 0);
   ephy_web_view_load_homepage (ephy_embed_get_web_view (embed));
   ephy_window_activate_location (new_window);
 }


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