diff options
author | Patrick McDermott <pj@pehjota.net> | 2017-10-28 22:05:17 (EDT) |
---|---|---|
committer | Patrick McDermott <pj@pehjota.net> | 2017-10-28 22:05:17 (EDT) |
commit | 152cbaf340412b1753c6ddf8345a35c2982520db (patch) | |
tree | 88846f736ef7587f5f0757820b0c4d226f334187 | |
parent | 0f527746acc7a5e470d46c117b7cdb6317c07566 (diff) | |
download | marquee-152cbaf340412b1753c6ddf8345a35c2982520db.zip marquee-152cbaf340412b1753c6ddf8345a35c2982520db.tar.gz marquee-152cbaf340412b1753c6ddf8345a35c2982520db.tar.bz2 |
mq_web_view_open(), mq_web_view_save(): Add file filters to file choosers
-rw-r--r-- | src/web-view.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/web-view.c b/src/web-view.c index 1f71e32..e9e25ad 100644 --- a/src/web-view.c +++ b/src/web-view.c @@ -799,6 +799,40 @@ mq_web_view_zoom_reset(MqWebView *web_view) } static void +add_chooser_filters(GtkFileChooser *chooser) +{ + GtkFileFilter *filter; + + filter = gtk_file_filter_new(); + gtk_file_filter_set_name(filter, "All files"); + gtk_file_filter_add_pattern(filter, "*"); + gtk_file_chooser_add_filter(chooser, filter); + + filter = gtk_file_filter_new(); + gtk_file_filter_set_name(filter, "All Web pages"); + gtk_file_filter_add_pattern(filter, "*.htm"); + gtk_file_filter_add_pattern(filter, "*.html"); + gtk_file_filter_add_pattern(filter, "*.mht"); + gtk_file_filter_add_pattern(filter, "*.mhtm"); + gtk_file_filter_add_pattern(filter, "*.mhtml"); + gtk_file_chooser_add_filter(chooser, filter); + + filter = gtk_file_filter_new(); + gtk_file_filter_set_name(filter, "HTML documents (*.htm, *.html)"); + gtk_file_filter_add_pattern(filter, "*.htm"); + gtk_file_filter_add_pattern(filter, "*.html"); + gtk_file_chooser_add_filter(chooser, filter); + + filter = gtk_file_filter_new(); + gtk_file_filter_set_name(filter, + "MHTML documents (*.mht, *.mhtm, *.mhtml)"); + gtk_file_filter_add_pattern(filter, "*.mht"); + gtk_file_filter_add_pattern(filter, "*.mhtm"); + gtk_file_filter_add_pattern(filter, "*.mhtml"); + gtk_file_chooser_add_filter(chooser, filter); +} + +static void open_response_cb(GtkWidget *dialog, gint response_id, MqWebView *web_view) { gchar *dir; @@ -850,6 +884,8 @@ mq_web_view_open(MqWebView *web_view) /* TODO: Consider setting chooser's folder from current file-scheme URI, * if any. */ g_free(dir); + + add_chooser_filters(chooser); } static void @@ -933,4 +969,6 @@ mq_web_view_save(MqWebView *web_view) g_free(title); gtk_file_chooser_set_current_name(chooser, filename); g_free(filename); + + add_chooser_filters(chooser); } |