From f3f9dd2b3fc1a2da12490d2607696df1572528df Mon Sep 17 00:00:00 2001 From: Christian Dywan Date: Tue, 16 Feb 2010 22:32:53 +0100 Subject: [PATCH] Be sure to save outstanding changes to the config on quit We intentionally set a timeout before saving changes to avoid continuous disc access and also in case opening or closing a tab results in an immediate crash or freezing. But closing Midori normally should save outstanding changes. --- midori/main.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/midori/main.c b/midori/main.c index 8c01f623..eed17136 100644 --- a/midori/main.c +++ b/midori/main.c @@ -418,14 +418,6 @@ midori_history_terminate (sqlite3* db, } #endif -static void -midori_app_quit_cb (MidoriApp* app) -{ - gchar* config_file = build_config_filename ("running"); - g_unlink (config_file); - g_free (config_file); -} - static void settings_notify_cb (MidoriWebSettings* settings, GParamSpec* pspec, @@ -706,6 +698,18 @@ midori_browser_session_cb (MidoriBrowser* browser, } } +static void +midori_app_quit_cb (MidoriBrowser* browser, + KatzeArray* session) +{ + gchar* config_file = build_config_filename ("running"); + g_unlink (config_file); + g_free (config_file); + + if (save_timeout && session) + midori_session_save_timeout_cb (session); +} + static void midori_browser_weak_notify_cb (MidoriBrowser* browser, KatzeArray* session) @@ -1269,6 +1273,8 @@ midori_load_session (gpointer data) G_CALLBACK (midori_browser_session_cb), session); g_signal_connect_after (browser, "remove-tab", G_CALLBACK (midori_browser_session_cb), session); + g_signal_connect (app, "quit", + G_CALLBACK (midori_app_quit_cb), session); g_object_weak_ref (G_OBJECT (session), (GWeakNotify)(midori_browser_weak_notify_cb), browser); @@ -1401,7 +1407,7 @@ static void signal_handler (int signal_id) { signal (signal_id, 0); - midori_app_quit_cb (NULL); + midori_app_quit_cb (NULL, NULL); if (kill (getpid (), signal_id)) exit (1); } @@ -1940,7 +1946,6 @@ main (int argc, gtk_dialog_run (GTK_DIALOG (dialog)); gtk_widget_destroy (dialog); } - g_signal_connect (app, "quit", G_CALLBACK (midori_app_quit_cb), NULL); midori_startup_timer ("Signal setup: \t%f"); g_object_set (app, "settings", settings, -- 2.39.5