Bram,
I noticed the GTK build of gvim does not make use of the browsefilter
variables. So I threw some code at that problem ;)
Find the patch attached.
regards,
Christian
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
diff --git a/src/gui_gtk.c b/src/gui_gtk.c
--- a/src/gui_gtk.c
+++ b/src/gui_gtk.c
@@ -838,7 +838,7 @@
char_u *dflt,
char_u *ext UNUSED,
char_u *initdir,
- char_u *filter UNUSED)
+ char_u *filter)
{
#ifdef USE_FILE_CHOOSER
GtkWidget *fc;
@@ -846,6 +846,7 @@
char_u dirbuf[MAXPATHL];
guint log_handler;
const gchar *domain = "Gtk";
+ GtkFileFilter *gfilter;
title = CONVERT_TO_UTF8(title);
@@ -877,6 +878,44 @@
NULL);
gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(fc),
(const gchar *)dirbuf);
+
+ if (filter != NULL && *filter != NUL)
+ {
+ int i = 0;
+ char_u *patt;
+ char_u *p = filter;
+ gfilter = gtk_file_filter_new();
+
+ patt = alloc(STRLEN(filter));
+ while (p != NULL && *p != NUL)
+ {
+ if (*p == '\n' || *p == ';' || *p == '\t')
+ {
+ STRNCPY(patt, filter, i);
+ patt[i] = '\0';
+ if (*p == '\t')
+ gtk_file_filter_set_name(gfilter, (gchar *) patt);
+ else
+ {
+ gtk_file_filter_add_pattern(gfilter, (gchar *) patt);
+ if (*p == '\n')
+ {
+ gtk_file_chooser_add_filter((GtkFileChooser *) fc, gfilter);
+ if (*(p+1) != NUL)
+ gfilter = gtk_file_filter_new();
+ }
+ }
+ filter = ++p;
+ i = 0;
+ }
+ else
+ {
+ p++;
+ i++;
+ }
+ }
+ vim_free(patt);
+ }
if (saving && dflt != NULL && *dflt != NUL)
gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(fc), (char *)dflt);