From 0f527746acc7a5e470d46c117b7cdb6317c07566 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Sat, 28 Oct 2017 21:55:08 -0400 Subject: mq_web_view_open(), mq_web_view_save(): Add blank lines and rearrange lines Try to make the code a little more readable and maintainable. --- (limited to 'src') diff --git a/src/web-view.c b/src/web-view.c index 02365f9..1f71e32 100644 --- a/src/web-view.c +++ b/src/web-view.c @@ -838,7 +838,11 @@ mq_web_view_open(MqWebView *web_view) "_Cancel", GTK_RESPONSE_CANCEL, "_Open", GTK_RESPONSE_ACCEPT, NULL); + g_signal_connect(dialog, "response", + G_CALLBACK(open_response_cb), web_view); + gtk_widget_show_all(dialog); chooser = GTK_FILE_CHOOSER(dialog); + dir = mq_config_get_string(web_view->config, "directories.open-file"); if (dir && dir[0]) { gtk_file_chooser_set_current_folder(chooser, dir); @@ -846,9 +850,6 @@ mq_web_view_open(MqWebView *web_view) /* TODO: Consider setting chooser's folder from current file-scheme URI, * if any. */ g_free(dir); - g_signal_connect(dialog, "response", - G_CALLBACK(open_response_cb), web_view); - gtk_widget_show_all(dialog); } static void @@ -916,17 +917,20 @@ mq_web_view_save(MqWebView *web_view) "_Cancel", GTK_RESPONSE_CANCEL, "_Save", GTK_RESPONSE_ACCEPT, NULL); + g_signal_connect(dialog, "response", + G_CALLBACK(save_response_cb), web_view); + gtk_widget_show_all(dialog); chooser = GTK_FILE_CHOOSER(dialog); + gtk_file_chooser_set_do_overwrite_confirmation(chooser, TRUE); + dir = mq_config_get_string(web_view->config, "directories.downloads"); gtk_file_chooser_set_current_folder(chooser, dir); g_free(dir); + title = get_clean_title(web_view); filename = g_strconcat(title, ".mhtml", NULL); g_free(title); gtk_file_chooser_set_current_name(chooser, filename); g_free(filename); - g_signal_connect(dialog, "response", - G_CALLBACK(save_response_cb), web_view); - gtk_widget_show_all(dialog); } -- cgit v0.9.1