[gnome-boxes] Allow Machine and Display to report errors



commit 3c60efaed06e21597c32b6bacc4c75cbd6f5d3da
Author: Alexander Larsson <alexl redhat com>
Date:   Fri Nov 9 16:50:41 2012 +0100

    Allow Machine and Display to report errors
    
    https://bugzilla.gnome.org/show_bug.cgi?id=672268

 src/app.vala     |    9 +++++++++
 src/display.vala |    1 +
 src/machine.vala |    9 +++++++++
 3 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/src/app.vala b/src/app.vala
index b7b34b3..50f7757 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -61,6 +61,7 @@ private class Boxes.App: Boxes.UI {
 
     private uint configure_id;
     private ulong status_id;
+    private ulong got_error_id;
     public static const uint configure_id_timeout = 100;  // 100ms
 
     public App () {
@@ -564,6 +565,10 @@ private class Boxes.App: Boxes.UI {
                     machine.disconnect (status_id);
                     status_id = 0;
                 }
+                if (got_error_id != 0) {
+                    machine.disconnect (got_error_id);
+                    got_error_id = 0;
+                }
             }
             fullscreen = false;
             view.visible = true;
@@ -738,6 +743,10 @@ private class Boxes.App: Boxes.UI {
                 topbar.set_status (machine.status);
         });
 
+        got_error_id = machine.got_error.connect ( (message) => {
+            App.app.notificationbar.display_error (message);
+        });
+
         // Start the CREDS state
         ui_state = UIState.CREDS;
 
diff --git a/src/display.vala b/src/display.vala
index 3c76bec..64193d5 100644
--- a/src/display.vala
+++ b/src/display.vala
@@ -16,6 +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 got_error (string message);
 
     public abstract Gtk.Widget get_display (int n);
     public abstract Gdk.Pixbuf? get_pixbuf (int n) throws Boxes.Error;
diff --git a/src/machine.vala b/src/machine.vala
index a001c00..1757c14 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -14,6 +14,8 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
     public string? status { get; set; }
     public bool suspend_at_exit;
 
+    public signal void got_error (string message);
+
     private ulong show_id;
     private ulong hide_id;
     private uint show_timeout_id;
@@ -21,6 +23,7 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
     private ulong need_password_id;
     private ulong need_username_id;
     private ulong ui_state_id;
+    private ulong got_error_id;
     private uint screenshot_id;
     public static const int SCREENSHOT_WIDTH = 180;
     public static const int SCREENSHOT_HEIGHT = 134;
@@ -99,6 +102,8 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
                 need_password_id = 0;
                 _display.disconnect (need_username_id);
                 need_username_id = 0;
+                _display.disconnect (got_error_id);
+                got_error_id = 0;
             }
 
             _display = value;
@@ -114,6 +119,10 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
                 App.app.display_page.remove_display ();
             });
 
+            got_error_id = _display.got_error.connect ((message) => {
+                    got_error (message);
+            });
+
             disconnected_id = _display.disconnected.connect (() => {
                 message (@"display $name disconnected");
                 if (!stay_on_display)



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