aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/main.rs b/src/main.rs
index 7d29d72..49e76ac 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -16,18 +16,17 @@ fn main() {
// hide the cursor
let mut screen = termion::cursor::HideCursor::from(screen);
- // open database
- let db = notmuch::Database::open(&"/home/gustav/.mail", notmuch::DatabaseMode::ReadOnly).unwrap();
+ let mut threads = {
+ // open database
+ let db = notmuch::Database::open(&"/home/gustav/.mail", notmuch::DatabaseMode::ReadOnly).unwrap();
- // get threads
- let query = db.create_query("tag:inbox").unwrap();
- let threads = query.search_threads().unwrap().collect();
+ // get threads
+ let query = db.create_query("tag:inbox").unwrap();
+ let threads = query.search_threads().unwrap();
- // init initial state
- let mut threads = Threads {
- threads,
- i: 0,
+ Threads::new(threads)
};
+
threads.init(&mut screen);
let mut state = State::Threads(threads);