[epiphany] session: Check restore-session-policy in ephy_session_save()



commit 006ae7dfe20e0c8944f4f3827fb5a47df9a8b23a
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Sat Mar 5 14:18:09 2016 -0600

    session: Check restore-session-policy in ephy_session_save()
    
    Instead of doing it in the idle, it's better to do it here before
    scheduling the unnecessary idle. Currently it's handled in the idle
    because the idle is called manually from ephy_session_close() and this
    saves checking it in both places, but now that we need to check it in
    ephy_session_close() anyway, there's no value in doing it in the idle.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=762906

 src/ephy-session.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/src/ephy-session.c b/src/ephy-session.c
index a041930..6622080 100644
--- a/src/ephy-session.c
+++ b/src/ephy-session.c
@@ -948,7 +948,6 @@ ephy_session_save_idle_cb (EphySession *session)
        EphyShell *shell = ephy_shell_get_default ();
        SaveData *data;
        GTask *task;
-       EphyPrefsRestoreSessionPolicy policy;
 
        session->save_source_id = 0;
 
@@ -959,12 +958,6 @@ ephy_session_save_idle_cb (EphySession *session)
                session->save_cancellable = NULL;
        }
 
-       policy = g_settings_get_enum (EPHY_SETTINGS_MAIN, EPHY_PREFS_RESTORE_SESSION_POLICY);
-       if (policy == EPHY_PREFS_RESTORE_SESSION_POLICY_NEVER)
-       {
-               return G_SOURCE_REMOVE;
-       }
-
        LOG ("ephy_sesion_save");
 
        if (ephy_shell_get_n_windows (shell) == 0)
@@ -988,6 +981,8 @@ ephy_session_save_idle_cb (EphySession *session)
 void
 ephy_session_save (EphySession *session)
 {
+       EphyPrefsRestoreSessionPolicy policy;
+
        g_return_if_fail (EPHY_IS_SESSION (session));
 
        if (session->save_source_id)
@@ -1000,6 +995,12 @@ ephy_session_save (EphySession *session)
                return;
        }
 
+       policy = g_settings_get_enum (EPHY_SETTINGS_MAIN, EPHY_PREFS_RESTORE_SESSION_POLICY);
+       if (policy == EPHY_PREFS_RESTORE_SESSION_POLICY_NEVER)
+       {
+               return;
+       }
+
        session->save_source_id = g_timeout_add_seconds_full (G_PRIORITY_DEFAULT_IDLE, 1,
                                                              (GSourceFunc)ephy_session_save_idle_cb,
                                                              ephy_session_save_idle_started (session),


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