Re: [gtk-list] Re: File selection



On Wed, 28 Jan 1998, George wrote:

> Quoting Josh MacDonald (jmacd@CS.Berkeley.EDU):
> > Instead, add a [TIP] button that comes up with a dialog saying, 
> > 
> > 	"Did you know that the GTK file selection can filter?
> > 	 Just type in a shell wildcard expression and hit tab."
> 
> btw is there a way to set the default filter .... I know we were designing
> an app where we were using a dialog to find a file ... the file was of 
> one name but was a in directories with tons of other files which we
> NEVER needed to open in that app ... the users are not so highly 
> computer literate .. and having them wage though a 100 files to find the
> right file just didn't fly ... having them type in the filter didn't fly
> either ... this was one of the reasons we had to pull away from java ...
> (and the second reson being that it was driving me nuts) ...
> 
> it's not really a filter, but filename compeletition (seems ala-zsh) ...	
> I would like to maybe set a regexp filter as well ... (it doesn't have to
> be there for most apps, but in some apps it just makes a lot of sense,
> like our file picker for reading HPLC data ....)

It handles a minimal set of regexp in the entry already (via tab
completion - try hitting "*.c<TAB>" in the entry).  Just looking at the
code, I see you could just use: 

gtk_file_selection_set_filename (GtkFileSelection *filesel,
                                 const gchar      *filename)

This takes the string in and goes to that directory.  However, it doesn't
attempt command line completion, and puts a trailing '/' so it wouldn't
work anyway.  It would be trivial to change it though, if people think
it's a good idea.

This would allow you to do something like:

gtk_file_selection_set_filename (filesel, "/some/path/*.xpm")

And have it list all the *.xpm files in that dir.  However, if you
wanted to show the entire contents of a directory, you'd have
to remember to have a trailing '/'.

The only problem with the whole command-line completion style filter is
that it disappears as soon as you change directories.

	Ian




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]