From ffeb7fe12bab8d6f5d46176be49ba0c158277984 Mon Sep 17 00:00:00 2001 From: Joakim Soderlund Date: Sat, 14 Sep 2019 23:12:03 +0200 Subject: [PATCH] Minor clean-ups in app --- gtk/src/components/app.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/gtk/src/components/app.rs b/gtk/src/components/app.rs index 4e7345d..4d9b90b 100644 --- a/gtk/src/components/app.rs +++ b/gtk/src/components/app.rs @@ -3,7 +3,6 @@ use std::fs::File; use std::io::BufReader; use std::rc::Rc; -use std::sync::Mutex; use gtk::*; @@ -33,6 +32,7 @@ impl AppWindow { }); this.apply(this.fetcher.iter().collect()); + Some(Self::connect(this)) } @@ -67,6 +67,14 @@ impl AppWindow { } pub fn filter(&self, query: &str) { + let fetcher = &self.fetcher; + + if query.trim() == "" { + let iter = fetcher.iter(); + self.apply(iter.collect()); + return; + } + let filter = parse(query); if filter.is_err() { @@ -74,7 +82,7 @@ impl AppWindow { } let filter = filter.unwrap(); - let vector = self.fetcher.filter(&filter); + let vector = fetcher.filter(&filter); self.apply(vector); }