[gnome-boxes/wip/system-libvirt-import2: 8/13] installed-media: Provide a sync constructor as well
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes/wip/system-libvirt-import2: 8/13] installed-media: Provide a sync constructor as well
- Date: Sat, 16 Nov 2013 19:39:17 +0000 (UTC)
commit edb2e54c0ac8069f52cab68078715d01d2c6891a
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Wed Nov 13 19:08:08 2013 +0000
installed-media: Provide a sync constructor as well
This is mainly needed as workaround for bug#712186 when we subclass
InstalledMedia in a following patch in this series.
src/installed-media.vala | 8 +++++++-
src/media-manager.vala | 4 ++--
2 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/src/installed-media.vala b/src/installed-media.vala
index 31e41bc..e8d61ab 100644
--- a/src/installed-media.vala
+++ b/src/installed-media.vala
@@ -36,7 +36,7 @@ private class Boxes.InstalledMedia : Boxes.InstallerMedia {
}
}
- public async InstalledMedia (string path, MediaManager media_manager) throws GLib.Error {
+ public InstalledMedia (string path) throws GLib.Error {
var supported = false;
foreach (var extension in supported_extensions) {
supported = path.has_suffix (extension);
@@ -50,6 +50,12 @@ private class Boxes.InstalledMedia : Boxes.InstallerMedia {
device_file = path;
from_image = true;
+ label_setup ();
+ }
+
+ public async InstalledMedia.guess_os (string path, MediaManager media_manager) throws GLib.Error {
+ this (path);
+
if (path.contains ("gnome-continuous") || path.contains ("gnome-ostree")) {
try {
os = yield media_manager.os_db.get_os_by_id ("http://gnome.org/continuous/3.10");
diff --git a/src/media-manager.vala b/src/media-manager.vala
index d38bf1c..f83cb78 100644
--- a/src/media-manager.vala
+++ b/src/media-manager.vala
@@ -30,7 +30,7 @@ private class Boxes.MediaManager : Object {
if (is_mime_type (path, "application/x-cd-image"))
media = yield new InstallerMedia.for_path (path, this, cancellable);
else
- media = yield new InstalledMedia (path, this);
+ media = yield new InstalledMedia.guess_os (path, this);
return create_installer_media_from_media (media);
}
@@ -42,7 +42,7 @@ private class Boxes.MediaManager : Object {
if (VMConfigurator.is_import_config (config))
try {
- return yield new InstalledMedia (path, this);
+ return yield new InstalledMedia.guess_os (path, this);
} catch (GLib.Error error) {
debug ("%s", error.message);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]