After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 320295 - FileChooser save dialog doesn't use filters for autocomplete
FileChooser save dialog doesn't use filters for autocomplete
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Widget: GtkFileChooser
2.8.x
Other Linux
: Normal enhancement
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2005-10-31 08:37 UTC by Danielle Madeley
Modified: 2018-02-10 04:36 UTC
See Also:
GNOME target: ---
GNOME version: 2.9/2.10



Description Danielle Madeley 2005-10-31 08:37:18 UTC
Distribution/Version: FC4

I have a FileChooser with several filters applied. I have chosen a default
filter (it filters on the pattern *.cols). When I use the filename entry box it
matches on every file in the directory, not just the ones that have the .cols
extension.

It is my opinion that it should only autocomplete on those filenames, if a user
wishes to autocomplete on all filenames, they should expand the dialog and
change the filter.
Comment 1 Federico Mena Quintero 2005-11-11 20:56:54 UTC
Hmm, this is debatable.  I'd love to see how it works in practice.

Want to cook a patch?  I can point you to the relevant code.
Comment 2 David Tombs 2010-01-21 23:06:59 UTC
I could try making a patch. Where should I start? :)

Please point me to the code that would need to be patched as well as the code that filters the file display. Thank you!
Comment 3 Federico Mena Quintero 2010-01-22 18:39:05 UTC
The main code for the file chooser is gtk+/gtk/gtkfilechooserdefault.c.

The entry with completion is in gtk+/gtk/gtkfilechooserentry.c.
Comment 4 Federico Mena Quintero 2010-01-22 18:51:25 UTC
In gtkfilechooserentry.c, you may want to start by reading the functions start_autocompletion() and start_explicit_completion(), and start_loading_current_folder().

Right now GtkFileChooserEntry doesn't know which filter the file chooser is using; you would need to communicate the filter to the entry.  The function populate_completion_store() is where the current folder is finished loading, and the entry looks at the files to build the completion list.  There, the entry creates its own GtkListStore and puts file info in it.  You *may* want to see if you can use a GtkFileSystemModel instead of that home-grown code to read directories and populate list stores, as GtkFileSystemModel is much faster and smarter about filtering in general.
Comment 5 David Tombs 2010-01-29 02:42:23 UTC
OK, Federico, I've taken my first look at the code. I'm not a gnome developer so my patch--if I made one--would be trash I'm sure. Is your goal for the patch just to see if you like the behavior? If so, I can hack that up, but don't count on my for good design. (Especially regarding how to make the FileChooserEntry aware of the filter.)
Comment 6 Federico Mena Quintero 2010-01-29 16:07:48 UTC
Don't worry about the quality of your first patch; we can polish it later.  Yeah, I'd like to see how the file chooser feels with that behavior... I *think* completion should show you all the files, not just the filtered ones (as you are typing things explicitly instead of just picking from a file list), but let's see how that goes.

To make the entry aware of the filter, you can simply add a gtk_file_chooser_entry_set_filter(entry, filter) function.
Comment 7 David Tombs 2010-05-31 16:18:07 UTC
I guess this has become apparent, but I think this patch would be a little over my head since I haven't done much GTK programming (even at the consumption level). Sorry for dropping the ball.
Comment 8 Matthias Clasen 2018-02-10 04:36:40 UTC
We're moving to gitlab! As part of this move, we are closing bugs that haven't seen activity in more than 5 years. If this issue is still imporant to you and
still relevant with GTK+ 3.22 or master, please consider creating a gitlab issue
for it.