[gnome-boxes] Allow Machine::connect_display to report errors
- From: Christophe Fergeau <teuf src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes] Allow Machine::connect_display to report errors
- Date: Tue, 18 Sep 2012 11:03:22 +0000 (UTC)
commit 8745a86a7f3724bcce797647ddfb31d20f3ad4b4
Author: Christophe Fergeau <cfergeau redhat com>
Date: Mon Sep 17 13:51:48 2012 +0200
Allow Machine::connect_display to report errors
If an error occurs while we connect to a remote display, we
currently have no way of reporting this to the user. When
this happens, Boxes is stuck on showing a zoomed in box snapshot
in the middle of the screen, and nothing else happens.
This commit allows Machine::connect_display to throw exceptions, and
catches them to report errors. However, this is just preparatory work
as the various Machine::connect_display needs to be modified to actually
report the errors they encounter.
https://bugzilla.gnome.org/show_bug.cgi?id=684224
src/app.vala | 9 ++++++++-
src/libvirt-machine.vala | 2 +-
src/machine.vala | 2 +-
src/remote-machine.vala | 2 +-
4 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/src/app.vala b/src/app.vala
index 946ee37..776af62 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -686,7 +686,14 @@ private class Boxes.App: Boxes.UI {
status_id = machine.notify["status"].connect ( () => {
topbar.set_status (machine.status);
});
- machine.connect_display.begin ();
+ machine.connect_display.begin ( (obj, res) => {
+ try {
+ machine.connect_display.end (res);
+ } catch (GLib.Error e) {
+ ui_state = UIState.COLLECTION;
+ warning ("connect display failed: %s", e.message);
+ }
+ });
ui_state = UIState.CREDS;
} else
warning ("unknown item, fix your code");
diff --git a/src/libvirt-machine.vala b/src/libvirt-machine.vala
index f91f2e8..20cbb0a 100644
--- a/src/libvirt-machine.vala
+++ b/src/libvirt-machine.vala
@@ -25,7 +25,7 @@ private class Boxes.LibvirtMachine: Boxes.Machine {
_reconnect_display = true;
}
- public override async void connect_display () {
+ public override async void connect_display () throws GLib.Error {
if (_connect_display)
return;
diff --git a/src/machine.vala b/src/machine.vala
index ebc5739..4a7723b 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -212,7 +212,7 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
public abstract List<Boxes.Property> get_properties (Boxes.PropertiesPage page);
- public abstract async void connect_display ();
+ public abstract async void connect_display () throws GLib.Error;
public virtual void disconnect_display () {
if (display == null)
diff --git a/src/remote-machine.vala b/src/remote-machine.vala
index 6369a20..333c83f 100644
--- a/src/remote-machine.vala
+++ b/src/remote-machine.vala
@@ -15,7 +15,7 @@ private class Boxes.RemoteMachine: Boxes.Machine, Boxes.IPropertiesProvider {
load_screenshot ();
}
- public override async void connect_display () {
+ public override async void connect_display () throws GLib.Error {
if (display != null)
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]