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 683999 - Recent items list should recalculate itself when GTK FileFilter is used
Recent items list should recalculate itself when GTK FileFilter is used
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: Widget: GtkFileChooser
3.4.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
Federico Mena Quintero
Depends on:
Blocks: 682886
 
 
Reported: 2012-09-14 02:13 UTC by Jean-François Fortin Tam
Modified: 2018-04-15 00:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Only include recent files that match filter (3.07 KB, patch)
2013-07-09 11:33 UTC, Jonas Danielsson
none Details | Review
Add limit to visible nodes (4.01 KB, patch)
2013-07-09 13:02 UTC, Jonas Danielsson
none Details | Review
Set limit on visible recent files (3.02 KB, patch)
2013-07-09 13:02 UTC, Jonas Danielsson
none Details | Review

Description Jean-François Fortin Tam 2012-09-14 02:13:48 UTC
Let's say you have this piece of code:

chooser = Gtk.FileChooserDialog(_("Open File..."),
            self, action=Gtk.FileChooserAction.OPEN,
            buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
                     Gtk.STOCK_OPEN, Gtk.ResponseType.OK))
for format in formats:
    filt = Gtk.FileFilter()
    filt.set_name("foo project files")
    filt.add_pattern("*.foo")
    chooser.add_filter(filt)


Now, the problem is that the filechooser limits the amount of recently used items shown by default... but does not take filters into account. So if you used a bunch of other files recently but not any *.foo files, you'll end up with an empty list because the filter is filtering an already limited list. If the FileFilter had access to the unlimited list, the "foo" files would show up.
Comment 1 Jean-François Fortin Tam 2012-09-14 02:15:24 UTC
This prevents being able to simply rely on the filechooser's "Recent items" view in pitivi's "Open project..." dialog.
Comment 2 Jonas Danielsson 2013-07-09 11:33:01 UTC
Created attachment 248705 [details] [review]
Only include recent files that match filter

One way of doing it would be to check against the filter when getting the recent files. And only include the ones that match.

This way it still checks against the limit, but only ticks up against it if the recent file matches the current filter.

The problem with this is that the filter is applied more than once and is not needed later since only matching files are added to the model.

Comments? What would be a better approach?
Comment 3 Jonas Danielsson 2013-07-09 13:01:43 UTC
Another way of doing it would be to not apply any limit while getting the recent items (an unlimited list)

And then add the possibility to limit visible nodes in the gtkfilesystemmodel, and set that limit to the gtk-recent-files-limit.

Two patches below, one against gtkfilesystemmodel and one against gtkfilechooserdefault.
Comment 4 Jonas Danielsson 2013-07-09 13:02:10 UTC
Created attachment 248719 [details] [review]
Add limit to visible nodes
Comment 5 Jonas Danielsson 2013-07-09 13:02:35 UTC
Created attachment 248720 [details] [review]
Set limit on visible recent files
Comment 6 Matthias Clasen 2018-02-10 05:25:06 UTC
We're moving to gitlab! As part of this move, we are moving bugs to NEEDINFO if they haven't seen activity in more than a year. If this issue is still important to you and still relevant with GTK+ 3.22 or master, please reopen it and we will migrate it to gitlab.
Comment 7 Matthias Clasen 2018-04-15 00:33:30 UTC
As announced a while ago, we are migrating to gitlab, and bugs that haven't seen activity in the last year or so will be not be migrated, but closed out in bugzilla.

If this bug is still relevant to you, you can open a new issue describing the symptoms and how to reproduce it with gtk 3.22.x or master in gitlab:

https://gitlab.gnome.org/GNOME/gtk/issues/new