[gnome-boxes] empty-boxes: Show spinner while initializing



commit 5bb3b3da85529bc58eb05011ba103aa78fde9bec
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Mon Feb 17 18:38:28 2014 +0000

    empty-boxes: Show spinner while initializing
    
    https://bugzilla.gnome.org/show_bug.cgi?id=710277

 data/ui/empty-boxes.ui |   80 ++++++++++++++++++++++++++++++-----------------
 src/app.vala           |    1 -
 src/empty-boxes.vala   |    8 ++++-
 3 files changed, 58 insertions(+), 31 deletions(-)
---
diff --git a/data/ui/empty-boxes.ui b/data/ui/empty-boxes.ui
index e7530b9..dcc4bda 100644
--- a/data/ui/empty-boxes.ui
+++ b/data/ui/empty-boxes.ui
@@ -1,59 +1,81 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
   <!-- interface-requires gtk+ 3.9 -->
-  <template class="BoxesEmptyBoxes" parent="GtkGrid">
+  <template class="BoxesEmptyBoxes" parent="GtkStack">
     <property name="visible">True</property>
-    <property name="orientation">horizontal</property>
-    <property name="column-spacing">12</property>
     <property name="hexpand">True</property>
     <property name="vexpand">True</property>
     <property name="halign">center</property>
     <property name="valign">center</property>
-    <property name="row-homogeneous">True</property>
     <style>
       <class name="dim-label"/>
     </style>
 
     <child>
-      <object class="GtkImage" id="image">
+      <object class="GtkSpinner" id="spinner">
         <property name="visible">True</property>
-        <property name="icon-name">application-x-appliance-symbolic</property>
-        <property name="icon-size">6</property>
-        <property name="pixel-size">96</property>
-        <style>
-          <class name="boxes-empty-image"/>
-        </style>
+        <property name="active">True</property>
+        <property name="width-request">32</property>
+        <property name="height-request">32</property>
       </object>
     </child>
 
     <child>
-      <object class="GtkGrid" id="labels_grid">
+      <object class="GtkGrid" id="grid">
         <property name="visible">True</property>
-        <property name="orientation">vertical</property>
+        <property name="orientation">horizontal</property>
+        <property name="column-spacing">12</property>
+        <property name="hexpand">True</property>
+        <property name="vexpand">True</property>
+        <property name="halign">center</property>
+        <property name="valign">center</property>
+        <property name="row-homogeneous">True</property>
+        <style>
+          <class name="dim-label"/>
+        </style>
 
         <child>
-          <object class="GtkLabel" id="no_boxes_found_label">
+          <object class="GtkImage" id="image">
             <property name="visible">True</property>
-            <property name="use-markup">True</property>
-            <property name="halign">start</property>
-            <property name="vexpand">True</property>
-            <property name="label" translatable="yes">&lt;b&gt;&lt;span size=&quot;large&quot;&gt;No boxes 
found&lt;/span&gt;&lt;/b&gt;</property>
+            <property name="icon-name">application-x-appliance-symbolic</property>
+            <property name="icon-size">6</property>
+            <property name="pixel-size">96</property>
+            <style>
+              <class name="boxes-empty-image"/>
+            </style>
           </object>
         </child>
 
         <child>
-          <object class="GtkLabel" id="instructions_label">
+          <object class="GtkGrid" id="labels_grid">
             <property name="visible">True</property>
-            <property name="use-markup">True</property>
-            <property name="halign">start</property>
-            <property name="vexpand">True</property>
-            <property name="xalign">0</property>
-            <property name="max-width-chars">24</property>
-            <property name="wrap">True</property>
-            <property name="label" translatable="yes">Create one using the button on the top left.</property>
-            <style>
-              <class name="boxes-empty-details-label"/>
-            </style>
+            <property name="orientation">vertical</property>
+
+            <child>
+              <object class="GtkLabel" id="no_boxes_found_label">
+                <property name="visible">True</property>
+                <property name="use-markup">True</property>
+                <property name="halign">start</property>
+                <property name="vexpand">True</property>
+                <property name="label" translatable="yes">&lt;b&gt;&lt;span size=&quot;large&quot;&gt;No 
boxes found&lt;/span&gt;&lt;/b&gt;</property>
+              </object>
+            </child>
+
+            <child>
+              <object class="GtkLabel" id="instructions_label">
+                <property name="visible">True</property>
+                <property name="use-markup">True</property>
+                <property name="halign">start</property>
+                <property name="vexpand">True</property>
+                <property name="xalign">0</property>
+                <property name="max-width-chars">24</property>
+                <property name="wrap">True</property>
+                <property name="label" translatable="yes">Create one using the button on the top 
left.</property>
+                <style>
+                  <class name="boxes-empty-details-label"/>
+                </style>
+              </object>
+            </child>
           </object>
         </child>
       </object>
diff --git a/src/app.vala b/src/app.vala
index f270cd3..ba5e61e 100644
--- a/src/app.vala
+++ b/src/app.vala
@@ -655,7 +655,6 @@ private class Boxes.App: GLib.Object, Boxes.UI {
         below_bin_actor.insert_child_below (empty_boxes.actor, notificationbar.actor);
 
         properties.actor.hide ();
-        empty_boxes.actor.hide ();
 
         main_vbox.show_all ();
 
diff --git a/src/empty-boxes.vala b/src/empty-boxes.vala
index 168cf8d..cca28e8 100644
--- a/src/empty-boxes.vala
+++ b/src/empty-boxes.vala
@@ -1,13 +1,16 @@
 // This file is part of GNOME Boxes. License: LGPLv2+
 
 [GtkTemplate (ui = "/org/gnome/Boxes/ui/empty-boxes.ui")]
-private class Boxes.EmptyBoxes : Gtk.Grid, Boxes.UI {
+private class Boxes.EmptyBoxes : Gtk.Stack, Boxes.UI {
     public Clutter.Actor actor { get { return gtk_actor; } }
     public UIState previous_ui_state { get; protected set; }
     public UIState ui_state { get; protected set; }
 
     private GtkClutter.Actor gtk_actor;
 
+    [GtkChild]
+    private Gtk.Grid grid;
+
     public EmptyBoxes () {
         gtk_actor = new GtkClutter.Actor.with_contents (this);
         gtk_actor.get_widget ().get_style_context ().add_class ("boxes-bg");
@@ -31,5 +34,8 @@ private class Boxes.EmptyBoxes : Gtk.Grid, Boxes.UI {
         var visible = ui_state == UIState.COLLECTION && App.app.collection.items.length == 0;
         if (visible != gtk_actor.visible)
             fade_actor (gtk_actor, visible? 255 : 0);
+
+        if (visible && visible_child != grid)
+            visible_child = grid;
     }
 }


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