mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-03-13 06:01:21 +00:00
fix tab append on initial application startup
This commit is contained in:
parent
7c9ab300d3
commit
ef227f276d
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "Yoda"
|
name = "Yoda"
|
||||||
version = "0.5.0"
|
version = "0.4.1"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
@ -119,6 +119,7 @@ impl App {
|
|||||||
// Restore previous session from DB
|
// Restore previous session from DB
|
||||||
match Database::records(&transaction) {
|
match Database::records(&transaction) {
|
||||||
Ok(records) => {
|
Ok(records) => {
|
||||||
|
// Restore child components
|
||||||
for record in records {
|
for record in records {
|
||||||
if let Err(e) =
|
if let Err(e) =
|
||||||
browser.restore(&transaction, &record.id)
|
browser.restore(&transaction, &record.id)
|
||||||
@ -126,6 +127,9 @@ impl App {
|
|||||||
todo!("{e}")
|
todo!("{e}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Run initial features
|
||||||
|
browser.init();
|
||||||
}
|
}
|
||||||
Err(e) => todo!("{e}"),
|
Err(e) => todo!("{e}"),
|
||||||
}
|
}
|
||||||
|
@ -236,6 +236,10 @@ impl Browser {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn init(&self) {
|
||||||
|
self.window.init();
|
||||||
|
}
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
pub fn gobject(&self) -> &ApplicationWindow {
|
pub fn gobject(&self) -> &ApplicationWindow {
|
||||||
&self.widget.gobject()
|
&self.widget.gobject()
|
||||||
|
@ -160,6 +160,10 @@ impl Window {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn init(&self) {
|
||||||
|
self.tab.init();
|
||||||
|
}
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
pub fn gobject(&self) -> &Box {
|
pub fn gobject(&self) -> &Box {
|
||||||
&self.widget.gobject()
|
&self.widget.gobject()
|
||||||
|
@ -217,11 +217,6 @@ impl Tab {
|
|||||||
// Register dynamically created tab item in the HashMap index
|
// Register dynamically created tab item in the HashMap index
|
||||||
self.index.borrow_mut().insert(item.id(), item.clone());
|
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()),
|
Err(e) => return Err(e.to_string()),
|
||||||
}
|
}
|
||||||
@ -260,6 +255,15 @@ impl Tab {
|
|||||||
Ok(())
|
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
|
// Getters
|
||||||
pub fn gobject(&self) -> &TabView {
|
pub fn gobject(&self) -> &TabView {
|
||||||
self.widget.gobject()
|
self.widget.gobject()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user