[gnome-boxes] properties-toolbar: Content for troubleshooting log view



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

    properties-toolbar: Content for troubleshooting log view
    
    The properties topbar should provide a different set of controls and
    title when troubleshooting log view is visible in the properties window.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=741047

 data/ui/properties-toolbar.ui |  120 +++++++++++++++++++++++++++++++++-------
 src/properties-toolbar.vala   |   38 +++++++++++--
 src/properties-window.vala    |    1 +
 3 files changed, 132 insertions(+), 27 deletions(-)
---
diff --git a/data/ui/properties-toolbar.ui b/data/ui/properties-toolbar.ui
index 56d641b..ff3c816 100644
--- a/data/ui/properties-toolbar.ui
+++ b/data/ui/properties-toolbar.ui
@@ -1,48 +1,126 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <!-- interface-requires gtk+ 3.9 -->
-  <template class="BoxesPropertiesToolbar" parent="GtkHeaderBar">
+  <template class="BoxesPropertiesToolbar" parent="GtkStack">
     <property name="visible">True</property>
-    <property name="show-close-button">True</property>
-    <style>
-      <class name="titlebar"/>
-    </style>
+    <property name="transition-type">slide-left-right</property>
+    <property name="transition-duration">400</property>
 
+    <!-- Main page -->
     <child>
-      <object class="GtkButton" id="back_button">
+      <object class="GtkHeaderBar" id="main">
         <property name="visible">True</property>
-        <property name="valign">center</property>
-        <signal name="clicked" handler="on_back_clicked"/>
+        <property name="show-close-button">True</property>
         <style>
-          <class name="image-button"/>
+          <class name="titlebar"/>
         </style>
 
-        <child internal-child="accessible">
-          <object class="AtkObject" id="a11y-button5">
-            <property name="accessible-name" translatable="yes">Back</property>
+        <child>
+          <object class="GtkButton" id="main_back_button">
+            <property name="visible">True</property>
+            <property name="valign">center</property>
+            <signal name="clicked" handler="on_main_back_clicked"/>
+            <style>
+              <class name="image-button"/>
+            </style>
+
+            <child internal-child="accessible">
+              <object class="AtkObject" id="a11y-button5">
+                <property name="accessible-name" translatable="yes">Back</property>
+              </object>
+            </child>
+
+            <child>
+              <object class="GtkImage" id="back_image">
+                <property name="visible">True</property>
+                <property name="icon-name">go-previous-symbolic</property>
+              </object>
+            </child>
           </object>
         </child>
 
-        <child>
-          <object class="GtkImage" id="back_image">
+        <child type="title">
+          <object class="BoxesEditableEntry" id="title_entry">
             <property name="visible">True</property>
-            <property name="icon-name">go-previous-symbolic</property>
+            <property name="editable">True</property>
+            <property name="text-xalign">0.5</property>
+            <style>
+              <class name="title"/>
+            </style>
+
+            <signal name="editing_done" handler="on_title_entry_changed"/>
           </object>
         </child>
+
       </object>
+
+      <packing>
+        <property name="name">main</property>
+      </packing>
     </child>
 
-    <child type="title">
-      <object class="BoxesEditableEntry" id="title_entry">
+    <!-- Troubleshooting log page -->
+    <child>
+      <object class="GtkHeaderBar" id="troubleshooting_log">
         <property name="visible">True</property>
-        <property name="editable">True</property>
-        <property name="text-xalign">0.5</property>
+        <property name="show-close-button">True</property>
+        <property name="title" translatable="yes">Troubleshooting Log</property>
         <style>
-          <class name="title"/>
+          <class name="titlebar"/>
         </style>
 
