aboutsummaryrefslogtreecommitdiffstats
path: root/src/ephy-session.c
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2005-07-04 20:22:41 +0800
committerChristian Persch <chpe@src.gnome.org>2005-07-04 20:22:41 +0800
commit553cf8c4a065086212d22d52715333ee166b85b5 (patch)
tree3927b984675f82fd3488def5827247166be9a3e3 /src/ephy-session.c
parent0e935c597fe2e3e00f672b98f77eaebf48660857 (diff)
downloadgsoc2013-epiphany-553cf8c4a065086212d22d52715333ee166b85b5.tar.gz
gsoc2013-epiphany-553cf8c4a065086212d22d52715333ee166b85b5.tar.zst
gsoc2013-epiphany-553cf8c4a065086212d22d52715333ee166b85b5.zip
Better fix for bug #151037 to make session shutdown work again. Also fix
2005-07-04 Christian Persch <chpe@cvs.gnome.org> * embed/downloader-view.c: (remove_download), (prepare_close_cb), (downloader_view_init), (downloader_view_finalize), (downloader_view_remove_download), (download_dialog_delete_cb): * embed/ephy-embed-shell.c: (ephy_embed_shell_prepare_close), (ephy_embed_shell_class_init): * embed/ephy-embed-shell.h: * embed/ephy-favicon-cache.c: (prepare_close_cb), (ephy_favicon_cache_init), (kill_download): * embed/mozilla/mozilla-embed-find.cpp: * embed/mozilla/mozilla-embed-single.cpp: * embed/mozilla/mozilla-embed.cpp: * embed/mozilla/mozilla-notifiers.cpp: * embed/mozilla/mozilla-notifiers.h: * src/ephy-session.c: (ephy_session_init), (ephy_session_dispose), (ephy_session_autoresume), (close_dialog), (ephy_session_close): * src/ephy-shell.c: (ephy_shell_startup), (toolwindow_hide_cb): * src/ephy-window.c: (ephy_window_finalize): Better fix for bug #151037 to make session shutdown work again. Also fix session shutdown while resuming, and preserve the session in this case.
Diffstat (limited to 'src/ephy-session.c')
-rw-r--r--src/ephy-session.c64
1 files changed, 41 insertions, 23 deletions
diff --git a/src/ephy-session.c b/src/ephy-session.c
index 96e016137..f39001116 100644
--- a/src/ephy-session.c
+++ b/src/ephy-session.c
@@ -57,7 +57,8 @@ struct _EphySessionPrivate
GList *windows;
GList *tool_windows;
GtkWidget *resume_dialog;
- gboolean dont_save;
+ guint dont_save : 1;
+ guint quit_while_resuming : 1;
};
#define BOOKMARKS_EDITOR_ID "BookmarksEditor"
@@ -262,40 +263,28 @@ impl_detach_window (EphyExtension *extension,
}
static void
-ensure_session_directory (void)
-{
- char *dir;
-
- dir = g_build_filename (ephy_dot_dir (), "sessions", NULL);
- if (g_file_test (dir, G_FILE_TEST_EXISTS) == FALSE)
- {
- if (mkdir (dir, 488) != 0)
- {
- g_error ("Unable to create session directory '%s'\n", dir);
- }
- }
-
- g_free (dir);
-}
-
-static void
ephy_session_init (EphySession *session)
{
session->priv = EPHY_SESSION_GET_PRIVATE (session);
LOG ("EphySession initialising");
-
- ensure_session_directory ();
}
static void
ephy_session_dispose (GObject *object)
{
EphySession *session = EPHY_SESSION(object);
+ EphySessionPrivate *priv = session->priv;
LOG ("EphySession disposing");
- session_delete (session, SESSION_CRASHED);
+ /* Only remove the crashed session if we're not shutting down while
+ * the session resume dialogue was still shown!
+ */
+ if (priv->quit_while_resuming == FALSE)
+ {
+ session_delete (session, SESSION_CRASHED);
+ }
parent_class->dispose (object);
}
@@ -462,12 +451,25 @@ ephy_session_autoresume (EphySession *session,
g_free (saved_session);
- return retval;
+ /* ensure we don't open a blank window when quitting while resuming */
+ return retval || priv->quit_while_resuming;
+}
+
+static void
+close_dialog (GtkWidget *widget)
+{
+ if (GTK_IS_DIALOG (widget))
+ {
+ /* don't destroy them, someone might have a ref on them */
+ gtk_dialog_response (GTK_DIALOG (widget),
+ GTK_RESPONSE_DELETE_EVENT);
+ }
}
void
ephy_session_close (EphySession *session)
{
+ EphySessionPrivate *priv = session->priv;
GList *windows;
LOG ("ephy_session_close");
@@ -476,7 +478,12 @@ ephy_session_close (EphySession *session)
* destroying the windows and destroying the tool windows
*/
g_object_ref (ephy_shell);
- session->priv->dont_save = TRUE;
+
+ priv->dont_save = TRUE;
+ /* need to set this up here while the dialogue hasn't been killed yet */
+ priv->quit_while_resuming = priv->resume_dialog != NULL;
+
+ ephy_embed_shell_prepare_close (embed_shell);
windows = ephy_session_get_windows (session);
g_list_foreach (windows, (GFunc) gtk_widget_destroy, NULL);
@@ -486,6 +493,17 @@ ephy_session_close (EphySession *session)
g_list_foreach (windows, (GFunc) gtk_widget_destroy, NULL);
g_list_free (windows);
+ ephy_embed_shell_prepare_close (embed_shell);
+
+ /* there may still be windows open, like dialogues posed from
+ * web pages, etc. Try to kill them, but be sure NOT to destroy
+ * the gtkmozembed offscreen window!
+ * Here, we just check if it's a dialogue and close it if it is one.
+ */
+ windows = gtk_window_list_toplevels ();
+ g_list_foreach (windows, (GFunc) close_dialog, NULL);
+ g_list_free (windows);
+
session->priv->dont_save = FALSE;
g_object_unref (ephy_shell);
}