mirror of
https://github.com/JockeTF/fimfareader.git
synced 2024-12-18 00:18:00 +01:00
Minor clean-ups in app
This commit is contained in:
parent
76a4951a1e
commit
ffeb7fe12b
1 changed files with 10 additions and 2 deletions
|
@ -3,7 +3,6 @@
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::BufReader;
|
use std::io::BufReader;
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
use std::sync::Mutex;
|
|
||||||
|
|
||||||
use gtk::*;
|
use gtk::*;
|
||||||
|
|
||||||
|
@ -33,6 +32,7 @@ impl AppWindow {
|
||||||
});
|
});
|
||||||
|
|
||||||
this.apply(this.fetcher.iter().collect());
|
this.apply(this.fetcher.iter().collect());
|
||||||
|
|
||||||
Some(Self::connect(this))
|
Some(Self::connect(this))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,6 +67,14 @@ impl AppWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn filter(&self, query: &str) {
|
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);
|
let filter = parse(query);
|
||||||
|
|
||||||
if filter.is_err() {
|
if filter.is_err() {
|
||||||
|
@ -74,7 +82,7 @@ impl AppWindow {
|
||||||
}
|
}
|
||||||
|
|
||||||
let filter = filter.unwrap();
|
let filter = filter.unwrap();
|
||||||
let vector = self.fetcher.filter(&filter);
|
let vector = fetcher.filter(&filter);
|
||||||
|
|
||||||
self.apply(vector);
|
self.apply(vector);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue