aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXan Lopez <xan@igalia.com>2012-12-10 20:10:27 +0800
committerXan Lopez <xan@igalia.com>2012-12-10 20:12:00 +0800
commita867cce00a52b298d19179008bf0420b9ae268c6 (patch)
treedfc61536f5bdf721206f72b0636958182b214ef1
parent769f6686195c9cf7fbdbff583462624fe70d756a (diff)
downloadgsoc2013-epiphany-a867cce00a52b298d19179008bf0420b9ae268c6.tar
gsoc2013-epiphany-a867cce00a52b298d19179008bf0420b9ae268c6.tar.gz
gsoc2013-epiphany-a867cce00a52b298d19179008bf0420b9ae268c6.tar.bz2
gsoc2013-epiphany-a867cce00a52b298d19179008bf0420b9ae268c6.tar.lz
gsoc2013-epiphany-a867cce00a52b298d19179008bf0420b9ae268c6.tar.xz
gsoc2013-epiphany-a867cce00a52b298d19179008bf0420b9ae268c6.tar.zst
gsoc2013-epiphany-a867cce00a52b298d19179008bf0420b9ae268c6.zip
ephy-session: fixup session autoresume
This code was confusing, but what we actually wanted to do here was to only autoresume the session if there were no windows opened, otherwise it means we are launching a new instance after the first one. Make this explicit in the code instead of relying on side-effects of early returns.
-rw-r--r--src/ephy-session.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/ephy-session.c b/src/ephy-session.c
index 02b37dd3a..bb58d3850 100644
--- a/src/ephy-session.c
+++ b/src/ephy-session.c
@@ -209,6 +209,7 @@ session_command_autoresume (EphySession *session,
char *saved_session_file_path;
gboolean crashed_session;
EphyPrefsRestoreSessionPolicy policy;
+ EphyShell *shell;
LOG ("ephy_session_autoresume");
@@ -222,6 +223,8 @@ session_command_autoresume (EphySession *session,
policy = g_settings_get_enum (EPHY_SETTINGS_MAIN,
EPHY_PREFS_RESTORE_SESSION_POLICY);
+ shell = ephy_shell_get_default ();
+
if (crashed_session == FALSE ||
policy == EPHY_PREFS_RESTORE_SESSION_POLICY_NEVER)
{
@@ -234,13 +237,11 @@ session_command_autoresume (EphySession *session,
ephy_session_queue_command (session,
EPHY_SESSION_CMD_MAYBE_OPEN_WINDOW,
NULL, NULL, user_time, FALSE);
-
- return;
}
-
- ephy_session_queue_command (session,
- EPHY_SESSION_CMD_LOAD_SESSION,
- SESSION_STATE, NULL, user_time, TRUE);
+ else if (ephy_shell_get_n_windows (shell) == 0)
+ ephy_session_queue_command (session,
+ EPHY_SESSION_CMD_LOAD_SESSION,
+ SESSION_STATE, NULL, user_time, TRUE);
}
static void