diff --git a/src/profile/history.rs b/src/profile/history.rs index c4d034cb..57f1e19b 100644 --- a/src/profile/history.rs +++ b/src/profile/history.rs @@ -30,7 +30,7 @@ impl History { pub fn open(&self, request: GString, title: Option) { let mut memory = self.memory.borrow_mut(); if !memory.open(&request) { - memory.add(Item::create(0, request, title)) // @TODO + memory.add(Item::init(request, title)) } } diff --git a/src/profile/history/item.rs b/src/profile/history/item.rs index 27955c96..d86d4c05 100644 --- a/src/profile/history/item.rs +++ b/src/profile/history/item.rs @@ -2,19 +2,27 @@ use gtk::glib::{DateTime, GString}; #[derive(Clone)] pub struct Item { - pub id: i64, + /// Queued for DB insert on value is `None` (e.g. on app close) + pub id: Option, + /// The value for navigation request entry pub request: GString, + /// Some history items may contain title (e.g. gemtext documents and system tabs) + /// * used as the additional criteria for search in the navbar suggestions widget pub title: Option, + /// Collect opened count with event time + /// * used for sort order search results in the navbar suggestions widget pub opened: Vec, + /// Collect tab closed count with event time + /// * used in recently closed pages menu pub closed: Vec, } impl Item { // Constructors - pub fn create(id: i64, request: GString, title: Option) -> Self { + pub fn init(request: GString, title: Option) -> Self { Self { - id, + id: None, request, title, opened: vec![now()],