[gnome-boxes] Show some status messages during VM launch



commit a4fa454771bc1f2160afea181509ef3b924513e8
Author: Alexander Larsson <alexl redhat com>
Date:   Fri Aug 31 16:18:53 2012 +0200

    Show some status messages during VM launch
    
    https://bugzilla.gnome.org/show_bug.cgi?id=683108

 src/app.vala             |    8 ++++++++
 src/libvirt-machine.vala |    7 ++++++-
 src/machine.vala         |    4 ++++
 src/topbar.vala          |    7 +++++++
 4 files changed, 25 insertions(+), 1 deletions(-)
---
diff --git a/src/app.vala b/src/app.vala
index 78b9fa9..d8cbbce 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -59,6 +59,7 @@ private class Boxes.App: Boxes.UI {
     public CollectionSource default_source { get { return sources.get ("QEMU Session"); } }
 
     private uint configure_id;
+    private ulong status_id;
     public static const uint configure_id_timeout = 100;  // 100ms
 
     public App () {
@@ -534,6 +535,10 @@ private class Boxes.App: Boxes.UI {
             set_main_ui_state ();
             if (current_item is Machine) {
                 var machine = current_item as Machine;
+                if (status_id != 0) {
+                    machine.disconnect (status_id);
+                    status_id = 0;
+                }
 
                 machine.disconnect_display ();
             }
@@ -642,6 +647,9 @@ private class Boxes.App: Boxes.UI {
             if (current_item is Machine) {
                 var machine = current_item as Machine;
 
+                status_id = machine.notify["status"].connect ( () => {
+                    topbar.set_status (machine.status);
+                });
                 machine.connect_display.begin ();
                 ui_state = UIState.CREDS;
             } else
diff --git a/src/libvirt-machine.vala b/src/libvirt-machine.vala
index ec46295..262383a 100644
--- a/src/libvirt-machine.vala
+++ b/src/libvirt-machine.vala
@@ -557,8 +557,13 @@ private class Boxes.LibvirtMachine: Boxes.Machine {
         try {
             if (state == MachineState.PAUSED)
                 yield domain.resume_async (null);
-            else
+            else {
+                if (domain.get_saved ())
+                    status = _("Restoring %s from disk").printf (name);
+                else
+                    status = _("Starting %s").printf (name);
                 yield domain.start_async (0, null);
+            }
         } catch (GLib.Error error) {
             warning ("Failed to start '%s': %s", domain.get_name (), error.message);
         }
diff --git a/src/machine.vala b/src/machine.vala
index 14e42b1..e3c75d8 100644
--- a/src/machine.vala
+++ b/src/machine.vala
@@ -11,6 +11,7 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
     public Gdk.Pixbuf? pixbuf { get; set; }
     public bool stay_on_display;
     public string? info { get; set; }
+    public string? status { get; set; }
 
     private ulong show_id;
     private ulong hide_id;
@@ -92,6 +93,8 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
             if (_display == null)
                 return;
 
+            status = _("Connecting to %s").printf (name);
+
             show_id = _display.show.connect ((id) => {
                 switch (App.app.ui_state) {
                 case Boxes.UIState.CREDS:
@@ -120,6 +123,7 @@ private abstract class Boxes.Machine: Boxes.CollectionItem, Boxes.IPropertiesPro
             });
 
             need_password_id = _display.notify["need-password"].connect (() => {
+                status = _("Enter password for %s").printf (name);
                 machine_actor.set_password_needed (display.need_password);
             });
 
diff --git a/src/topbar.vala b/src/topbar.vala
index 99935de..8cb2f9b 100644
--- a/src/topbar.vala
+++ b/src/topbar.vala
@@ -23,6 +23,7 @@ private class Boxes.Topbar: Boxes.UI {
     private Gtk.Button back_btn;
     private Gtk.Button new_btn;
     private Gd.MainToolbar selection_toolbar;
+    private Gd.MainToolbar collection_toolbar;
 
     public Topbar () {
         setup_topbar ();
@@ -42,6 +43,7 @@ private class Boxes.Topbar: Boxes.UI {
         notebook.append_page (hbox, null);
 
         var toolbar = new Gd.MainToolbar ();
+        collection_toolbar = toolbar;
         toolbar.get_style_context ().add_class (Gtk.STYLE_CLASS_MENUBAR);
         hbox.pack_start (toolbar, true, true, 0);
 
@@ -112,6 +114,10 @@ private class Boxes.Topbar: Boxes.UI {
         select_btn.sensitive = App.app.collection.items.length != 0;
     }
 
+    public void set_status (string? text) {
+        collection_toolbar.set_labels (text, null);
+    }
+
     private void update_selection_label () {
         var items = App.app.selected_items.length ();
         if (items > 0)
@@ -123,6 +129,7 @@ private class Boxes.Topbar: Boxes.UI {
     public override void ui_state_changed () {
         switch (ui_state) {
         case UIState.COLLECTION:
+            set_status (null);
             notebook.page = TopbarPage.COLLECTION;
             back_btn.hide ();
             spinner_btn.hide ();



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