GNOME Bugzilla – Bug 590077
Sort downloads folder by date modified
Last modified: 2010-06-07 13:01:38 UTC
Files in the Downloads folder can add up. At the moment the folder is sorted by name and it can be hard to find the file you recently downloaded. It's easy to forget a filename, and at the moment the download could be listed anywhere in a long wash of icons. It would be much better to immediately see the most recent downloads when I open the folder. Arranging icons by 'Modification Date' and in a 'Reversed Order' seems to solve this problem. Other information: This bug was originally filed as https://bugs.launchpad.net/ubuntu/+source/nautilus/+bug/404150
I agree with this. Typically, a user will have opened this directory in order to open a recently downloaded file. Most recent downloads should therefore be at the top of the list. I've renamed the bug so it is a bit clearer. I hope that's OK.
Created attachment 162580 [details] [review] Set default sort order of download folder to reversed modification date The default sort order of the download folder is only changed if the download folder is not the desktop folder at the same time. Fixes bug 590077
Created attachment 162584 [details] [review] Set default sort order of trash folder to reversed trashed-on time The most useful sorting logic of a trash folder seems to be "show me first what I deleted recently". Use this as default.
The second attachment is more a follow-up on bug 89706, but it uses the logic of the first attachment. I attached it here so that if anybody feels like reviewing, I guess the two should be treated as a unit.
Review of attachment 162580 [details] [review]: Hey Holder, thanks for the nice patch; I inlined some comments below. ::: libnautilus-private/nautilus-file.c @@ +6944,3 @@ + + loc = nautilus_file_get_location (file); + special_gfile = g_file_new_for_path (g_get_user_special_dir (special_directory)); I think it's better to check for a NULL value returned from g_get_user_special_dir() before creating the GFile for it. ::: src/file-manager/fm-icon-view.c @@ +714,3 @@ + /* special handling for certain directories */ + if (file && nautilus_file_is_directory(file)) { Missing space before (file). Also, as you re-use this code both in get_default_sort_in_reverse_order() below and in fm-list-view.c, you should factor it in a separate function (probably in libnautilus-private/nautilus-file-utils.c.
Review of attachment 162584 [details] [review]: You should move this part in a separate function too, according to the previous comment; I also inlined another comment. ::: src/file-manager/fm-icon-view.c @@ +729,3 @@ } + + uri = nautilus_file_get_uri(file); Missing a space before (file). You should also use eel_uri_is_trash() here (the same comment applies below).
Created attachment 162595 [details] [review] Modify default sort order for special directories. Set default sort order of download folder to reversed modification date, but only if the download folder is not the desktop folder at the same time. Fixes bug 590077. Set the default sort order of trash folders to reversed trashed-on times, as the most useful sorting logic of a trash folder seems to be "show me first what I deleted recently".
Thanks a lot for the (ultra-fast!) review and the useful comments, Cosimo. I updated the patches according to your remarks, with one exception: I put the factorized functions not into nautilus-file-utilities, but into nautilus-file, because nautilus-file-utilities works on GFile's instead of NautilusFile's, and I didn't see any benefit in the two extra statements that would be needed for callers to work on the GFile's. Unfortunately, my git-rebase-interactive-foo ended up in accidentally squashing the two commits into one. I figured they are related enough to be fine in one commit, but if it's necessary, I can also separate them again.
Review of attachment 162595 [details] [review]: Hi, thanks for the follow-up. The approach of this updated patch is not really what I had in mind. I inlined some comments below. ::: libnautilus-private/nautilus-file.c @@ +6969,3 @@ + */ +gboolean +nautilus_file_is_download_but_not_desktop_directory (NautilusFile *file) Something this specific should not belong to the nautilus-file.[ch] interface. If you want to use NautilusFile, I'd rather have something like NautilusFileSortType nautilus_file_get_default_sort_type (NautilusFile *file, gboolean * reversed) and const gchar * nautilus_file_gett_default_sort_attribute (NautilusFile *file, gboolean *reversed) that do all the magic for you. @@ +6989,3 @@ + */ +gboolean +nautilus_file_is_trash_directory (NautilusFile *file) This should also be useless with the proposed change.
(In reply to comment #9) > If you want to use NautilusFile, I'd rather have something like > > NautilusFileSortType > nautilus_file_get_default_sort_type (NautilusFile *file, gboolean * reversed) > > and > > const gchar * > nautilus_file_gett_default_sort_attribute (NautilusFile *file, gboolean > *reversed) > > that do all the magic for you. But that's basically how the first version worked, except that reversed and order are in one function except two. The tests will still need to be repeated in icon-view and list-view. Maybe I misunderstood what you meant by "code reuse" in the first place.
I pushed an updated branch based on your patch to master. Closing this bug as FIXED, thanks for the contribution.