[gnome-boxes] Add spice+unix support



commit e1fa2e05c6171b826714f7b24ff94fcf5083dc57
Author: Marc-André Lureau <marcandre lureau gmail com>
Date:   Wed Jan 21 16:48:28 2015 +0100

    Add spice+unix support
    
    Spice-gtk allows to connect to a UNIX socket server since v0.28.
    Let's teach Boxes to deal with spice+unix:// URI.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=743303

 src/spice-display.vala |   12 ++++++++++--
 src/wizard.vala        |    3 ++-
 2 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/src/spice-display.vala b/src/spice-display.vala
index 311f2fe..218737f 100644
--- a/src/spice-display.vala
+++ b/src/spice-display.vala
@@ -553,6 +553,14 @@ static void spice_validate_uri (string uri_as_text,
             tls_port = int.parse (query.get ("tls-port"));
     }
 
-    if (port <= 0 && tls_port <= 0)
-        throw new Boxes.Error.INVALID (_("Missing port in Spice URI"));
+    if (uri.scheme == "spice+unix") {
+        if (port > 0 ||
+            (uri.query_raw ?? uri.query) != null)
+            throw new Boxes.Error.INVALID (_("Invalid Spice UNIX URI"));
+    } else if (uri.scheme.has_prefix("spice+")) {
+        throw new Boxes.Error.INVALID (_("Invalid URI"));
+    } else {
+        if (port <= 0 && tls_port <= 0)
+            throw new Boxes.Error.INVALID (_("Missing port in Spice URI"));
+    }
 }
diff --git a/src/wizard.vala b/src/wizard.vala
index 0cc8343..dbfe062 100644
--- a/src/wizard.vala
+++ b/src/wizard.vala
@@ -322,8 +322,9 @@ private class Boxes.Wizard: Gtk.Stack, Boxes.UI {
 
         source = new CollectionSource (uri.server ?? uri_as_text, uri.scheme, uri_as_text);
 
-        if (uri.scheme == "spice") {
+        if (uri.scheme == "spice" || uri.scheme.has_prefix("spice+")) {
             spice_validate_uri (uri_as_text);
+            source.source_type = "spice";
         } else if (uri.scheme == "vnc") {
             // accept any vnc:// uri
         } else if (uri.scheme.has_prefix ("qemu")) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]