diff options
author | Stefano Facchini <stefano.facchini@gmail.com> | 2013-07-23 00:19:14 +0200 |
---|---|---|
committer | Stefano Facchini <stefano.facchini@gmail.com> | 2013-07-23 00:27:33 +0200 |
commit | 42866f2d84a0255b84f25842a94b250b84844320 (patch) | |
tree | 89d50524cd823f4cce143bbfa5cffad04cf2548a | |
parent | 8bee1ab2b6ae7a944d38c2633aaec241f4c19a2e (diff) | |
download | baobab-wip/daisydiskish.tar.gz |
Kill zoomwip/daisydiskish
-rw-r--r-- | src/baobab-chart.vala | 60 | ||||
-rw-r--r-- | src/baobab-ringschart.vala | 15 | ||||
-rw-r--r-- | src/baobab-treemap.vala | 10 | ||||
-rw-r--r-- | src/baobab-window.vala | 2 |
4 files changed, 7 insertions, 80 deletions
diff --git a/src/baobab-chart.vala b/src/baobab-chart.vala index 2348c42..6019730 100644 --- a/src/baobab-chart.vala +++ b/src/baobab-chart.vala @@ -52,7 +52,6 @@ namespace Baobab { public abstract class Chart : Gtk.Widget { protected const uint MAX_DEPTH = 5; - protected const uint MIN_DEPTH = 1; const Gdk.RGBA TANGO_COLORS[] = {{0.94, 0.16, 0.16, 1.0}, /* tango: ef2929 */ {0.68, 0.49, 0.66, 1.0}, /* tango: ad7fa8 */ @@ -73,22 +72,6 @@ namespace Baobab { List<ChartItem> items; - uint max_depth_ = MAX_DEPTH; - public uint max_depth { - set { - var m = value.clamp (MIN_DEPTH, MAX_DEPTH); - if (max_depth_ == m) { - return; - } - max_depth_ = m; - model_changed = true; - queue_draw (); - } - get { - return max_depth_; - } - } - Gtk.TreeModel model_; public Gtk.TreeModel model { set { @@ -197,9 +180,6 @@ namespace Baobab { protected abstract void get_item_rectangle (ChartItem item); - protected abstract bool can_zoom_in (); - protected abstract bool can_zoom_out (); - protected abstract ChartItem create_new_chartitem (); SimpleActionGroup action_group; @@ -209,8 +189,6 @@ namespace Baobab { { "copy-path", copy_path }, { "trash-file", trash_file }, { "move-up", move_up_root }, - { "zoom-in", zoom_in }, - { "zoom-out", zoom_out } }; construct { @@ -357,7 +335,7 @@ namespace Baobab { continue; } - if ((item.has_any_child) && (item.depth < max_depth + 1)) { + if ((item.has_any_child) && (item.depth < MAX_DEPTH + 1)) { rel_start = 0; do { model.get (child_iter, percentage_column, out size, -1); @@ -384,7 +362,7 @@ namespace Baobab { if (Gdk.cairo_get_clip_rectangle (cr, out clip) && item.visible && clip.intersect (item.rect, null) && - (item.depth <= max_depth)) { + (item.depth <= MAX_DEPTH)) { bool highlighted = (item == highlighted_item); draw_item (cr, item, highlighted); } @@ -403,7 +381,7 @@ namespace Baobab { var root_depth = root.get_depth (); var node_depth = path.get_depth (); - if (((node_depth - root_depth) <= max_depth) && + if (((node_depth - root_depth) <= MAX_DEPTH) && (root.is_ancestor (path) || root.compare (path) == 0)) { queue_draw (); @@ -550,26 +528,6 @@ namespace Baobab { return false; } - protected override bool scroll_event (Gdk.EventScroll event) { - Gdk.EventMotion *e = (Gdk.EventMotion *) (&event); - switch (event.direction) { - case Gdk.ScrollDirection.LEFT: - case Gdk.ScrollDirection.UP: - zoom_out (); - motion_notify_event (*e); - break; - case Gdk.ScrollDirection.RIGHT: - case Gdk.ScrollDirection.DOWN: - zoom_in (); - motion_notify_event (*e); - break; - case Gdk.ScrollDirection.SMOOTH: - break; - } - - return false; - } - public void open_file () { (get_toplevel () as Window).open_item (highlighted_item.iter); } @@ -592,18 +550,6 @@ namespace Baobab { } } - public void zoom_in () { - if (can_zoom_in ()) { - max_depth--; - } - } - - public void zoom_out () { - if (can_zoom_out ()) { - max_depth++; - } - } - void build_context_menu () { if (context_menu != null) { return; diff --git a/src/baobab-ringschart.vala b/src/baobab-ringschart.vala index 45a46b8..7a811d9 100644 --- a/src/baobab-ringschart.vala +++ b/src/baobab-ringschart.vala @@ -78,7 +78,6 @@ namespace Baobab { } construct { - notify["max-depth"].connect (subtips_update); notify["highlighted-item"].connect (subtips_update); notify["root"].connect (subtips_update); } @@ -298,7 +297,7 @@ namespace Baobab { var padding = get_style_context ().get_padding (Gtk.StateFlags.NORMAL); var max_radius = int.min (allocation.width / 2, allocation.height / 2) - padding.left; // Assuming that padding is the same for all sides - var thickness = max_radius / (max_depth + 1); + var thickness = max_radius / (MAX_DEPTH + 1); if (ringsitem.parent == null) { ringsitem.min_radius = 0; @@ -308,7 +307,7 @@ namespace Baobab { } else { var parent = item.parent.data as RingschartItem; ringsitem.min_radius = ringsitem.depth * thickness; - if (ringsitem.depth > max_depth) { + if (ringsitem.depth > MAX_DEPTH) { return; } else { ringsitem.max_radius = ringsitem.min_radius + thickness; @@ -320,7 +319,7 @@ namespace Baobab { } ringsitem.start_angle = parent.start_angle + parent.angle * ringsitem.rel_start / 100; - ringsitem.continued = (ringsitem.has_any_child) && (ringsitem.depth == max_depth); + ringsitem.continued = (ringsitem.has_any_child) && (ringsitem.depth == MAX_DEPTH); parent.has_visible_children = true; } @@ -403,13 +402,5 @@ namespace Baobab { (angle >= ringsitem.start_angle) && (angle <= (ringsitem.start_angle + ringsitem.angle))); } - - protected override bool can_zoom_out () { - return (max_depth < MAX_DEPTH); - } - - protected override bool can_zoom_in () { - return (max_depth > MIN_DEPTH); - } } }
\ No newline at end of file diff --git a/src/baobab-treemap.vala b/src/baobab-treemap.vala index 68316b7..32d4373 100644 --- a/src/baobab-treemap.vala +++ b/src/baobab-treemap.vala @@ -161,7 +161,7 @@ namespace Baobab { get_item_rectangle (item); - if (item.depth == max_depth + 1) { + if (item.depth == MAX_DEPTH + 1) { more_visible_children = true; } else { max_visible_depth = uint.max (max_visible_depth, item.depth); @@ -188,13 +188,5 @@ namespace Baobab { return ((x >= rect.x) && (x <= (rect.x + rect.width)) && (y >= rect.y) && (y <= (rect.y + rect.height))); } - - protected override bool can_zoom_out () { - return more_visible_children; - } - - protected override bool can_zoom_in () { - return (max_visible_depth > 1); - } } }
\ No newline at end of file diff --git a/src/baobab-window.vala b/src/baobab-window.vala index 7e5c667..9cabf4b 100644 --- a/src/baobab-window.vala +++ b/src/baobab-window.vala @@ -566,8 +566,6 @@ namespace Baobab { } 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, show_allocated_size ? Scanner.Columns.ALLOC_SIZE : Scanner.Columns.SIZE, |