[epiphany] ephy-session: fixup session autoresume



commit a867cce00a52b298d19179008bf0420b9ae268c6
Author: Xan Lopez <xan igalia com>
Date:   Mon Dec 10 13:10:27 2012 +0100

    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.

 src/ephy-session.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/src/ephy-session.c b/src/ephy-session.c
index 02b37dd..bb58d38 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



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