[Xfce4-commits] <midori:master> Be sure to save outstanding changes to the config on quit

Christian Dywan noreply at xfce.org
Wed Feb 17 23:20:01 CET 2010


Updating branch refs/heads/master
         to f3f9dd2b3fc1a2da12490d2607696df1572528df (commit)
       from d1072b2c51cf0dddb221fc671c5cc49c604dc3a7 (commit)

commit f3f9dd2b3fc1a2da12490d2607696df1572528df
Author: Christian Dywan <christian at twotoasts.de>
Date:   Tue Feb 16 22:32:53 2010 +0100

    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 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/midori/main.c b/midori/main.c
index 8c01f62..eed1713 100644
--- a/midori/main.c
+++ b/midori/main.c
@@ -419,14 +419,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,
                     MidoriApp*         app)
@@ -707,6 +699,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,



More information about the Xfce4-commits mailing list