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.
This commit is contained in:
parent
d1072b2c51
commit
f3f9dd2b3f
1 changed files with 15 additions and 10 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue