[gnome-boxes/gnome-3-12] libvirt-sys-importer: constructor throws all errors



commit 13c8061b47c2cceb9266e4ff5252231ccd7e03c2
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Mar 26 14:11:28 2014 +0000

    libvirt-sys-importer: constructor throws all errors
    
    Constructor should simply throw all errors at the caller, not just the
    one it creates itself.
    
    This simplies the code a bit and fixes he issue of 'Import 0 boxes..'
    button showing up in the wizard source when connection to system libvirt
    fails.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=726970

 src/libvirt-system-importer.vala |   14 ++++----------
 src/wizard-source.vala           |    2 +-
 2 files changed, 5 insertions(+), 11 deletions(-)
---
diff --git a/src/libvirt-system-importer.vala b/src/libvirt-system-importer.vala
index 94c0c4c..e07ef84 100644
--- a/src/libvirt-system-importer.vala
+++ b/src/libvirt-system-importer.vala
@@ -38,18 +38,12 @@ private class Boxes.LibvirtSystemImporter: GLib.Object {
         }
     }
 
-    public async LibvirtSystemImporter () throws LibvirtSystemImporterError.NO_IMPORTS {
+    public async LibvirtSystemImporter () throws GLib.Error {
         connection = new GVir.Connection ("qemu+unix:///system");
 
-        try {
-            yield connection.open_read_only_async (null);
-            debug ("Connected to system libvirt, now fetching domains..");
-            yield connection.fetch_domains_async (null);
-        } catch (GLib.Error error) {
-            warning ("Failed to connect to system libvirt: %s", error.message);
-
-            return;
-        }
+        yield connection.open_read_only_async (null);
+        debug ("Connected to system libvirt, now fetching domains..");
+        yield connection.fetch_domains_async (null);
 
         domains = connection.get_domains ();
         debug ("Fetched %u domains from system libvirt.", domains.length ());
diff --git a/src/wizard-source.vala b/src/wizard-source.vala
index 0cecb52..9c9093e 100644
--- a/src/wizard-source.vala
+++ b/src/wizard-source.vala
@@ -245,7 +245,7 @@ private class Boxes.WizardSource: Gtk.Stack {
     private async void update_libvirt_sytem_entry_visibility () {
         try {
             libvirt_sys_importer = yield new LibvirtSystemImporter ();
-        } catch (LibvirtSystemImporterError.NO_IMPORTS error) {
+        } catch (GLib.Error error) {
             debug ("%s", error.message);
 
             return;


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