From b1e8624b6f84aa4780925d4b8840dc5587c18b69 Mon Sep 17 00:00:00 2001 From: Enrico Zini Date: Mon, 14 Dec 2009 18:22:35 +0000 Subject: [PATCH] Added entry used to reset filter --- gtkfisheyelist/gtkfisheyelistview.vala | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/gtkfisheyelist/gtkfisheyelistview.vala b/gtkfisheyelist/gtkfisheyelistview.vala index 10b790f..4918269 100644 --- a/gtkfisheyelist/gtkfisheyelistview.vala +++ b/gtkfisheyelist/gtkfisheyelistview.vala @@ -209,11 +209,17 @@ public class FisheyeListView : Gtk.DrawingArea int x = (int)event.x; if (x < allocation.width / 3) { - Gtk.TreeIter iter; - if (model.iter_nth_child(out iter, null, label_cache[cur_el].index)) + if (label_cache[cur_el].index == -1) { - Gtk.TreePath path = model.get_path(iter); - row_activated(path); + // The case of "reset filter" + prefix_filter = null; + } else { + Gtk.TreeIter iter; + if (model.iter_nth_child(out iter, null, label_cache[cur_el].index)) + { + Gtk.TreePath path = model.get_path(iter); + row_activated(path); + } } } else if (cur_pfx != null && x > allocation.width * 2 / 3) { //stderr.printf("Mouse released on prefix %s\n", cur_pfx.prefix); @@ -327,7 +333,7 @@ public class FisheyeListView : Gtk.DrawingArea else { int count = model.iter_n_children(null); - label_cache = new LabelInfo[count]; + label_cache = new LabelInfo[count + 1]; int lc_idx = 0; int model_idx = 0; @@ -351,6 +357,12 @@ public class FisheyeListView : Gtk.DrawingArea } ++model_idx; } while (model.iter_next(ref iter)); + if (_prefix_filter != null) + { + label_cache[lc_idx].label = "(reset prefix)"; + label_cache[lc_idx].index = -1; + ++lc_idx; + } prefixes.append(pi); label_count = lc_idx; } -- 2.39.5