diff --git a/Cargo.toml b/Cargo.toml index 8a3b8560..ffe1b0dc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "Yoda" -version = "0.5.0" +version = "0.4.1" edition = "2021" license = "MIT" readme = "README.md" diff --git a/src/app.rs b/src/app.rs index b9e15800..281f9472 100644 --- a/src/app.rs +++ b/src/app.rs @@ -119,6 +119,7 @@ impl App { // Restore previous session from DB match Database::records(&transaction) { Ok(records) => { + // Restore child components for record in records { if let Err(e) = browser.restore(&transaction, &record.id) @@ -126,6 +127,9 @@ impl App { todo!("{e}") } } + + // Run initial features + browser.init(); } Err(e) => todo!("{e}"), } diff --git a/src/app/browser.rs b/src/app/browser.rs index 086ee42f..b079567e 100644 --- a/src/app/browser.rs +++ b/src/app/browser.rs @@ -236,6 +236,10 @@ impl Browser { Ok(()) } + pub fn init(&self) { + self.window.init(); + } + // Getters pub fn gobject(&self) -> &ApplicationWindow { &self.widget.gobject() diff --git a/src/app/browser/window.rs b/src/app/browser/window.rs index 9c4fc4a3..9c058bb1 100644 --- a/src/app/browser/window.rs +++ b/src/app/browser/window.rs @@ -160,6 +160,10 @@ impl Window { Ok(()) } + pub fn init(&self) { + self.tab.init(); + } + // Getters pub fn gobject(&self) -> &Box { &self.widget.gobject() diff --git a/src/app/browser/window/tab.rs b/src/app/browser/window/tab.rs index 76db56e2..bd5e477a 100644 --- a/src/app/browser/window/tab.rs +++ b/src/app/browser/window/tab.rs @@ -217,11 +217,6 @@ impl Tab { // Register dynamically created tab item in the HashMap index self.index.borrow_mut().insert(item.id(), item.clone()); } - - // Append just one blank page if nothing to restore - if self.index.borrow().is_empty() { - self.append(); - } } Err(e) => return Err(e.to_string()), } @@ -260,6 +255,15 @@ impl Tab { Ok(()) } + pub fn init(&self) { + // Append just one blank page if no tabs available after last session restore + if self.index.borrow().is_empty() { + self.append(); + } + + // @TODO other/child features.. + } + // Getters pub fn gobject(&self) -> &TabView { self.widget.gobject()