diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2005-07-04 20:22:41 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2005-07-04 20:22:41 +0800 |
commit | 553cf8c4a065086212d22d52715333ee166b85b5 (patch) | |
tree | 3927b984675f82fd3488def5827247166be9a3e3 /src | |
parent | 0e935c597fe2e3e00f672b98f77eaebf48660857 (diff) | |
download | gsoc2013-epiphany-553cf8c4a065086212d22d52715333ee166b85b5.tar gsoc2013-epiphany-553cf8c4a065086212d22d52715333ee166b85b5.tar.gz gsoc2013-epiphany-553cf8c4a065086212d22d52715333ee166b85b5.tar.bz2 gsoc2013-epiphany-553cf8c4a065086212d22d52715333ee166b85b5.tar.lz gsoc2013-epiphany-553cf8c4a065086212d22d52715333ee166b85b5.tar.xz 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')
-rw-r--r-- | src/ephy-session.c | 64 | ||||
-rw-r--r-- | src/ephy-shell.c | 19 | ||||
-rw-r--r-- | src/ephy-window.c | 3 |
3 files changed, 51 insertions, 35 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); } diff --git a/src/ephy-shell.c b/src/ephy-shell.c index 4b9bd1993..26eb28a61 100644 --- a/src/ephy-shell.c +++ b/src/ephy-shell.c @@ -47,7 +47,6 @@ #include "print-dialog.h" #include "ephy-prefs.h" #include "ephy-gui.h" -#include "ephy-object-helpers.h" #ifdef ENABLE_DBUS #include "ephy-dbus.h" @@ -481,8 +480,13 @@ ephy_shell_startup (EphyShell *shell, "from Bonobo when attempting to locate the automation " "object.")); automation = NULL; + goto done; } - else if (flags & EPHY_SHELL_STARTUP_BOOKMARKS_EDITOR) + + /* init the session manager up here so we can quit while the resume dialogue is on */ + gnome_session_init (shell); + + if (flags & EPHY_SHELL_STARTUP_BOOKMARKS_EDITOR) { GNOME_EphyAutomation_openBookmarksEditorWithStartupId (automation, user_time, &ev); @@ -510,14 +514,10 @@ ephy_shell_startup (EphyShell *shell, flags & EPHY_SHELL_STARTUP_FULLSCREEN); } - if (automation) - { - bonobo_object_release_unref (automation, &ev); - } - - gnome_session_init (shell); + bonobo_object_release_unref (automation, &ev); } +done: CORBA_exception_free (&ev); gdk_notify_startup_complete (); @@ -941,8 +941,7 @@ toolwindow_hide_cb (GtkWidget *widget, EphyShell *es) session = EPHY_SESSION (ephy_shell_get_session (es)); ephy_session_remove_window (ephy_shell->priv->session, GTK_WINDOW (widget)); - - ephy_object_idle_unref (ephy_shell); + g_object_unref (ephy_shell); } GtkWidget * diff --git a/src/ephy-window.c b/src/ephy-window.c index 186458fbd..3269b9c1b 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -56,7 +56,6 @@ #include "ephy-fullscreen-popup.h" #include "ephy-action-helper.h" #include "ephy-find-toolbar.h" -#include "ephy-object-helpers.h" #include <string.h> #include <glib/gi18n.h> @@ -2858,7 +2857,7 @@ ephy_window_finalize (GObject *object) LOG ("Ephy Window finalized %p", object); - ephy_object_idle_unref (ephy_shell); + g_object_unref (ephy_shell); } /** |