[gnome-boxes/dont-offer-eol] os-database: Don't offer EOL OSes to download
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes/dont-offer-eol] os-database: Don't offer EOL OSes to download
- Date: Thu, 8 Feb 2018 12:24:13 +0000 (UTC)
commit 4e5aeaefd4decd3304a99ab80c1755660fcaebd3
Author: Felipe Borges <felipeborges gnome org>
Date: Thu Feb 8 13:22:46 2018 +0100
os-database: Don't offer EOL OSes to download
Fixes #180
src/os-database.vala | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
---
diff --git a/src/os-database.vala b/src/os-database.vala
index 64c21686..d636cae2 100644
--- a/src/os-database.vala
+++ b/src/os-database.vala
@@ -105,6 +105,12 @@ public async Os get_os_by_id (string id) throws OSDatabaseError {
if (!yield ensure_db_loaded ())
throw new OSDatabaseError.DB_LOADING_FAILED ("Failed to load OS database");
+ int year, month, day;
+ var date_time = new DateTime.now_local ();
+ date_time.get_ymd (out year, out month, out day);
+ var now = Date ();
+ now.set_dmy ((DateDay) day, month, (DateYear) year);
+
var after_list = new GLib.List<Osinfo.Media> ();
foreach (var entity in db.get_os_list ().get_elements ()) {
var os = entity as Os;
@@ -115,7 +121,11 @@ public async Os get_os_by_id (string id) throws OSDatabaseError {
foreach (var media_entity in os.get_media_list ().get_elements ()) {
var media = media_entity as Media;
- if (media.url != null)
+ if (media.url == null)
+ continue;
+
+ var eol = (os as Product).get_eol_date ();
+ if (eol == null || now.compare (eol) > 1)
after_list.append (media);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]