Commit 75574dff authored by Michael Catanzaro's avatar Michael Catanzaro Committed by Jan-Michael Brummer
Browse files

session: rename save_idle to save_timeout

It's a timeout, not an idle callback.

Also, add a comment to explain why the timeout should not be removed.

Also, let's avoid calling the timeout's callback directly.
parent 8afa0f40
......@@ -77,7 +77,7 @@ enum {
static GParamSpec *obj_properties[LAST_PROP];
static gboolean ephy_session_save_idle_cb (EphySession *session);
static void ephy_session_save_now (EphySession *session);
G_DEFINE_TYPE (EphySession, ephy_session, G_TYPE_OBJECT)
......@@ -527,7 +527,7 @@ ephy_session_close (EphySession *session)
ephy_session_save_idle_cb (session);
ephy_session_save_now (session);
} else {
session_delete (session);
......@@ -974,21 +974,21 @@ out:
static EphySession *
ephy_session_save_idle_started (EphySession *session)
ephy_session_save_timeout_started (EphySession *session)
g_application_hold (G_APPLICATION (ephy_shell_get_default ()));
return g_object_ref (session);
static void
ephy_session_save_idle_finished (EphySession *session)
ephy_session_save_timeout_finished (EphySession *session)
g_application_release (G_APPLICATION (ephy_shell_get_default ()));
g_object_unref (session);
static gboolean
ephy_session_save_idle_cb (EphySession *session)
ephy_session_save_timeout_cb (EphySession *session)
EphyShell *shell = ephy_shell_get_default ();
SaveData *data;
......@@ -1043,10 +1043,19 @@ ephy_session_save (EphySession *session)
/* Schedule the save to occur one second in the future to ensure we don't
* repeatedly write to disk when opening or closing many tabs at once.
session->save_source_id = g_timeout_add_seconds_full (G_PRIORITY_DEFAULT_IDLE, 1,
ephy_session_save_idle_started (session),
ephy_session_save_timeout_started (session),
static void
ephy_session_save_now (EphySession *session)
ephy_session_save_timeout_cb (session);
static void
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment