[epiphany] Add a new startup flag to indicate we are resuming a session



commit 21e99b5c7591046b51495d38372a080da664ad25
Author: Gustavo Noronha Silva <gns gnome org>
Date:   Sun Sep 8 03:06:20 2013 -0300

    Add a new startup flag to indicate we are resuming a session
    
    Web should open a new window if no URIs are passed - it's how GNOME
    Shell does its 'new window' magic. However, it should not do so if the
    instance that is already running is a headless instance that happens
    to be active, and resumes a session when called with or without URIs.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=707451

 src/ephy-session.c |    2 +-
 src/ephy-shell.c   |   13 +++++++++----
 src/ephy-shell.h   |    1 +
 3 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/src/ephy-session.c b/src/ephy-session.c
index 6a8a8d9..ba77068 100644
--- a/src/ephy-session.c
+++ b/src/ephy-session.c
@@ -1615,7 +1615,7 @@ ephy_session_resume (EphySession *session,
                return;
        }
 
-       g_task_return_boolean (task, TRUE);
+       g_task_return_boolean (task, FALSE);
        g_object_unref (task);
 }
 
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index f4c9b70..5fd9d3d 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -293,7 +293,9 @@ session_load_cb (GObject *object,
   EphySession *session = EPHY_SESSION (object);
   EphyShell *shell = EPHY_SHELL (user_data);
 
-  ephy_session_resume_finish (session, result, NULL);
+  if (ephy_session_resume_finish (session, result, NULL))
+    shell->priv->startup_context->startup_flags |= EPHY_STARTUP_RESUMING_SESSION;
+
   ephy_shell_startup_continue (shell);
 }
 
@@ -325,10 +327,10 @@ ephy_shell_activate (GApplication *application)
     EphyShellStartupContext *ctx;
 
     ctx = shell->priv->startup_context;
-    if (ctx->startup_flags != EPHY_STARTUP_OPEN_NOTHING)
+    if (ctx->startup_flags != EPHY_STARTUP_OPEN_NOTHING) {
       ephy_session_resume (ephy_shell_get_session (shell),
                            ctx->user_time, NULL, session_load_cb, shell);
-    else
+    } else
       ephy_shell_start_headless (shell);
   } else
     ephy_shell_startup_continue (shell);
@@ -1193,7 +1195,7 @@ open_uris_data_new (EphyShell *shell,
     data->flags |= EPHY_NEW_TAB_IN_NEW_WINDOW;
   } else if (startup_flags & EPHY_STARTUP_NEW_TAB || (new_windows_in_tabs && have_uris)) {
     data->flags |= EPHY_NEW_TAB_IN_EXISTING_WINDOW | EPHY_NEW_TAB_JUMP | EPHY_NEW_TAB_PRESENT_WINDOW | 
EPHY_NEW_TAB_FROM_EXTERNAL;
-  } else if (!have_uris) {
+  } else if (!have_uris && !(startup_flags & EPHY_STARTUP_RESUMING_SESSION)) {
     data->window = NULL;
     data->flags |= EPHY_NEW_TAB_IN_NEW_WINDOW;
   }
@@ -1225,6 +1227,9 @@ ephy_shell_open_uris_idle (OpenURIsData *data)
   WebKitNetworkRequest *request = NULL;
 #endif
 
+  if (!data->window && !data->flags)
+    return FALSE;
+
   url = data->uris[data->current_uri];
   if (url[0] == '\0') {
     page_flags = EPHY_NEW_TAB_HOME_PAGE;
diff --git a/src/ephy-shell.h b/src/ephy-shell.h
index 2c81748..0390be3 100644
--- a/src/ephy-shell.h
+++ b/src/ephy-shell.h
@@ -114,6 +114,7 @@ typedef enum {
   EPHY_STARTUP_NEW_TAB          = 1 << 0,
   EPHY_STARTUP_NEW_WINDOW       = 1 << 1,
   EPHY_STARTUP_OPEN_NOTHING     = 1 << 2,
+  EPHY_STARTUP_RESUMING_SESSION = 1 << 3,
 } EphyStartupFlags;
 
 typedef struct {


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