summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Catanzaro <mcatanzaro@igalia.com>2016-03-05 14:18:09 -0600
committerMichael Catanzaro <mcatanzaro@igalia.com>2016-03-21 19:56:34 -0500
commit006ae7dfe20e0c8944f4f3827fb5a47df9a8b23a (patch)
tree2a63817b5971840b4dd5d003850bc83f3dfa742e
parentc1a468722df3d0408e39854aa7cd00eb17d12a42 (diff)
downloadepiphany-006ae7dfe20e0c8944f4f3827fb5a47df9a8b23a.tar.gz
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
-rw-r--r--src/ephy-session.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/ephy-session.c b/src/ephy-session.c
index a041930f1..6622080b6 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),