Use PrefsWindow's close_cb callback to save common prefs to disk, if OK or Apply...
authorAndrej Kacian <ticho@claws-mail.org>
Thu, 27 Aug 2015 10:08:08 +0000 (12:08 +0200)
committerAndrej Kacian <ticho@claws-mail.org>
Fri, 28 Aug 2015 09:39:49 +0000 (11:39 +0200)
Fixes bug #3467.

src/prefs_gtk.c

index 843f9c9..4eb554e 100644 (file)
@@ -934,11 +934,20 @@ void prefs_set_spinbtn(PrefParam *pparam)
 
 static GSList *prefs_pages = NULL;
 
+static void prefs_gtk_window_closed_cb(PrefsWindow *prefswindow)
+{
+       if (prefswindow == NULL)
+               return;
+
+       if (prefswindow->dialog_response > PREFSWINDOW_RESPONSE_CANCEL)
+               prefs_common_write_config();
+}
+
 void prefs_gtk_open(void)
 {
        prefswindow_open(_("Preferences"), prefs_pages, NULL,
                        &prefs_common.prefswin_width, &prefs_common.prefswin_height,
-                       NULL, NULL);
+                       NULL, prefs_gtk_window_closed_cb);
 }
 
 void prefs_gtk_register_page(PrefsPage *page)