[epiphany] Stop using ephy-session in web app mode
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany] Stop using ephy-session in web app mode
- Date: Tue, 31 Jan 2017 16:08:45 +0000 (UTC)
commit 704e4017f3fa3b3a411a8319c2734145ff93d88e
Author: Carlos Garcia Campos <cgarcia igalia com>
Date: Tue Jan 31 12:55:58 2017 +0100
Stop using ephy-session in web app mode
We were making sure we never loaded the session in web app mode, but we
always saved it. It's better to simply not use ephy-session at all in
web app mode.
src/ephy-shell.c | 28 +++++++++++++++++-----------
src/ephy-window.c | 5 ++++-
src/window-commands.c | 5 ++++-
3 files changed, 25 insertions(+), 13 deletions(-)
---
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 57c6a66..12a9c40 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -129,15 +129,13 @@ ephy_shell_startup_context_free (EphyShellStartupContext *ctx)
static void
ephy_shell_startup_continue (EphyShell *shell, EphyShellStartupContext *ctx)
{
- EphySession *session;
-
- session = ephy_shell_get_session (shell);
- g_assert (session != NULL);
+ if (ctx->session_filename != NULL) {
+ EphySession *session = ephy_shell_get_session (shell);
- if (ctx->session_filename != NULL)
+ g_assert (session != NULL);
ephy_session_load (session, (const char *)ctx->session_filename,
ctx->user_time, NULL, NULL, NULL);
- else if (ctx->arguments != NULL) {
+ } else if (ctx->arguments != NULL) {
/* Don't queue any window openings if no extra arguments given, */
/* since session autoresume will open one for us. */
ephy_shell_open_uris (shell, (const char **)ctx->arguments,
@@ -419,8 +417,10 @@ ephy_shell_activate (GApplication *application)
* can be invalidated by another remote instance.
*/
if (shell->remote_startup_context == NULL) {
- if (ephy_embed_shell_get_mode (EPHY_EMBED_SHELL (shell)) != EPHY_EMBED_SHELL_MODE_APPLICATION) {
- ephy_session_resume (ephy_shell_get_session (shell),
+ EphySession *session = ephy_shell_get_session (shell);
+
+ if (session) {
+ ephy_session_resume (session,
shell->local_startup_context->user_time,
NULL, session_load_cb, shell->local_startup_context);
} else
@@ -789,6 +789,9 @@ ephy_shell_get_session (EphyShell *shell)
{
g_return_val_if_fail (EPHY_IS_SHELL (shell), NULL);
+ if (ephy_embed_shell_get_mode (EPHY_EMBED_SHELL (shell)) == EPHY_EMBED_SHELL_MODE_APPLICATION)
+ return NULL;
+
if (shell->session == NULL)
shell->session = g_object_new (EPHY_TYPE_SESSION, NULL);
@@ -941,10 +944,12 @@ ephy_shell_close_all_windows (EphyShell *shell)
{
GList *windows;
gboolean retval = TRUE;
+ EphySession *session = ephy_shell_get_session (shell);
g_return_val_if_fail (EPHY_IS_SHELL (shell), FALSE);
- ephy_session_close (ephy_shell_get_session (shell));
+ if (session)
+ ephy_session_close (session);
windows = gtk_application_get_windows (GTK_APPLICATION (shell));
while (windows) {
@@ -991,10 +996,11 @@ open_uris_data_new (EphyShell *shell,
gboolean new_windows_in_tabs;
gboolean fullscreen_lockdown;
gboolean have_uris;
+ EphySession *session = ephy_shell_get_session (shell);
data = g_slice_new0 (OpenURIsData);
data->shell = shell;
- data->session = g_object_ref (ephy_shell_get_session (shell));
+ data->session = session ? g_object_ref (session) : NULL;
data->uris = g_strdupv ((char **)uris);
data->user_time = user_time;
@@ -1024,7 +1030,7 @@ static void
open_uris_data_free (OpenURIsData *data)
{
g_application_release (G_APPLICATION (data->shell));
- g_object_unref (data->session);
+ g_clear_object (&data->session);
g_strfreev (data->uris);
g_slice_free (OpenURIsData, data);
diff --git a/src/ephy-window.c b/src/ephy-window.c
index c86fafd..47da40a 100644
--- a/src/ephy-window.c
+++ b/src/ephy-window.c
@@ -3486,6 +3486,7 @@ ephy_window_close (EphyWindow *window)
/* If this is the last window, check ongoing downloads and save its state in the session. */
if (ephy_shell_get_n_windows (ephy_shell_get_default ()) == 1) {
EphyDownloadsManager *manager = ephy_embed_shell_get_downloads_manager (EPHY_EMBED_SHELL
(ephy_shell_get_default ()));
+ EphySession *session;
if (ephy_downloads_manager_has_active_downloads (manager) &&
!confirm_close_with_downloads (window)) {
@@ -3493,7 +3494,9 @@ ephy_window_close (EphyWindow *window)
return FALSE;
}
- ephy_session_close (ephy_shell_get_session (ephy_shell_get_default ()));
+ session = ephy_shell_get_session (ephy_shell_get_default ());
+ if (session)
+ ephy_session_close (session);
}
/* See bug #114689 */
diff --git a/src/window-commands.c b/src/window-commands.c
index d92af68..0838f20 100644
--- a/src/window-commands.c
+++ b/src/window-commands.c
@@ -693,7 +693,10 @@ window_cmd_reopen_closed_tab (GSimpleAction *action,
GVariant *parameter,
gpointer user_data)
{
- ephy_session_undo_close_tab (ephy_shell_get_session (ephy_shell_get_default ()));
+ EphySession *session = ephy_shell_get_session (ephy_shell_get_default ());
+
+ g_assert (session != NULL);
+ ephy_session_undo_close_tab (session);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]