diff options
-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); } |