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 691800 - Sort pictures by date
Sort pictures by date
Status: RESOLVED FIXED
Product: gnome-control-center
Classification: Core
Component: Background
3.7.x
Other Linux
: Normal normal
: ---
Assigned To: Control-Center Maintainers
Control-Center Maintainers
Depends on:
Blocks:
 
 
Reported: 2013-01-15 17:44 UTC by Michael Wood
Modified: 2013-03-01 11:32 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Sort background pictures by most recent (5.73 KB, patch)
2013-01-25 12:36 UTC, Michael Wood
reviewed Details | Review
background-Sort-Pictures-in-order-of-most-recently fixup (5.73 KB, patch)
2013-01-28 11:32 UTC, Michael Wood
committed Details | Review
background: Offload the sorting of the initial list of files (9.37 KB, patch)
2013-02-03 09:41 UTC, Michael Wood
reviewed Details | Review
background: Offload the sorting of the initial list of files (9.27 KB, patch)
2013-02-19 15:00 UTC, Michael Wood
committed Details | Review

Description Michael Wood 2013-01-15 17:44:42 UTC
It would be good if when selecting the Pictures folder for the wallpaper chooser it was sorted by date instead of alphabetical. Most of my pictures have pretty useless file names.

If this is agreed I can write a patch for this.
Comment 1 Michael Wood 2013-01-25 12:36:07 UTC
Created attachment 234383 [details] [review]
Sort background pictures by most recent

bug confirmed by jimmac. Patch attached.
Comment 2 Bastien Nocera 2013-01-27 19:04:32 UTC
Review of attachment 234383 [details] [review]:

Looks good otherwise.

::: panels/background/cc-background-item.c
@@ +51,3 @@
         gboolean         needs_download;
         CcBackgroundItemFlags flags;
+        guint            modified;

Why store a uint64 in a guint?
Comment 3 Michael Wood 2013-01-28 11:32:26 UTC
Created attachment 234606 [details] [review]
background-Sort-Pictures-in-order-of-most-recently fixup

Thanks for the review.
Comment 4 Bastien Nocera 2013-01-28 12:44:28 UTC
Review of attachment 234606 [details] [review]:

Looks good, though I would have sorted by date and then by name, but the likelihood of having 2 files with the same mtime is pretty small.
Comment 5 Michael Wood 2013-02-03 09:41:09 UTC
Created attachment 235093 [details] [review]
background: Offload the sorting of the initial list of files

We can offload some of the work of the initial sorting by sorting the list of files before they're added to the icon view
Comment 6 Michael Wood 2013-02-07 15:27:41 UTC
Additional patch to improve performance
Comment 7 Bastien Nocera 2013-02-11 13:39:20 UTC
(In reply to comment #6)
> Additional patch to improve performance

You could have created a new bug about this.

You'll need to check whether it conflicts with the patch from bug 693506 which removes the use of a GtkIconView.
Comment 8 Michael Wood 2013-02-11 18:15:24 UTC
The patches in #693506 applied cleanly, apologise for not opening a new bug, I can do so if that would still be useful.
Comment 9 Bastien Nocera 2013-02-18 15:53:54 UTC
Review of attachment 235093 [details] [review]:

Looks good otherwise.

::: panels/background/bg-pictures-source.c
@@ +291,3 @@
   /* create a new CcBackgroundItem */
   uri = g_file_get_uri (file);
+  mtime =

same line, I have a wide monitor.

@@ +384,3 @@
+  guint64 modified_a, modified_b;
+
+  modified_a =

Ditto.

@@ +388,3 @@
+                                      G_FILE_ATTRIBUTE_TIME_MODIFIED);
+
+  modified_b =

Ditto.

@@ +536,3 @@
+
+  gtk_tree_model_get (model, a,
+                      1, &item_a,

Need to use symbolic names for the column numbers.

@@ +539,3 @@
+                      -1);
+  gtk_tree_model_get (model, b,
+                      1, &item_b,

Ditto.

@@ +594,3 @@
+
+  gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (store),
+                                   1,

Ditto.
Comment 10 Michael Wood 2013-02-19 15:00:07 UTC
Created attachment 236770 [details] [review]
background: Offload the sorting of the initial list of files

Updated style changes
Comment 11 Bastien Nocera 2013-02-26 13:58:42 UTC
Review of attachment 236770 [details] [review]:

Looks fine.
Comment 12 Thomas Wood 2013-03-01 11:32:10 UTC
Attachment 236770 [details] pushed as 09baf81 - background: Offload the sorting of the initial list of files