-        <signal name="editing_done" handler="on_title_entry_changed"/>
+        <child>
+          <object class="GtkButton" id="troubleshooting_back_button">
+            <property name="visible">True</property>
+            <property name="valign">center</property>
+            <signal name="clicked" handler="on_troubleshooting_back_clicked"/>
+            <style>
+              <class name="image-button"/>
+            </style>
+
+            <child internal-child="accessible">
+              <object class="AtkObject" id="a11y-button6">
+                <property name="accessible-name" translatable="yes">Back</property>
+              </object>
+            </child>
+
+            <child>
+              <object class="GtkImage" id="back_image2">
+                <property name="visible">True</property>
+                <property name="icon-name">go-previous-symbolic</property>
+              </object>
+            </child>
+          </object>
+
+          <packing>
+            <property name="pack-type">start</property>
+          </packing>
+        </child>
+
+        <child>
+          <object class="GtkButton" id="copy_clipboard_button">
+            <property name="visible">True</property>
+            <property name="valign">center</property>
+            <property name="use-underline">True</property>
+            <property name="label" translatable="yes">_Copy to Clipboard</property>
+            <signal name="clicked" handler="on_copy_clipboard_clicked"/>
+            <style>
+              <class name="text-button"/>
+            </style>
+
+          </object>
+
+          <packing>
+            <property name="pack-type">end</property>
+          </packing>
+        </child>
+
       </object>
+
+      <packing>
+        <property name="name">troubleshooting_log</property>
+      </packing>
     </child>
+
   </template>
 </interface>
diff --git a/src/properties-toolbar.vala b/src/properties-toolbar.vala
index d09837d..475c99c 100644
--- a/src/properties-toolbar.vala
+++ b/src/properties-toolbar.vala
@@ -2,9 +2,25 @@
 using Gtk;
 
 [GtkTemplate (ui = "/org/gnome/Boxes/ui/properties-toolbar.ui")]
-private class Boxes.PropertiesToolbar: HeaderBar {
+private class Boxes.PropertiesToolbar: Gtk.Stack {
+    private PropsWindowPage _page;
+    public PropsWindowPage page {
+        get { return _page; }
+        set {
+            _page = value;
+
+            visible_child_name = PropertiesWindow.page_names[value];
+        }
+    }
+
+    [GtkChild]
+    public Gtk.HeaderBar main;
+
+    [GtkChild]
+    public Gtk.Button main_back_button;
     [GtkChild]
-    public Gtk.Button back_button;
+    public Gtk.Button troubleshooting_back_button;
+
     [GtkChild]
     private EditableEntry title_entry;
 
@@ -16,7 +32,7 @@ private class Boxes.PropertiesToolbar: HeaderBar {
 
     construct {
         // Work around for https://bugzilla.gnome.org/show_bug.cgi?id=734676
-        set_custom_title (title_entry);
+        main.set_custom_title (title_entry);
     }
 
     public void setup_ui (AppWindow window, PropertiesWindow props_window) {
@@ -27,18 +43,28 @@ private class Boxes.PropertiesToolbar: HeaderBar {
     }
 
     [GtkCallback]
-    private void on_back_clicked () {
+    private void on_main_back_clicked () requires (page == PropsWindowPage.MAIN) {
         props_window.revert_state ();
     }
 
     [GtkCallback]
+    private void on_troubleshooting_back_clicked () requires (page == PropsWindowPage.TROUBLESHOOTING_LOG) {
+        props_window.page = PropsWindowPage.MAIN;
+    }
+
+    [GtkCallback]
+    private void on_copy_clipboard_clicked () requires (page == PropsWindowPage.TROUBLESHOOTING_LOG) {
+        props_window.copy_troubleshooting_log_to_clipboard ();
+    }
+
+    [GtkCallback]
     private void on_title_entry_changed () {
         window.current_item.name = title_entry.text;
     }
 
     private void ui_state_changed () {
-        back_button.visible = (window.previous_ui_state == UIState.WIZARD);
-        show_close_button = (window.previous_ui_state != UIState.WIZARD);
+        main_back_button.visible = (window.previous_ui_state == UIState.WIZARD);
+        main.show_close_button = (window.previous_ui_state != UIState.WIZARD);
 
         if (item_name_id != 0) {
             item.disconnect (item_name_id);
diff --git a/src/properties-window.vala b/src/properties-window.vala
index a3b6c95..2cb9ab5 100644
--- a/src/properties-window.vala
+++ b/src/properties-window.vala
@@ -20,6 +20,7 @@ private class Boxes.PropertiesWindow: Gtk.Window, Boxes.UI {
             _page = value;
 
             view.visible_child_name = page_names[value];
+            topbar.page = value;
         }
     }
 


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