[gnome-boxes/gnome-3-8] Handle SPICE connection errors
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-boxes/gnome-3-8] Handle SPICE connection errors
- Date: Mon, 29 Jul 2013 17:21:44 +0000 (UTC)
commit 62850dedd7cc5ac573163cf22074ff7203a59169
Author: Christophe Fergeau <cfergeau redhat com>
Date: Thu Jun 6 19:09:57 2013 +0200
Handle SPICE connection errors
When an error occurs during SPICE connection, a channel-event event
is emitted, and its type is SPICE_CHANNEL_ERROR_XXX. Boxes currently
catches some channel-event events, but does not do anything in case
of errors. When such an error occurs (for example because of a wrong
remote host certificate), Boxes UI is stuck on a centered half zoomed
screen, and does not do anything.
By emitting the disconnected() signal when such an error is caught, we
ensure we will go back to the collection view.
https://bugzilla.gnome.org/show_bug.cgi?id=701753
src/display.vala | 2 +-
src/machine.vala | 4 +++-
src/spice-display.vala | 12 +++++++++++-
3 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/src/display.vala b/src/display.vala
index ebb9e38..ffe1b0e 100644
--- a/src/display.vala
+++ b/src/display.vala
@@ -16,7 +16,7 @@ private abstract class Boxes.Display: GLib.Object, Boxes.IPropertiesProvider {
public signal void show (int display_id);
public signal void hide (int display_id);
- public signal void disconnected ();
+ public signal void disconnected (bool connection_failed);
public signal void got_error (string message);
public abstract Gtk.Widget get_display (int n);
diff --git a/src/machine.vala b/src/machine.vala
index ce3b41f..fcdab2f 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -143,10 +143,12 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
got_error (message);
});
- disconnected_id = _display.disconnected.connect (() => {
+ disconnected_id = _display.disconnected.connect ((failed) => {
message (@"display $name disconnected");
if (!stay_on_display && App.app.current_item == this)
App.app.ui_state = Boxes.UIState.COLLECTION;
+ if (failed)
+ App.app.notificationbar.display_error (_("Connection to '%s' failed").printf (name));
});
need_password_id = _display.notify["need-password"].connect (() => {
diff --git a/src/spice-display.vala b/src/spice-display.vala
index c8a5937..a386672 100644
--- a/src/spice-display.vala
+++ b/src/spice-display.vala
@@ -253,14 +253,24 @@ private class Boxes.SpiceDisplay: Boxes.Display {
switch (event) {
case ChannelEvent.CLOSED:
closed = true;
- disconnected ();
+ disconnected (false);
break;
case ChannelEvent.ERROR_AUTH:
need_password = true;
break;
+ case ChannelEvent.ERROR_CONNECT:
+ case ChannelEvent.ERROR_TLS:
+ case ChannelEvent.ERROR_LINK:
+ case ChannelEvent.ERROR_IO:
+ debug ("main SPICE channel error: %d", event);
+ closed = true;
+ disconnected (true);
+ break;
+
default:
+ debug ("unhandled main SPICE channel event: %d", event);
break;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]