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 418219 - GtkRecentChooser should apply filter before sorting and clamping the list
GtkRecentChooser should apply filter before sorting and clamping the list
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Class: GtkRecent
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Emmanuele Bassi (:ebassi)
Emmanuele Bassi (:ebassi)
Depends on:
Blocks:
 
 
Reported: 2007-03-14 13:59 UTC by Emmanuele Bassi (:ebassi)
Modified: 2007-03-15 10:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch fixing the problem (17.52 KB, patch)
2007-03-14 14:02 UTC, Emmanuele Bassi (:ebassi)
accepted-commit_now Details | Review

Description Emmanuele Bassi (:ebassi) 2007-03-14 13:59:53 UTC
at the moment, all the GtkRecentChooser implementations sort and clamp the recent files list they get from the GtkRecentManager and then apply the currently set filter.

on IRC, paolo borelli pointed out that this is wrong, and at least the clamping should be done on the already filtered list, otherwise any filtered list will often be smaller than the required clamp limit (this seems to create a visual difference between the list of files in the menu and the one inside the toolbar, in gedit).
Comment 1 Emmanuele Bassi (:ebassi) 2007-03-14 14:02:18 UTC
Created attachment 84572 [details] [review]
patch fixing the problem

this patch fixes this problem, by moving the filtering inside the private implementation of GtkRecentChooser::get_items shared by all the GtkRecentChooser widges. the filtering is done before sorting and clamping the list.
Comment 2 Matthias Clasen 2007-03-15 02:53:00 UTC
Makes sense, please commit to both branches if you want
Comment 3 Emmanuele Bassi (:ebassi) 2007-03-15 10:25:36 UTC
fixed in trunk, testing in the stable branch.

2007-03-15  Emmanuele Bassi  <ebassi@gnome.org>

        * gtk/gtkrecentchooserprivate.h:
        * gtk/gtkrecentchooserutils.c: Move filtering of the recent
        files list into the shared implementation; do the filtering
        before the sorting, so that we always clamp on the desired
        size. (#418219)

        * gtk/gtkrecentchoosermenu.c: Remove the filtering of the
        list, as it's already been done.

        * gtk/gtkrecentchooserdefault.c: Ditto; also remove the
        GtkTreeModelFilter: just reload the view if the sorting and
        filtering properties change.

        * gtk/testrecentchoosermenu.c: Exercise the limit property
Comment 4 Emmanuele Bassi (:ebassi) 2007-03-15 10:48:40 UTC
now committed to the stable branch too, together with the clean ups attached to the bug #338843.

2007-03-15  Emmanuele Bassi  <ebassi@gnome.org>

        Merge from trunk:

        * gtk/gtkrecentchooserprivate.h:
        * gtk/gtkrecentchooserutils.c: Share between the widgets
        the recent chooser function for getting the filtered, sorted
        and clamped list of recent files from the manager. (#418219)

        * gtk/gtkrecentchoosermenu.c: Use the newly defined
        _gtk_recent_chooser_get_items() function; remove some
        pointer indirections.

        * gtk/gtkrecentchooserdefault.c: Reload the items every time
        a property affecting the view is changed; move the objects
        unref and the source removal into the dispose function; use
        the newly defined _gtk_recent_chooser_get_items()
        function. (see #338843)