diff options
author | Xan Lopez <xan@igalia.com> | 2012-03-30 17:44:03 +0800 |
---|---|---|
committer | Xan Lopez <xan@igalia.com> | 2012-03-30 17:44:03 +0800 |
commit | 381ce4af310607cc84ac1e84abbecda2d7d3e7d9 (patch) | |
tree | a5307b829e52f359d4a78422cd5c34d1222de8a5 /src | |
parent | 6f7e20b72eac9fab402061539bb108c1288dad3f (diff) | |
download | gsoc2013-epiphany-381ce4af310607cc84ac1e84abbecda2d7d3e7d9.tar gsoc2013-epiphany-381ce4af310607cc84ac1e84abbecda2d7d3e7d9.tar.gz gsoc2013-epiphany-381ce4af310607cc84ac1e84abbecda2d7d3e7d9.tar.bz2 gsoc2013-epiphany-381ce4af310607cc84ac1e84abbecda2d7d3e7d9.tar.lz gsoc2013-epiphany-381ce4af310607cc84ac1e84abbecda2d7d3e7d9.tar.xz gsoc2013-epiphany-381ce4af310607cc84ac1e84abbecda2d7d3e7d9.tar.zst gsoc2013-epiphany-381ce4af310607cc84ac1e84abbecda2d7d3e7d9.zip |
ephy-window: save the session when the last window is closed manually
If the user closes the last window manually (pressing the [x] button
in the window) she probably wants to save the session contents too, so
do that. This is consistent with the behavior of Firefox and Chrome.
https://bugzilla.gnome.org/show_bug.cgi?id=673122
Diffstat (limited to 'src')
-rw-r--r-- | src/ephy-window.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/ephy-window.c b/src/ephy-window.c index ee1c0c293..a54f7f2d3 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -49,6 +49,7 @@ #include "ephy-page-menu-action.h" #include "ephy-prefs.h" #include "ephy-private.h" +#include "ephy-session.h" #include "ephy-settings.h" #include "ephy-shell.h" #include "ephy-state.h" @@ -994,8 +995,10 @@ ephy_window_delete_event (GtkWidget *widget, GdkEventAny *event) { EphyWindow *window = EPHY_WINDOW (widget); + EphySession *session; EphyEmbed *modified_embed = NULL; - GList *tabs, *l; + GList *tabs, *l, *windows; + guint number_windows; gboolean modified = FALSE; /* We ignore the delete_event if the disable_quit lockdown has been set @@ -1039,6 +1042,18 @@ ephy_window_delete_event (GtkWidget *widget, return TRUE; } + /* If this is the last window, save its state in the session. */ + session = EPHY_SESSION (ephy_shell_get_session (ephy_shell)); + windows = ephy_session_get_windows (session); + number_windows = g_list_length (windows); + g_list_free (windows); + + if (number_windows == 1) + { + ephy_session_close (session); + return TRUE; + } + /* See bug #114689 */ gtk_widget_hide (widget); |