diff --git a/src/app.rs b/src/app.rs index 20143beb..7322b459 100644 --- a/src/app.rs +++ b/src/app.rs @@ -233,7 +233,7 @@ impl App { }; // Begin migration - match App::migrate(&transaction) { + match migrate(&transaction) { Ok(_) => { // Confirm changes match transaction.commit() { @@ -248,18 +248,18 @@ impl App { // Start application self.gobject.run() } - - // Tools - fn migrate(tx: &Transaction) -> Result<(), String> { - // Migrate self components - if let Err(e) = Database::init(&tx) { - return Err(e.to_string()); - } - - // Delegate migration to childs - Browser::migrate(&tx)?; - - // Success - Ok(()) - } +} + +// Tools +fn migrate(tx: &Transaction) -> Result<(), String> { + // Migrate self components + if let Err(e) = Database::init(&tx) { + return Err(e.to_string()); + } + + // Delegate migration to childs + browser::migrate(&tx)?; + + // Success + Ok(()) } diff --git a/src/app/browser.rs b/src/app/browser.rs index 75a058dd..38f13230 100644 --- a/src/app/browser.rs +++ b/src/app/browser.rs @@ -250,21 +250,21 @@ impl Browser { pub fn gobject(&self) -> &ApplicationWindow { &self.widget.gobject() } - - // Tools - pub fn migrate(tx: &Transaction) -> Result<(), String> { - // Migrate self components - if let Err(e) = Database::init(&tx) { - return Err(e.to_string()); - } - - // Delegate migration to childs - /* @TODO - Header::migrate(&tx)?; */ - Window::migrate(&tx)?; - Widget::migrate(&tx)?; - - // Success - Ok(()) - } +} + +// Tools +pub fn migrate(tx: &Transaction) -> Result<(), String> { + // Migrate self components + if let Err(e) = Database::init(&tx) { + return Err(e.to_string()); + } + + // Delegate migration to childs + /* @TODO + header::migrate(&tx)?; */ + window::migrate(&tx)?; + widget::migrate(&tx)?; + + // Success + Ok(()) } diff --git a/src/app/browser/widget.rs b/src/app/browser/widget.rs index 4a13e3f8..c0b41b59 100644 --- a/src/app/browser/widget.rs +++ b/src/app/browser/widget.rs @@ -100,18 +100,18 @@ impl Widget { pub fn gobject(&self) -> &ApplicationWindow { &self.gobject } - - // Tools - pub fn migrate(tx: &Transaction) -> Result<(), String> { - // Migrate self components - if let Err(e) = Database::init(&tx) { - return Err(e.to_string()); - } - - // Delegate migration to childs - // nothing yet.. - - // Success - Ok(()) - } +} + +// Tools +pub fn migrate(tx: &Transaction) -> Result<(), String> { + // Migrate self components + if let Err(e) = Database::init(&tx) { + return Err(e.to_string()); + } + + // Delegate migration to childs + // nothing yet.. + + // Success + Ok(()) } diff --git a/src/app/browser/window.rs b/src/app/browser/window.rs index 8c2b22e5..1fb68766 100644 --- a/src/app/browser/window.rs +++ b/src/app/browser/window.rs @@ -168,18 +168,18 @@ impl Window { pub fn gobject(&self) -> &Box { &self.widget.gobject() } - - // Tools - pub fn migrate(tx: &Transaction) -> Result<(), String> { - // Migrate self components - if let Err(e) = Database::init(&tx) { - return Err(e.to_string()); - } - - // Delegate migration to childs - Tab::migrate(&tx)?; - - // Success - Ok(()) - } +} + +// Tools +pub fn migrate(tx: &Transaction) -> Result<(), String> { + // Migrate self components + if let Err(e) = Database::init(&tx) { + return Err(e.to_string()); + } + + // Delegate migration to childs + tab::migrate(&tx)?; + + // Success + Ok(()) } diff --git a/src/app/browser/window/tab.rs b/src/app/browser/window/tab.rs index 1dfb4520..6dcee98b 100644 --- a/src/app/browser/window/tab.rs +++ b/src/app/browser/window/tab.rs @@ -335,21 +335,18 @@ impl Tab { pub fn gobject(&self) -> &TabView { self.widget.gobject() } - - // Tools - pub fn migrate(tx: &Transaction) -> Result<(), String> { - // Migrate self components - if let Err(e) = Database::init(&tx) { - return Err(e.to_string()); - } - - // Delegate migration to childs - Item::migrate(&tx)?; - - /* @TODO - Page::migrate(&tx)?; */ - - // Success - Ok(()) - } +} + +// Tools +pub fn migrate(tx: &Transaction) -> Result<(), String> { + // Migrate self components + if let Err(e) = Database::init(&tx) { + return Err(e.to_string()); + } + + // Delegate migration to childs + item::migrate(&tx)?; + + // Success + Ok(()) } diff --git a/src/app/browser/window/tab/item.rs b/src/app/browser/window/tab/item.rs index 621fb5e6..024b37e9 100644 --- a/src/app/browser/window/tab/item.rs +++ b/src/app/browser/window/tab/item.rs @@ -219,19 +219,19 @@ impl Item { pub fn gobject(&self) -> &TabPage { &self.widget.gobject() } - - // Tools - pub fn migrate(tx: &Transaction) -> Result<(), String> { - // Migrate self components - if let Err(e) = Database::init(&tx) { - return Err(e.to_string()); - } - - // Delegate migration to childs - Page::migrate(&tx)?; - Widget::migrate(&tx)?; - - // Success - Ok(()) - } +} + +// Tools +pub fn migrate(tx: &Transaction) -> Result<(), String> { + // Migrate self components + if let Err(e) = Database::init(&tx) { + return Err(e.to_string()); + } + + // Delegate migration to childs + page::migrate(&tx)?; + widget::migrate(&tx)?; + + // Success + Ok(()) } diff --git a/src/app/browser/window/tab/item/page.rs b/src/app/browser/window/tab/item/page.rs index 696c36e0..564bf10b 100644 --- a/src/app/browser/window/tab/item/page.rs +++ b/src/app/browser/window/tab/item/page.rs @@ -391,21 +391,6 @@ impl Page { &self.widget.gobject() } - // Tools - pub fn migrate(tx: &Transaction) -> Result<(), String> { - // Migrate self components - if let Err(e) = Database::init(tx) { - return Err(e.to_string()); - } - - // Delegate migration to childs - Meta::migrate(tx)?; - Navigation::migrate(tx)?; - - // Success - Ok(()) - } - // Private helpers @TODO move outside fn load_gemini(&self, uri: Uri) { // Use local namespaces @TODO @@ -938,6 +923,20 @@ impl Page { // Tools +pub fn migrate(tx: &Transaction) -> Result<(), String> { + // Migrate self components + if let Err(e) = Database::init(tx) { + return Err(e.to_string()); + } + + // Delegate migration to childs + meta::migrate(tx)?; + navigation::migrate(tx)?; + + // Success + Ok(()) +} + /// Helper function, extract readable title from [Uri](https://docs.gtk.org/glib/struct.Uri.html) /// /// Useful as common placeholder when page title could not be detected diff --git a/src/app/browser/window/tab/item/page/meta.rs b/src/app/browser/window/tab/item/page/meta.rs index b827795c..adc493ec 100644 --- a/src/app/browser/window/tab/item/page/meta.rs +++ b/src/app/browser/window/tab/item/page/meta.rs @@ -178,18 +178,18 @@ impl Meta { Ok(()) } - - // Tools - pub fn migrate(tx: &Transaction) -> Result<(), String> { - // Migrate self components - if let Err(e) = Database::init(&tx) { - return Err(e.to_string()); - } - - // Delegate migration to childs - // nothing yet.. - - // Success - Ok(()) - } +} + +// Tools +pub fn migrate(tx: &Transaction) -> Result<(), String> { + // Migrate self components + if let Err(e) = Database::init(&tx) { + return Err(e.to_string()); + } + + // Delegate migration to childs + // nothing yet.. + + // Success + Ok(()) } diff --git a/src/app/browser/window/tab/item/page/navigation.rs b/src/app/browser/window/tab/item/page/navigation.rs index 7ec12a05..27f24c85 100644 --- a/src/app/browser/window/tab/item/page/navigation.rs +++ b/src/app/browser/window/tab/item/page/navigation.rs @@ -168,18 +168,18 @@ impl Navigation { pub fn request_text(&self) -> GString { self.request.text() } - - // Tools - pub fn migrate(tx: &Transaction) -> Result<(), String> { - // Migrate self components - if let Err(e) = Database::init(&tx) { - return Err(e.to_string()); - } - - // Delegate migration to childs - Request::migrate(tx)?; - - // Success - Ok(()) - } +} + +// Tools +pub fn migrate(tx: &Transaction) -> Result<(), String> { + // Migrate self components + if let Err(e) = Database::init(&tx) { + return Err(e.to_string()); + } + + // Delegate migration to childs + request::migrate(tx)?; + + // Success + Ok(()) } diff --git a/src/app/browser/window/tab/item/page/navigation/request.rs b/src/app/browser/window/tab/item/page/navigation/request.rs index f0f75b9a..c3f62e6a 100644 --- a/src/app/browser/window/tab/item/page/navigation/request.rs +++ b/src/app/browser/window/tab/item/page/navigation/request.rs @@ -117,18 +117,18 @@ impl Request { _ => None, } } - - // Tools - pub fn migrate(tx: &Transaction) -> Result<(), String> { - // Migrate self components - if let Err(e) = Database::init(tx) { - return Err(e.to_string()); - } - - // Delegate migration to childs - Widget::migrate(tx)?; - - // Success - Ok(()) - } +} + +// Tools +pub fn migrate(tx: &Transaction) -> Result<(), String> { + // Migrate self components + if let Err(e) = Database::init(tx) { + return Err(e.to_string()); + } + + // Delegate migration to childs + widget::migrate(tx)?; + + // Success + Ok(()) } diff --git a/src/app/browser/window/tab/item/page/navigation/request/widget.rs b/src/app/browser/window/tab/item/page/navigation/request/widget.rs index 06bd38db..cf28eaa3 100644 --- a/src/app/browser/window/tab/item/page/navigation/request/widget.rs +++ b/src/app/browser/window/tab/item/page/navigation/request/widget.rs @@ -221,18 +221,18 @@ impl Widget { pub fn text(&self) -> GString { self.gobject.text() } - - // Tools - pub fn migrate(tx: &Transaction) -> Result<(), String> { - // Migrate self components - if let Err(e) = Database::init(&tx) { - return Err(e.to_string()); - } - - // Delegate migration to childs - // nothing yet.. - - // Success - Ok(()) - } +} + +// Tools +pub fn migrate(tx: &Transaction) -> Result<(), String> { + // Migrate self components + if let Err(e) = Database::init(&tx) { + return Err(e.to_string()); + } + + // Delegate migration to childs + // nothing yet.. + + // Success + Ok(()) } diff --git a/src/app/browser/window/tab/item/widget.rs b/src/app/browser/window/tab/item/widget.rs index a9147c12..65b6c711 100644 --- a/src/app/browser/window/tab/item/widget.rs +++ b/src/app/browser/window/tab/item/widget.rs @@ -124,18 +124,18 @@ impl Widget { pub fn gobject(&self) -> &TabPage { &self.gobject } - - // Tools - pub fn migrate(tx: &Transaction) -> Result<(), String> { - // Migrate self components - if let Err(e) = Database::init(&tx) { - return Err(e.to_string()); - } - - // Delegate migration to childs - // nothing yet.. - - // Success - Ok(()) - } +} + +// Tools +pub fn migrate(tx: &Transaction) -> Result<(), String> { + // Migrate self components + if let Err(e) = Database::init(&tx) { + return Err(e.to_string()); + } + + // Delegate migration to childs + // nothing yet.. + + // Success + Ok(()) }