diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2004-08-06 21:08:03 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2004-08-06 21:08:03 +0800 |
commit | 7ca43af0be7e068d0a2634bd814a8f42b8b2abb2 (patch) | |
tree | 10184bc55a7ab384c952512be02384985f3d7f10 /src/ephy-session.c | |
parent | f15105e06c66e1156f6c8f4542db62eed0ee46f2 (diff) | |
download | gsoc2013-epiphany-7ca43af0be7e068d0a2634bd814a8f42b8b2abb2.tar gsoc2013-epiphany-7ca43af0be7e068d0a2634bd814a8f42b8b2abb2.tar.gz gsoc2013-epiphany-7ca43af0be7e068d0a2634bd814a8f42b8b2abb2.tar.bz2 gsoc2013-epiphany-7ca43af0be7e068d0a2634bd814a8f42b8b2abb2.tar.lz gsoc2013-epiphany-7ca43af0be7e068d0a2634bd814a8f42b8b2abb2.tar.xz gsoc2013-epiphany-7ca43af0be7e068d0a2634bd814a8f42b8b2abb2.tar.zst gsoc2013-epiphany-7ca43af0be7e068d0a2634bd814a8f42b8b2abb2.zip |
Avoid overwriting the session file while resuming; preserves the crashed
2004-08-06 Christian Persch <chpe@cvs.gnome.org>
* src/ephy-session.c: (ephy_session_init),
(ephy_session_autoresume), (ephy_session_save),
(ephy_session_get_active_window):
Avoid overwriting the session file while resuming; preserves
the crashed session when crashing while resuming.
Diffstat (limited to 'src/ephy-session.c')
-rw-r--r-- | src/ephy-session.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/src/ephy-session.c b/src/ephy-session.c index 655e9f01c..f526703ed 100644 --- a/src/ephy-session.c +++ b/src/ephy-session.c @@ -56,6 +56,7 @@ struct EphySessionPrivate GList *windows; GList *tool_windows; GtkWidget *resume_dialog; + gboolean resuming; }; #define BOOKMARKS_EDITOR_ID "BookmarksEditor" @@ -270,6 +271,7 @@ ephy_session_init (EphySession *session) session->priv->windows = NULL; session->priv->tool_windows = NULL; session->priv->resume_dialog = NULL; + session->priv->resuming = FALSE; ensure_session_directory (); } @@ -456,7 +458,10 @@ ephy_session_autoresume (EphySession *session) if (g_file_test (saved_session, G_FILE_TEST_EXISTS) && offer_to_resume (session)) { + session->priv->resuming = TRUE; retval = ephy_session_load (session, saved_session); + session->priv->resuming = FALSE; + ephy_session_save (session, SESSION_CRASHED); } g_free (saved_session); @@ -601,9 +606,14 @@ ephy_session_save (EphySession *session, char *save_to, *tmp_file; int ret; + if (session->priv->resuming) + { + return TRUE; + } + LOG ("ephy_sesion_save %s", filename) - if (session->priv->windows == NULL) + if (session->priv->windows == NULL && session->priv->tool_windows == NULL) { session_delete (session, filename); return TRUE; @@ -646,7 +656,7 @@ ephy_session_save (EphySession *session, for (w = session->priv->tool_windows; w != NULL && ret >= 0; w = w->next) { - ret = write_tool_window (writer, GTK_WIDGET (w->data)); + ret = write_tool_window (writer, GTK_WINDOW (w->data)); } if (ret < 0) goto out; @@ -861,7 +871,15 @@ ephy_session_remove_window (EphySession *session, EphyWindow * ephy_session_get_active_window (EphySession *session) { + GList *first; + g_return_val_if_fail (EPHY_IS_SESSION (session), NULL); - return g_list_first (session->priv->windows); + first = session->priv->windows; + if (first != NULL) + { + return EPHY_WINDOW (first->data); + } + + return NULL; } |