diff options
-rw-r--r-- | src/web-view.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/src/web-view.c b/src/web-view.c index b0c99a2..af69929 100644 --- a/src/web-view.c +++ b/src/web-view.c @@ -801,13 +801,19 @@ mq_web_view_zoom_reset(MqWebView *web_view) static void open_response_cb(GtkWidget *dialog, gint response_id, MqWebView *web_view) { + gchar *dir; gchar *filename; gchar *uri; if (response_id == GTK_RESPONSE_ACCEPT) { - mq_config_set_string(web_view->config, "directories.open-file", - gtk_file_chooser_get_current_folder( - GTK_FILE_CHOOSER(dialog))); + dir = gtk_file_chooser_get_current_folder( + GTK_FILE_CHOOSER(dialog)); + if (dir) { + mq_config_set_string(web_view->config, + "directories.open-file", dir); + g_free(dir); + mq_config_save(web_view->config); + } filename = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER(dialog)); uri = g_strconcat("file://", filename, NULL); @@ -867,14 +873,19 @@ get_clean_title(MqWebView *web_view) static void save_response_cb(GtkWidget *dialog, gint response_id, MqWebView *web_view) { + gchar *dir; gchar *filename; GFile *file; if (response_id == GTK_RESPONSE_ACCEPT) { - mq_config_set_string(web_view->config, "directories.downloads", - gtk_file_chooser_get_current_folder( - GTK_FILE_CHOOSER(dialog))); - mq_config_save(web_view->config); + dir = gtk_file_chooser_get_current_folder( + GTK_FILE_CHOOSER(dialog)); + if (dir) { + mq_config_set_string(web_view->config, + "directories.downloads", dir); + g_free(dir); + mq_config_save(web_view->config); + } filename = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER(dialog)); file = g_file_new_for_path(filename); |