summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2021-01-14 19:57:32 +0100
committerMatthias Beyer <mail@beyermatthias.de>2021-01-14 20:55:30 +0100
commit328601602712958ad5e201d239f62440a1b02401 (patch)
tree051e24bc8a4cbf0261f9368b41545d308ed7d682 /src
parent48e862f21dfee6b2bf31cf16625a64f73527feda (diff)
Wrap view in a cursive_multiplex
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'src')
-rw-r--r--src/main_view.rs23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/main_view.rs b/src/main_view.rs
index c5ee920..d7e7e66 100644
--- a/src/main_view.rs
+++ b/src/main_view.rs
@@ -24,6 +24,7 @@ pub const MAIN_MAIL_LIST_NAME: &'static str = "main_mail_list";
pub struct MainView {
config: Configuration,
+ muxroot: cursive_multiplex::Id,
tabs: cursive_tabs::TabPanel<String>,
}
@@ -96,16 +97,26 @@ impl View for MainView {
impl MainView {
pub fn new(config: Configuration) -> Result<NamedView<Self>> {
+ use cursive::view::SizeConstraint;
+ let mut tab = cursive_multiplex::Mux::new();
+ let muxroot = tab.root().build().unwrap();
+
+ {
+ let dbpath = config.notmuch_database_path();
+ let dbquery = config.notmuch_default_query();
+ let mlname = MAIN_MAIL_LIST_NAME.to_string();
+ let mlview = MaillistView::create_for(dbpath, dbquery, mlname)?.with_name(MAIN_MAIL_LIST_NAME);
+ let view = ResizedView::new(SizeConstraint::Full, SizeConstraint::Full, mlview);
+
+ let _ = tab.add_right_of(view, muxroot);
+ }
+
let tabs = cursive_tabs::TabPanel::default()
.with_bar_alignment(cursive_tabs::Align::Start)
.with_bar_placement(cursive_tabs::Placement::HorizontalTop)
- .with_tab(config.notmuch_default_query().clone(), {
- ResizedView::new(cursive::view::SizeConstraint::Full,
- cursive::view::SizeConstraint::Full,
- MaillistView::create_for(config.notmuch_database_path().clone(), config.notmuch_default_query(), MAIN_MAIL_LIST_NAME.to_string())?)
- });
+ .with_tab(config.notmuch_default_query().clone(), tab);
- Ok(MainView { config, tabs }.with_name(MAIN_VIEW_NAME))
+ Ok(MainView { config, muxroot, tabs }.with_name(MAIN_VIEW_NAME))
}
pub fn add_tab<T: View>(&mut self, id: String, view: T) {