[baobab/wip/new-design: 4/59] wire up the chart properly



commit 416ed300ee32bfd58eee38cdceb3cffdde848c26
Author: Ryan Lortie <desrt desrt ca>
Date:   Thu Jan 5 11:32:04 2012 -0500

    wire up the chart properly
    
    and publish max_depth as a property on the model

 src/baobab-scanner.vala |    3 +++
 src/baobab-window.vala  |   16 ++++++++++++++--
 2 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/src/baobab-scanner.vala b/src/baobab-scanner.vala
index d7e94ab..8a4968c 100644
--- a/src/baobab-scanner.vala
+++ b/src/baobab-scanner.vala
@@ -159,9 +159,12 @@ namespace Baobab {
 				var info = directory.query_info (ATTRIBUTES, 0, cancellable);
 				var results = add_directory (directory, info);
 				add_percent (results.size);
+				max_depth = results.max_depth;
 			} catch { }
 		}
 
+		public int max_depth { get; private set; }
+
 		public Scanner (File directory) {
 			set_column_types (new Type[] {
 			                  typeof (string),  /* DIR_NAME */
diff --git a/src/baobab-window.vala b/src/baobab-window.vala
index 32473a9..02019cc 100644
--- a/src/baobab-window.vala
+++ b/src/baobab-window.vala
@@ -69,8 +69,20 @@ namespace Baobab {
 			model = new Scanner (directory);
 			var rings_chart = builder.get_object ("rings-chart") as Chart;
 			var treemap = builder.get_object ("treemap") as Chart;
-			rings_chart.set_model_with_columns (model, 0, 1, 2, 3, 4, null);
-			treemap.set_model_with_columns (model, 0, 1, 2, 3, 4, null);
+			model.bind_property ("max-depth", rings_chart, "max-depth", BindingFlags.SYNC_CREATE);
+			model.bind_property ("max-depth", treemap, "max-depth", BindingFlags.SYNC_CREATE);
+			treemap.set_model_with_columns (model,
+			                                Scanner.Columns.DISPLAY_NAME,
+			                                Scanner.Columns.SIZE,
+			                                Scanner.Columns.PARSE_NAME,
+			                                Scanner.Columns.PERCENT,
+			                                Scanner.Columns.ELEMENTS, null);
+			rings_chart.set_model_with_columns (model,
+			                                    Scanner.Columns.DISPLAY_NAME,
+			                                    Scanner.Columns.SIZE,
+			                                    Scanner.Columns.PARSE_NAME,
+			                                    Scanner.Columns.PERCENT,
+			                                    Scanner.Columns.ELEMENTS, null);
 			var treeview = builder.get_object ("treeview") as Gtk.TreeView;
 			treeview.model = model;
 		}



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