[gnome-usage/tracker-powered-storage-view-wip] storage: Update StorageGraph for better coloring pies
- From: Petr Štětka <pstetka src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-usage/tracker-powered-storage-view-wip] storage: Update StorageGraph for better coloring pies
- Date: Tue, 2 Oct 2018 10:49:01 +0000 (UTC)
commit bdf67f34ad999f7f0894488b21735a1ab028c499
Author: Petr Štětka <pstetka redhat com>
Date: Tue Oct 2 10:49:35 2018 +0200
storage: Update StorageGraph for better coloring pies
src/storage/storage-graph.vala | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/src/storage/storage-graph.vala b/src/storage/storage-graph.vala
index 218f5d8..e1f3873 100644
--- a/src/storage/storage-graph.vala
+++ b/src/storage/storage-graph.vala
@@ -78,17 +78,24 @@ namespace Usage
double start_angle = 0;
double final_angle = - Math.PI / 2.0;
double ratio = 0;
- uint shown_items_number = 0;
+ uint shown_items_number = 1;
var background_color =
get_toplevel().get_style_context().get_background_color(get_toplevel().get_style_context().get_state());
var foreground_color = get_style_context().get_color(get_style_context().get_state());
- for(int i = 0; i < model.get_n_items(); i++) {
- if((model.get_item(i) as StorageViewItem).percentage > min_percentage_shown_files)
+ for(int i = 1; i < model.get_n_items(); i++) {
+ var item = (model.get_item(i) as StorageViewItem);
+
+ if(i > 0 && i < 3 && (item.percentage < min_percentage_shown_files)) {
+ shown_items_number = model.get_n_items();
+ continue;
+ }
+
+ if(item.percentage > min_percentage_shown_files)
shown_items_number = shown_items_number + 1;
}
- if(shown_items_number <= 3)
- shown_items_number = model.get_n_items();
+ if(shown_items_number < 3)
+ shown_items_number = 3;
if(shown_items_number > 1) {
for(int i = 0; i < model.get_n_items(); i++)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]