[gnome-boxes] ovirt: Allow creating oVirt sources



commit 7be0e61bde93429c756aaf265069ce820b1fbffe
Author: Christophe Fergeau <cfergeau redhat com>
Date:   Mon Sep 3 15:19:24 2012 +0200

    ovirt: Allow creating oVirt sources
    
    We expect an ovirt:// URI scheme and turn that into an https:// URI.
    There is no support for asking the user for authentication credentials
    at the moment.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=681747

 src/app.vala    |    4 ++++
 src/wizard.vala |    6 ++++--
 2 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/app.vala b/src/app.vala
index 472f092..4cba1ef 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -186,6 +186,10 @@ private class Boxes.App: Boxes.UI {
         check_module_kvm_loaded.begin ();
     }
 
+    public bool has_broker_for_source_type (string type) {
+        return brokers.contains (type);
+    }
+
     public delegate void CallReadyFunc ();
     public void call_when_ready (CallReadyFunc func) {
         if (is_ready)
diff --git a/src/wizard.vala b/src/wizard.vala
index 225bd6e..723922e 100644
--- a/src/wizard.vala
+++ b/src/wizard.vala
@@ -150,7 +150,7 @@ private class Boxes.Wizard: Boxes.UI {
             try {
                 prepare_for_location (this.wizard_source.uri, true);
 
-                if (source != null && source.source_type == "libvirt") {
+                if (source != null && App.app.has_broker_for_source_type (source.source_type)) {
                     text = _("Will add boxes for all systems available from this account.");
                     icon = "network-workgroup";
                 } else
@@ -259,6 +259,8 @@ private class Boxes.Wizard: Boxes.UI {
         } else if (uri.scheme.has_prefix ("qemu")) {
             // accept any qemu..:// uri
             source.source_type = "libvirt";
+        } else if (App.app.has_broker_for_source_type (uri.scheme)) {
+            source.source_type = uri.scheme;
         } else
             throw new Boxes.Error.INVALID (_("Unsupported protocol '%s'").printf (uri.scheme));
     }
@@ -419,7 +421,7 @@ private class Boxes.Wizard: Boxes.UI {
                 break;
             }
 
-            if (source.source_type == "libvirt") {
+            if (App.app.has_broker_for_source_type (source.source_type)) {
                 review_label.set_text (_("Will add boxes for all systems available from this account:"));
             }
         } else if (libvirt_machine != null) {



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