From 1fd565cba706d6a9e809d14f79ceb92633b62ead Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Mon, 28 Apr 2014 16:37:00 +0100 Subject: make GTK configuration handling conform to XDG specification. --- gtk/dialogs/preferences.c | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) (limited to 'gtk/dialogs/preferences.c') diff --git a/gtk/dialogs/preferences.c b/gtk/dialogs/preferences.c index a8ff67465..fcf30c8fa 100644 --- a/gtk/dialogs/preferences.c +++ b/gtk/dialogs/preferences.c @@ -19,6 +19,7 @@ #include #include +#include "utils/filepath.h" #include "utils/log.h" #include "utils/utils.h" #include "utils/messages.h" @@ -1001,8 +1002,14 @@ nsgtk_preferences_fileChooserDownloads_realize(GtkWidget *widget, G_MODULE_EXPORT void nsgtk_preferences_dialogPreferences_response(GtkDialog *dlg, gint resid) { + char *choices; + if (resid == GTK_RESPONSE_CLOSE) { - nsoption_write(options_file_location, NULL, NULL); + choices = filepath_append(nsgtk_config_home, "Choices"); + if (choices != NULL) { + nsoption_write(choices, NULL, NULL); + free(choices); + } gtk_widget_hide(GTK_WIDGET(dlg)); } } @@ -1011,18 +1018,32 @@ G_MODULE_EXPORT gboolean nsgtk_preferences_dialogPreferences_deleteevent(GtkDialog *dlg, struct ppref *priv) { - nsoption_write(options_file_location, NULL, NULL); + char *choices; + + choices = filepath_append(nsgtk_config_home, "Choices"); + if (choices != NULL) { + nsoption_write(choices, NULL, NULL); + free(choices); + } + gtk_widget_hide(GTK_WIDGET(dlg)); - /* delt with it by hiding window, no need to destory widget by - * default */ + /* Delt with it by hiding window, no need to destory widget by + * default. + */ return TRUE; } G_MODULE_EXPORT void nsgtk_preferences_dialogPreferences_destroy(GtkDialog *dlg, struct ppref *priv) { - nsoption_write(options_file_location, NULL, NULL); + char *choices; + + choices = filepath_append(nsgtk_config_home, "Choices"); + if (choices != NULL) { + nsoption_write(choices, NULL, NULL); + free(choices); + } } -- cgit v1.2.3