[baobab] Use normal size if allocated size is not available
- From: Stefano Facchini <sfacchini src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [baobab] Use normal size if allocated size is not available
- Date: Wed, 10 Jul 2013 13:58:00 +0000 (UTC)
commit 5e3295e8450a8fb62bbf72fc25708a4ef111706c
Author: Stefano Facchini <stefano facchini gmail com>
Date: Wed Jul 10 14:03:32 2013 +0200
Use normal size if allocated size is not available
We assume that allocated size is not available when alloc_size == 0
for the root element.
src/baobab-window.vala | 25 +++++++++++++++++--------
1 files changed, 17 insertions(+), 8 deletions(-)
---
diff --git a/src/baobab-window.vala b/src/baobab-window.vala
index a26b4d4..a616816 100644
--- a/src/baobab-window.vala
+++ b/src/baobab-window.vala
@@ -54,6 +54,8 @@ namespace Baobab {
[GtkChild]
private Gtk.TreeView treeview;
[GtkChild]
+ private CellRendererSize size_column_size_renderer;
+ [GtkChild]
private Gtk.Menu treeview_popup_menu;
[GtkChild]
private Gtk.MenuItem treeview_popup_open;
@@ -531,22 +533,18 @@ namespace Baobab {
}
}
- void set_model (Gtk.TreeModel model) {
- treeview.model = model;
-
- expand_first_row ();
-
+ void set_chart_model (Gtk.TreeModel model, bool show_allocated_size) {
model.bind_property ("max-depth", rings_chart, "max-depth", BindingFlags.SYNC_CREATE);
model.bind_property ("max-depth", treemap_chart, "max-depth", BindingFlags.SYNC_CREATE);
treemap_chart.set_model_with_columns (model,
Scanner.Columns.DISPLAY_NAME,
- Scanner.Columns.ALLOC_SIZE,
+ show_allocated_size ? Scanner.Columns.ALLOC_SIZE :
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.ALLOC_SIZE,
+ show_allocated_size ? Scanner.Columns.ALLOC_SIZE :
Scanner.Columns.SIZE,
Scanner.Columns.PARSE_NAME,
Scanner.Columns.PERCENT,
Scanner.Columns.ELEMENTS, null);
@@ -570,6 +568,16 @@ namespace Baobab {
message (primary, e.message, Gtk.MessageType.WARNING);
}
+ // Use allocated size if available, where available is defined as
+ // alloc_size > 0 for the root element
+ Gtk.TreeIter iter;
+ scanner.get_iter_first (out iter);
+ uint64 alloc_size;
+ scanner.get (iter, Scanner.Columns.ALLOC_SIZE, out alloc_size, -1);
+ bool show_allocated_size = alloc_size > 0;
+ size_column_size_renderer.show_allocated_size = show_allocated_size;
+ set_chart_model (active_location.scanner, show_allocated_size);
+
set_ui_state (result_page, false);
});
@@ -578,7 +586,8 @@ namespace Baobab {
scanner.scan (force);
- set_model (active_location.scanner);
+ treeview.model = scanner;
+ expand_first_row ();
}
public void scan_directory (File directory) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]