[gnome-boxes/wip/less-dialogs2: 9/14] properties-window: API to show troubleshooting log



commit 2ff1404fd16203d320390d3fd5b3dab4eeea395f
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Dec 3 17:31:11 2014 +0000

    properties-window: API to show troubleshooting log
    
    Add a view and API to show troubleshooting log to user.

 data/ui/properties-window.ui |   32 ++++++++++++++++++++++++++++++--
 src/properties-window.vala   |   28 ++++++++++++++++++++++++++++
 2 files changed, 58 insertions(+), 2 deletions(-)
---
diff --git a/data/ui/properties-window.ui b/data/ui/properties-window.ui
index d95ad7a..3b2b8a5 100644
--- a/data/ui/properties-window.ui
+++ b/data/ui/properties-window.ui
@@ -10,7 +10,11 @@
         |    |
         |    |-> notificationbar = Boxes.Notificationbar ();
         |    |
-        |    |-> properties = new Boxes.Properties ();
+        |    |-> view = Gtk.Stack ();
+        |         |
+        |         |-> properties = new Boxes.Properties ();
+        |         |
+        |         |-> troubleshoot_log = new Boxes.TroubleshootLog ();
         |
         |-> topbar = new Boxes.PropertiesToolbar (); // as titlebar
   -->
@@ -34,10 +38,34 @@
         </child>
 
         <child>
-          <object class="BoxesProperties" id="properties">
+          <object class="GtkStack" id="view">
             <property name="visible">True</property>
+            <property name="transition-type">slide-left-right</property>
+            <property name="transition-duration">400</property>
+
+            <child>
+              <object class="BoxesProperties" id="properties">
+                <property name="visible">True</property>
+              </object>
+
+              <packing>
+                <property name="name">main</property>
+              </packing>
+            </child>
+
+            <child>
+              <object class="BoxesTroubleshootLog" id="troubleshoot_log">
+                <property name="visible">True</property>
+              </object>
+
+              <packing>
+                <property name="name">troubleshooting_log</property>
+              </packing>
+            </child>
+
           </object>
         </child>
+
       </object>
     </child>
 
diff --git a/src/properties-window.vala b/src/properties-window.vala
index 5c390e9..6c987da 100644
--- a/src/properties-window.vala
+++ b/src/properties-window.vala
@@ -1,14 +1,35 @@
 // This file is part of GNOME Boxes. License: LGPLv2+
 using Gtk;
 
+private enum Boxes.PropsWindowPage {
+    MAIN,
+    TROUBLESHOOTING_LOG
+}
+
 [GtkTemplate (ui = "/org/gnome/Boxes/ui/properties-window.ui")]
 private class Boxes.PropertiesWindow: Gtk.Window, Boxes.UI {
+    public const string[] page_names = { "main", "troubleshooting_log" };
+
     public UIState previous_ui_state { get; protected set; }
     public UIState ui_state { get; protected set; }
 
+    private PropsWindowPage _page;
+    public PropsWindowPage page {
+        get { return _page; }
+        set {
+            _page = value;
+
+            view.visible_child_name = page_names[value];
+        }
+    }
+
+    [GtkChild]
+    public Gtk.Stack view;
     [GtkChild]
     public Properties properties;
     [GtkChild]
+    public TroubleshootLog troubleshoot_log;
+    [GtkChild]
     public PropertiesToolbar topbar;
     [GtkChild]
     public Notificationbar notificationbar;
@@ -26,12 +47,19 @@ private class Boxes.PropertiesWindow: Gtk.Window, Boxes.UI {
         notify["ui-state"].connect (ui_state_changed);
     }
 
+    public void show_troubleshoot_log (string log) {
+        troubleshoot_log.view.buffer.text = log;
+        page = PropsWindowPage.TROUBLESHOOTING_LOG;
+    }
+
     public void revert_state () {
         if ((app_window.current_item as Machine).state != Machine.MachineState.RUNNING &&
              app_window.previous_ui_state == UIState.DISPLAY)
             app_window.set_state (UIState.COLLECTION);
         else
             app_window.set_state (app_window.previous_ui_state);
+
+        page = PropsWindowPage.MAIN;
     }
 
     private void ui_state_changed () {


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