[baobab/wip/vala: 38/39] Show a spinner while scanning.



commit 5fa03fb6d4acaae65327e9734c20404ccc55a5df
Author: Paolo Borelli <pborelli gnome org>
Date:   Mon Jan 30 21:44:17 2012 +0100

    Show a spinner while scanning.
    
    Instead of showing it in the toolbar and show a frozen chart like we did
    in the old baobab, let's try to just put the spinner in the main chart
    area... seems to look nice enough with the scalable spinner icon used
    these days.

 data/baobab-main-window.ui |   12 ++++++++++++
 src/baobab-window.vala     |   20 ++++++++++++++++----
 2 files changed, 28 insertions(+), 4 deletions(-)
---
diff --git a/data/baobab-main-window.ui b/data/baobab-main-window.ui
index f0658da..4e42cb6 100644
--- a/data/baobab-main-window.ui
+++ b/data/baobab-main-window.ui
@@ -274,6 +274,18 @@
                     <property name="vexpand">True</property>
                   </object>
                 </child>
+                <child>
+                  <object class="GtkSpinner" id="spinner">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="hexpand">True</property>
+                    <property name="vexpand">True</property>
+                    <property name="margin_left">24</property>
+                    <property name="margin_right">24</property>
+                    <property name="margin_top">24</property>
+                    <property name="margin_bottom">24</property>
+                  </object>
+                </child>
               </object>
               <packing>
                 <property name="left_attach">0</property>
diff --git a/src/baobab-window.vala b/src/baobab-window.vala
index c2b2950..2b9941e 100644
--- a/src/baobab-window.vala
+++ b/src/baobab-window.vala
@@ -5,6 +5,7 @@ namespace Baobab {
 		Gtk.Notebook chart_notebook;
 		Chart rings_chart;
 		Chart treemap_chart;
+		Gtk.Spinner spinner;
 		Scanner? scanner;
 
 		static Gdk.Cursor busy_cursor;
@@ -46,6 +47,12 @@ namespace Baobab {
 			{ "collapse-all", false }
 		};
 
+		private enum ChartPage {
+			RINGS,
+			TREEMAP,
+			SPINNER
+		}
+
 		private enum DndTargets {
 			URI_LIST
 		}
@@ -74,6 +81,7 @@ namespace Baobab {
 			chart_notebook = builder.get_object ("chart-notebook") as Gtk.Notebook;
 			rings_chart = builder.get_object ("rings-chart") as Chart;
 			treemap_chart = builder.get_object ("treemap-chart") as Chart;
+			spinner = builder.get_object ("spinner") as Gtk.Spinner;
 
 			setup_treeview (builder);
 
@@ -99,10 +107,10 @@ namespace Baobab {
 		void on_chart_type_changed (SimpleAction action, Variant value) {
 			switch (value as string) {
 				case "rings":
-					chart_notebook.page = 0;
+					chart_notebook.page = ChartPage.RINGS;
 					break;
 				case "treemap":
-					chart_notebook.page = 1;
+					chart_notebook.page = ChartPage.TREEMAP;
 					break;
 				default:
 					return;
@@ -333,14 +341,18 @@ namespace Baobab {
 			if (busy) {
 				cursor = busy_cursor;
 				disable_drop ();
-				rings_chart.freeze_updates();
+				rings_chart.freeze_updates ();
 				treemap_chart.freeze_updates ();
 				(lookup_action ("active-chart") as SimpleAction).set_enabled (false);
+				chart_notebook.page = ChartPage.SPINNER;
+				spinner.start ();
 			} else {
 				enable_drop ();
-				rings_chart.thaw_updates();
+				rings_chart.thaw_updates ();
 				treemap_chart.thaw_updates ();
 				(lookup_action ("active-chart") as SimpleAction).set_enabled (true);
+				spinner.start ();
+				lookup_action ("active-chart").change_state (ui_settings.get_value ("active-chart"));
 			}
 
 			var window = get_window ();



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