[gnome-boxes] wizard: Handle local paths to remote files
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] wizard: Handle local paths to remote files
- Date: Fri, 23 Aug 2013 00:07:05 +0000 (UTC)
commit e898b44181bca83afaae9f96900885a58952fa47
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date: Wed Aug 21 23:38:43 2013 +0300
wizard: Handle local paths to remote files
There are two issues this patch fixes:
* g_file_native() thinks of paths to locally mounted remote locations, as
non-native so Boxes errors out if given such paths. This patch fixes
the issue by replacing g_file_native() usage with a mannual check.
* g_file_get_uri() gives us the remote URI even if you created the GFile
argument using the local path of the remote file. This patch fixes the
issue by using the original commandline argument if the argument is
not a path rathan than URI.
Also we restrict the path/URI to filesystems that we know libvirt/qemu
can handle: local and mounted SMB shares.
https://bugzilla.gnome.org/show_bug.cgi?id=688798
src/app.vala | 10 ++++++++--
src/wizard.vala | 5 +++--
2 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/src/app.vala b/src/app.vala
index 0743e24..10326d7 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -292,8 +292,14 @@ private class Boxes.App: Boxes.UI {
call_when_ready (() => {
var file = File.new_for_commandline_arg (arg);
-
- if (file.query_exists () || Uri.parse_scheme (arg) != null)
+ var is_uri = (Uri.parse_scheme (arg) != null);
+
+ if (file.query_exists ()) {
+ if (is_uri)
+ wizard.open_with_uri (file.get_uri ());
+ else
+ wizard.open_with_uri (arg);
+ } else if (is_uri)
wizard.open_with_uri (file.get_uri ());
else
open (arg);
diff --git a/src/wizard.vala b/src/wizard.vala
index 4b96955..63c6d49 100644
--- a/src/wizard.vala
+++ b/src/wizard.vala
@@ -227,11 +227,12 @@ private class Boxes.Wizard: Boxes.UI {
throw new Boxes.Error.INVALID ("empty location");
var file = location.contains ("://")? File.new_for_uri (location) : File.new_for_path (location);
+ var path = file.get_path ();
- if (file.is_native ()) {
+ if (path != null && (file.has_uri_scheme ("file") || file.has_uri_scheme ("smb"))) {
// FIXME: We should able to handle non-local URIs here too
if (!probing)
- prepare_for_installer (file.get_path ());
+ prepare_for_installer (path);
} else {
bool uncertain;
var uri = file.get_uri ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]