[gnome-boxes] media-manager: Fetch languages from Tracker
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] media-manager: Fetch languages from Tracker
- Date: Wed, 30 Apr 2014 17:26:46 +0000 (UTC)
commit 869c1d47fc1e85f12821ca838204ee98e4c29098
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Wed Apr 30 13:14:58 2014 +0200
media-manager: Fetch languages from Tracker
Fetch list of supported languages for each ISO file from Tracker.
https://bugzilla.gnome.org/show_bug.cgi?id=729122
src/media-manager.vala | 24 ++++++++++++++++--------
1 files changed, 16 insertions(+), 8 deletions(-)
---
diff --git a/src/media-manager.vala b/src/media-manager.vala
index a89f152..04a830b 100644
--- a/src/media-manager.vala
+++ b/src/media-manager.vala
@@ -6,7 +6,8 @@ using Tracker;
private class Boxes.MediaManager : Object {
private static MediaManager media_manager;
- private const string SPARQL_QUERY = "SELECT nie:url(?iso) nie:title(?iso) osinfo:id(?iso)
osinfo:mediaId(?iso)" +
+ private const string SPARQL_QUERY = "SELECT nie:url(?iso) nie:title(?iso) nie:language(?iso)" +
+ " osinfo:id(?iso) osinfo:mediaId(?iso)" +
" { ?iso nfo:isBootable true }";
public OSDatabase os_db { get; private set; }
@@ -131,11 +132,14 @@ private class Boxes.MediaManager : Object {
if (path == null)
continue; // FIXME: Support non-local files as well
var title = cursor.get_string (1);
- var os_id = cursor.get_string (2);
- var media_id = cursor.get_string (3);
+ var languages = cursor.get_string (2);
+ var os_id = cursor.get_string (3);
+ var media_id = cursor.get_string (4);
+
+ var lang_list = (languages != null)? languages.split (",") : new string[]{};
try {
- var media = yield create_installer_media_from_iso_info (path, title, os_id, media_id);
+ var media = yield create_installer_media_from_iso_info (path, title, os_id, media_id,
lang_list);
unowned GLib.List<InstallerMedia> dup_node = list.find_custom (media,
compare_media_by_label);
if (dup_node != null) {
// In case of duplicate media, prefer:
@@ -218,10 +222,12 @@ private class Boxes.MediaManager : Object {
}
}
- private async InstallerMedia create_installer_media_from_iso_info (string path,
- string? label,
- string? os_id,
- string? media_id) throws GLib.Error {
+ private async InstallerMedia create_installer_media_from_iso_info (string path,
+ string? label,
+ string? os_id,
+ string? media_id,
+ string[] lang_list = new string[]{})
+ throws GLib.Error {
if (!FileUtils.test (path, FileTest.EXISTS))
throw new Boxes.Error.INVALID (_("No such file %s").printf (path));
@@ -230,6 +236,8 @@ private class Boxes.MediaManager : Object {
var os = yield os_db.get_os_by_id (os_id);
var os_media = os_db.get_media_by_id (os, media_id);
+ foreach (var lang in lang_list)
+ os_media.add_param (Osinfo.MEDIA_PROP_LANG, lang);
var resources = os_db.get_resources_for_os (os, os_media.architecture);
var media = new InstallerMedia.from_iso_info (path, label, os, os_media, resources);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]