[gnome-boxes] media-manager: Sort media by vendor & release date
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] media-manager: Sort media by vendor & release date
- Date: Wed, 20 Apr 2016 12:05:16 +0000 (UTC)
commit 6b5c6667f9182fc4f382b13bc8f0e870ed632e72
Author: Visarion Alexandru <viorel visarion gmail com>
Date: Tue Apr 19 23:44:48 2016 +0300
media-manager: Sort media by vendor & release date
Sort the media by vendor and, within each vendor, by the release date.
https://bugzilla.gnome.org/show_bug.cgi?id=691790
src/media-manager.vala | 21 ++++++++++++++++++++-
1 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/src/media-manager.vala b/src/media-manager.vala
index 52c94a7..59842c7 100644
--- a/src/media-manager.vala
+++ b/src/media-manager.vala
@@ -145,7 +145,7 @@ private class Boxes.MediaManager : Object {
continue;
}
- list.insert_sorted (media, compare_media_by_label);
+ list.insert_sorted (media, compare_media_by_vendor);
} catch (GLib.Error error) {
warning ("Failed to use ISO '%s': %s", path, error.message);
}
@@ -217,6 +217,25 @@ private class Boxes.MediaManager : Object {
}
}
+ private static int compare_media_by_vendor (InstallerMedia media_a, InstallerMedia media_b) {
+ if (media_a.os == null) {
+ if (media_b.os == null)
+ return 0;
+ else
+ return 1;
+ } else if (media_b.os == null)
+ return -1;
+ else {
+ var vendor_comparison = strcmp (media_a.os.get_vendor (), media_b.os.get_vendor ());
+
+ if (vendor_comparison == 0)
+ // Within each vendor, list latest release date first
+ return compare_media_by_release_date (media_a, media_b);
+ else
+ return vendor_comparison;
+ }
+ }
+
private async InstallerMedia create_installer_media_from_iso_info (string path,
string? label,
string? os_id,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]