summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <pj@pehjota.net>2017-10-28 21:55:08 (EDT)
committer Patrick McDermott <pj@pehjota.net>2017-10-28 21:55:08 (EDT)
commit0f527746acc7a5e470d46c117b7cdb6317c07566 (patch)
tree81da5980479dea12c5afcee3a0e92a6bcd7a421b
parent391f2dc90dc5e015c0f66d958ce25e6300073992 (diff)
downloadmarquee-0f527746acc7a5e470d46c117b7cdb6317c07566.zip
marquee-0f527746acc7a5e470d46c117b7cdb6317c07566.tar.gz
marquee-0f527746acc7a5e470d46c117b7cdb6317c07566.tar.bz2
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.
-rw-r--r--src/web-view.c16
1 files changed, 10 insertions, 6 deletions
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);
}