[gnome-boxes/osinfo-from-server: 52/53] downloadable-entry: Allow recommended-downloads to override media properties
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes/osinfo-from-server: 52/53] downloadable-entry: Allow recommended-downloads to override media properties
- Date: Thu, 4 Aug 2022 09:03:59 +0000 (UTC)
commit e456fb3c4f67663fe29712d40f57f5ca72f190ec
Author: Felipe Borges <felipeborges gnome org>
Date: Wed Aug 3 13:44:21 2022 +0200
downloadable-entry: Allow recommended-downloads to override media properties
This way we can override name, download_url and subtitle for entries
in the recommended-downloads files.
src/assistant/downloadable-entry.vala | 5 +++--
src/util-app.vala | 12 ++++++++++++
2 files changed, 15 insertions(+), 2 deletions(-)
---
diff --git a/src/assistant/downloadable-entry.vala b/src/assistant/downloadable-entry.vala
index 14271269..8fbb89a0 100644
--- a/src/assistant/downloadable-entry.vala
+++ b/src/assistant/downloadable-entry.vala
@@ -6,8 +6,9 @@
this.os = media.os;
url = media.url;
- title = serialize_os_title (media);
- subtitle = media.os.vendor;
+
+ title = media.get_data ("title") ?? serialize_os_title (media);
+ subtitle = media.get_data ("subtitle") ?? media.os.vendor;
set_tooltip_text (media.url ?? title);
Downloader.fetch_os_logo.begin (media_image, os, 64);
diff --git a/src/util-app.vala b/src/util-app.vala
index 9fbbe55c..c0a42a94 100644
--- a/src/util-app.vala
+++ b/src/util-app.vala
@@ -253,6 +253,18 @@ private async GLib.List<Osinfo.Media>? parse_recommended_downloads_file (string
var media = os.get_media_list ().get_nth (0) as Osinfo.Media;
if (media.url != null || os_id.has_prefix ("http://redhat.com"))
list.append (media);
+
+ for (Xml.Node* child_iter = iter->children; child_iter != null; child_iter = child_iter->next) {
+ if (child_iter->type != Xml.ElementType.ELEMENT_NODE)
+ continue;
+
+ string content = child_iter->get_content ();
+ string node_name = child_iter->name;
+ if (node_name == "url")
+ media.url = content;
+ else
+ media.set_data (node_name, content);
+ }
}
return list;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]