aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGustavo Noronha Silva <gns@gnome.org>2013-09-08 14:06:20 +0800
committerClaudio Saavedra <csaavedra@igalia.com>2013-09-20 18:23:05 +0800
commit21e99b5c7591046b51495d38372a080da664ad25 (patch)
tree3db6491b0c0feaca58c658f97b84c61bbf22a6fc
parent7f3e5ffdc1d1e5241457de602facbfb07ce01093 (diff)
downloadgsoc2013-epiphany-21e99b5c7591046b51495d38372a080da664ad25.tar.gz
gsoc2013-epiphany-21e99b5c7591046b51495d38372a080da664ad25.tar.zst
gsoc2013-epiphany-21e99b5c7591046b51495d38372a080da664ad25.zip
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
-rw-r--r--src/ephy-session.c2
-rw-r--r--src/ephy-shell.c13
-rw-r--r--src/ephy-shell.h1
3 files changed, 11 insertions, 5 deletions
diff --git a/src/ephy-session.c b/src/ephy-session.c
index 6a8a8d9db..ba7706889 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 f4c9b707d..5fd9d3d26 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 2c817484a..0390be324 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 {