aboutsummaryrefslogtreecommitdiff
path: root/src/frontend
diff options
context:
space:
mode:
Diffstat (limited to 'src/frontend')
-rw-r--r--src/frontend/app.rs8
-rw-r--r--src/frontend/entries.rs30
2 files changed, 18 insertions, 20 deletions
diff --git a/src/frontend/app.rs b/src/frontend/app.rs
index 10cfa9b..822c6f0 100644
--- a/src/frontend/app.rs
+++ b/src/frontend/app.rs
@@ -76,7 +76,7 @@ impl App {
let main_biblio = BibiMain::new(main_bibfile.clone());
let tag_list = TagList::new(main_biblio.keyword_list.clone());
let search_struct = BibiSearch::default();
- let entry_table = EntryTable::new(&main_biblio.citekeys, &main_biblio.bibliography);
+ let entry_table = EntryTable::new(main_biblio.entry_list.clone());
let current_area = CurrentArea::EntryArea;
Ok(Self {
running,
@@ -127,8 +127,7 @@ impl App {
self.main_biblio = BibiMain::new(self.main_bibfile.clone());
// self.tag_list = TagList::from_iter(self.main_biblio.keyword_list.clone());
self.tag_list = TagList::new(self.main_biblio.keyword_list.clone());
- self.entry_table =
- EntryTable::new(&self.main_biblio.citekeys, &self.main_biblio.bibliography);
+ self.entry_table = EntryTable::new(self.main_biblio.entry_list.clone());
}
// Toggle moveable list between entries and tags
@@ -152,8 +151,7 @@ impl App {
}
pub fn reset_current_list(&mut self) {
- self.entry_table =
- EntryTable::new(&self.main_biblio.citekeys, &self.main_biblio.bibliography);
+ self.entry_table = EntryTable::new(self.main_biblio.entry_list.clone());
self.tag_list = TagList::new(self.main_biblio.keyword_list.clone());
if let CurrentArea::TagArea = self.current_area {
self.tag_list.tag_list_state.select(Some(0))
diff --git a/src/frontend/entries.rs b/src/frontend/entries.rs
index f64e35e..dea970e 100644
--- a/src/frontend/entries.rs
+++ b/src/frontend/entries.rs
@@ -18,7 +18,7 @@
use super::app::App;
use super::tui::Tui;
use crate::backend::{
- bib::{BibiMain, FileFormat},
+ bib::{BibiData, BibiMain, FileFormat},
search::BibiSearch,
};
use biblatex::Bibliography;
@@ -41,8 +41,8 @@ pub struct EntryTable {
}
impl EntryTable {
- pub fn new(citekeys: &Vec<String>, biblio: &Bibliography) -> Self {
- let entry_table_items = Self::set_entry_table(&citekeys, &biblio);
+ pub fn new(entry_list: Vec<BibiData>) -> Self {
+ let entry_table_items = Self::set_entry_table(entry_list);
let entry_table_state = TableState::default().with_selected(0);
let entry_scroll_state = ScrollbarState::new(entry_table_items.len());
let entry_info_scroll_state = ScrollbarState::default();
@@ -57,20 +57,20 @@ impl EntryTable {
}
}
- pub fn set_entry_table(citekeys: &[String], biblio: &Bibliography) -> Vec<EntryTableItem> {
- let mut entry_table: Vec<EntryTableItem> = citekeys
+ pub fn set_entry_table(entry_list: Vec<BibiData>) -> Vec<EntryTableItem> {
+ let mut entry_table: Vec<EntryTableItem> = entry_list
.into_iter()
- .map(|key| EntryTableItem {
- authors: BibiMain::get_authors(&key, &biblio),
+ .map(|e| EntryTableItem {
+ authors: e.authors,
short_author: String::new(),
- title: BibiMain::get_title(&key, &biblio),
- year: BibiMain::get_year(&key, &biblio),
- pubtype: BibiMain::get_pubtype(&key, &biblio),
- keywords: BibiMain::get_keywords(&key, &biblio),
- citekey: key.to_owned(),
- abstract_text: BibiMain::get_abstract(&key, &biblio),
- doi_url: BibiMain::get_weblink(&key, &biblio),
- filepath: BibiMain::get_filepath(&key, &biblio),
+ title: e.title,
+ year: e.year,
+ pubtype: e.pubtype,
+ keywords: e.keywords,
+ citekey: e.citekey,
+ abstract_text: e.abstract_text,
+ doi_url: e.doi_url,
+ filepath: e.filepath,
})
.collect();