[epiphany/mcatanzaro/cli: 5/10] Remove --new-tab flag



commit d381ce22ac742671fc4c0e06abd24a42204535b7
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Thu Jan 3 15:26:21 2019 -0600

    Remove --new-tab flag
    
    This doesn't do anything, because new tabs are already created by
    default.
    
    Well, almost. Currently, when a primary instance already exists and a
    secondary instance is launched, that actually does open a new window in
    the primary instance. But we'll clean that up in the next commit.

 data/epiphany.1  |  4 ----
 src/ephy-main.c  | 21 +--------------------
 src/ephy-shell.c |  9 ++-------
 src/ephy-shell.h |  4 ++--
 4 files changed, 5 insertions(+), 33 deletions(-)
---
diff --git a/data/epiphany.1 b/data/epiphany.1
index a873aab26..78c40e354 100644
--- a/data/epiphany.1
+++ b/data/epiphany.1
@@ -15,10 +15,6 @@ Show help options
 .PP
 Application options
 .TP
-\fB\-n\fR, \fB\-\-new\-tab\fR
-Open a new tab in an existing
-browser window
-.TP
 \fB\-\-new\-window\fR
 Open a new browser window
 .TP
diff --git a/src/ephy-main.c b/src/ephy-main.c
index 72c7de3a4..cd48216d7 100644
--- a/src/ephy-main.c
+++ b/src/ephy-main.c
@@ -45,7 +45,6 @@
 #include <string.h>
 #include <stdlib.h>
 
-static gboolean open_in_new_tab = FALSE;
 static gboolean open_in_new_window = FALSE;
 
 static char *session_filename = NULL;
@@ -110,8 +109,6 @@ option_version_cb (const gchar *option_name,
 /* If you're modifying this array then you need to update the manpage. */
 static const GOptionEntry option_entries[] =
 {
-  { "new-tab", 'n', 0, G_OPTION_ARG_NONE, &open_in_new_tab,
-    N_("Open a new tab in an existing browser window"), NULL },
   { "new-window", 0, 0, G_OPTION_ARG_NONE, &open_in_new_window,
     N_("Open a new browser window"), NULL },
   { "load-session", 'l', 0, G_OPTION_ARG_FILENAME, &session_filename,
@@ -167,19 +164,6 @@ get_startup_id (void)
   return retval;
 }
 
-static EphyStartupFlags
-get_startup_flags (void)
-{
-  EphyStartupFlags flags = 0;
-
-  if (open_in_new_tab)
-    flags |= EPHY_STARTUP_NEW_TAB;
-  if (open_in_new_window)
-    flags |= EPHY_STARTUP_NEW_WINDOW;
-
-  return flags;
-}
-
 int
 main (int   argc,
       char *argv[])
@@ -393,14 +377,11 @@ main (int   argc,
     exit (0);
   }
 
-  startup_flags = get_startup_flags ();
+  startup_flags =  open_in_new_window ? EPHY_STARTUP_NEW_WINDOW : 0;
 
   /* Now create the shell */
   if (private_instance) {
     mode = EPHY_EMBED_SHELL_MODE_PRIVATE;
-    /* In private mode the session autoresume will always open an empty window.
-     * If there are arguments, we want the URIs to be opened in thet existing window. */
-    startup_flags |= EPHY_STARTUP_NEW_TAB;
   } else if (incognito_mode) {
     mode = EPHY_EMBED_SHELL_MODE_INCOGNITO;
   } else if (automation_mode) {
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 2c34c19c7..3449692c7 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -1085,7 +1085,6 @@ open_uris_data_new (EphyShell       *shell,
                     guint32          user_time)
 {
   OpenURIsData *data;
-  gboolean new_windows_in_tabs;
   gboolean fullscreen_lockdown;
   gboolean have_uris;
   EphySession *session = ephy_shell_get_session (shell);
@@ -1096,21 +1095,17 @@ open_uris_data_new (EphyShell       *shell,
   data->uris = g_strdupv ((char **)uris);
   data->user_time = user_time;
 
-  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 = uris && !(g_strv_length ((char **)uris) == 1 && !g_strcmp0 (uris[0], ""));
 
-  if (startup_flags & EPHY_STARTUP_NEW_WINDOW && !fullscreen_lockdown) {
+  if (((startup_flags & EPHY_STARTUP_NEW_WINDOW) && !fullscreen_lockdown) || !have_uris) {
     data->window = ephy_window_new ();
-  } else if (startup_flags & EPHY_STARTUP_NEW_TAB || (new_windows_in_tabs && have_uris)) {
+  } else {
     data->flags |= EPHY_NEW_TAB_JUMP;
     data->window = EPHY_WINDOW (gtk_application_get_active_window (GTK_APPLICATION (shell)));
     data->reuse_empty_tab = TRUE;
-  } else if (!have_uris) {
-    data->window = ephy_window_new ();
   }
 
   g_application_hold (G_APPLICATION (shell));
diff --git a/src/ephy-shell.h b/src/ephy-shell.h
index 1feb3ad9f..34240b707 100644
--- a/src/ephy-shell.h
+++ b/src/ephy-shell.h
@@ -67,9 +67,9 @@ typedef enum {
   EPHY_NEW_TAB_JUMP   = 1 << 4,
 } EphyNewTabFlags;
 
+// FIXME: doesn't make sense to keep this with only one flag remaining.
 typedef enum {
-  EPHY_STARTUP_NEW_TAB          = 1 << 0,
-  EPHY_STARTUP_NEW_WINDOW       = 1 << 1,
+  EPHY_STARTUP_NEW_WINDOW       = 1 << 0,
 } EphyStartupFlags;
 
 typedef struct {


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