From 4370d1d971fcdbd59f432fc710096f0ef16bb2e6 Mon Sep 17 00:00:00 2001 From: yggverse Date: Fri, 11 Oct 2024 02:40:08 +0300 Subject: [PATCH] drop options not in use --- src/app/browser.rs | 4 +-- src/app/browser/window.rs | 4 +-- src/app/browser/window/tab.rs | 15 ++--------- src/app/browser/window/tab/item.rs | 27 ++----------------- src/app/browser/window/tab/item/database.rs | 24 +++++------------ src/app/browser/window/tab/item/page.rs | 2 -- .../window/tab/item/page/navigation.rs | 2 -- .../tab/item/page/navigation/request.rs | 5 ---- 8 files changed, 14 insertions(+), 69 deletions(-) diff --git a/src/app/browser.rs b/src/app/browser.rs index d8a85c5c..1cc7ef01 100644 --- a/src/app/browser.rs +++ b/src/app/browser.rs @@ -55,8 +55,6 @@ impl Browser { action_tab_pin.clone(), )); - //window.gobject().append(header.gobject()); - // Init widget let widget = Arc::new(Widget::new(window.gobject())); @@ -119,7 +117,7 @@ impl Browser { action_tab_append.connect_activate({ let window = window.clone(); move |_, _| { - window.tab_append(None); + window.tab_append(); } }); diff --git a/src/app/browser/window.rs b/src/app/browser/window.rs index 50f4c5de..67fcad0c 100644 --- a/src/app/browser/window.rs +++ b/src/app/browser/window.rs @@ -83,8 +83,8 @@ impl Window { } // Actions - pub fn tab_append(&self, tab_page_navigation_request_text: Option) { - self.tab.append(tab_page_navigation_request_text, true); + pub fn tab_append(&self) { + self.tab.append(); } pub fn tab_page_navigation_base(&self) { diff --git a/src/app/browser/window/tab.rs b/src/app/browser/window/tab.rs index 66a292e9..cdbd340c 100644 --- a/src/app/browser/window/tab.rs +++ b/src/app/browser/window/tab.rs @@ -76,16 +76,9 @@ impl Tab { } // Actions - pub fn append( - &self, - page_navigation_request_text: Option, - is_initially_current: bool, - ) -> Arc { + pub fn append(&self) -> Arc { // Init new tab item let item = Item::new_arc( - page_navigation_request_text.clone(), - is_initially_current, - // Actions self.action_tab_page_navigation_base.clone(), self.action_tab_page_navigation_history_back.clone(), self.action_tab_page_navigation_history_forward.clone(), @@ -99,9 +92,7 @@ impl Tab { // Append new page self.widget.gobject().add_page(item.gobject(), None); - if page_navigation_request_text.is_none() { - item.page_navigation_request_grab_focus(); // @TODO - } + item.page_navigation_request_grab_focus(); // @TODO item } @@ -215,9 +206,7 @@ impl Tab { // Append new Notebook page /* @TODO self.widget.append( - item.label(), item.page(), - item.is_initially_current(), ); */ } } diff --git a/src/app/browser/window/tab/item.rs b/src/app/browser/window/tab/item.rs index 092e7459..7a77621f 100644 --- a/src/app/browser/window/tab/item.rs +++ b/src/app/browser/window/tab/item.rs @@ -20,16 +20,11 @@ pub struct Item { id: GString, // Components page: Arc, - // Extras, useful for session restore - is_initially_current: bool, } impl Item { // Construct pub fn new_arc( - page_navigation_request_text: Option, - is_initially_current: bool, - // Actions action_tab_page_navigation_base: Arc, action_tab_page_navigation_history_back: Arc, action_tab_page_navigation_history_forward: Arc, @@ -42,7 +37,6 @@ impl Item { // Init components let page = Page::new_arc( id.clone(), - page_navigation_request_text.clone(), action_tab_page_navigation_base.clone(), action_tab_page_navigation_history_back.clone(), action_tab_page_navigation_history_forward.clone(), @@ -51,11 +45,7 @@ impl Item { ); // Return struct - Arc::new(Self { - id, - is_initially_current, - page, - }) + Arc::new(Self { id, page }) } // Actions @@ -131,9 +121,6 @@ impl Item { for record in records { // Construct new item object let item = Item::new_arc( - None, - record.is_initially_current, - // Actions action_tab_page_navigation_base.clone(), action_tab_page_navigation_history_back.clone(), action_tab_page_navigation_history_forward.clone(), @@ -161,14 +148,8 @@ impl Item { transaction: &Transaction, app_browser_window_tab_id: &i64, page_number: &u32, - is_initially_current: &bool, ) -> Result<(), String> { - match Database::add( - transaction, - app_browser_window_tab_id, - page_number, - is_initially_current, - ) { + match Database::add(transaction, app_browser_window_tab_id, page_number) { Ok(_) => { let id = Database::last_insert_id(transaction); @@ -188,10 +169,6 @@ impl Item { self.id.clone() } - pub fn is_initially_current(&self) -> bool { - self.is_initially_current - } - pub fn gobject(&self) -> &Box { &self.page.gobject() } diff --git a/src/app/browser/window/tab/item/database.rs b/src/app/browser/window/tab/item/database.rs index 62ff9979..8694f744 100644 --- a/src/app/browser/window/tab/item/database.rs +++ b/src/app/browser/window/tab/item/database.rs @@ -3,7 +3,6 @@ use sqlite::{Error, Transaction}; pub struct Table { pub id: i64, // pub app_browser_window_tab_id: i64, not in use - pub is_initially_current: bool, } pub struct Database { @@ -17,8 +16,7 @@ impl Database { ( `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `app_browser_window_tab_id` INTEGER NOT NULL, - `page_number` INTEGER NOT NULL, - `is_initially_current` INTEGER NOT NULL + `page_number` INTEGER NOT NULL )", [], ) @@ -28,36 +26,28 @@ impl Database { tx: &Transaction, app_browser_window_tab_id: &i64, page_number: &u32, - is_initially_current: &bool, ) -> Result { tx.execute( "INSERT INTO `app_browser_window_tab_item` ( `app_browser_window_tab_id`, - `page_number`, - `is_initially_current` - ) VALUES (?, ?, ?)", - [ - app_browser_window_tab_id, - &(*page_number as i64), - &(*is_initially_current as i64), - ], + `page_number` + ) VALUES (?, ?)", + [app_browser_window_tab_id, &(*page_number as i64)], ) } pub fn records(tx: &Transaction, app_browser_window_tab_id: &i64) -> Result, Error> { let mut stmt = tx.prepare( "SELECT `id`, - `app_browser_window_tab_id`, - `is_initially_current` FROM `app_browser_window_tab_item` - WHERE `app_browser_window_tab_id` = ? - ORDER BY `page_number` ASC", // just order by, no store in struct wanted + `app_browser_window_tab_id` FROM `app_browser_window_tab_item` + WHERE `app_browser_window_tab_id` = ? + ORDER BY `page_number` ASC", // just order by, no store in struct wanted )?; let result = stmt.query_map([app_browser_window_tab_id], |row| { Ok(Table { id: row.get(0)?, // app_browser_window_tab_id: row.get(1)?, not in use - is_initially_current: row.get(2)?, }) })?; diff --git a/src/app/browser/window/tab/item/page.rs b/src/app/browser/window/tab/item/page.rs index fb9d3567..216b5882 100644 --- a/src/app/browser/window/tab/item/page.rs +++ b/src/app/browser/window/tab/item/page.rs @@ -40,7 +40,6 @@ impl Page { // Construct pub fn new_arc( name: GString, - navigation_request_text: Option, action_tab_page_navigation_base: Arc, action_tab_page_navigation_history_back: Arc, action_tab_page_navigation_history_forward: Arc, @@ -56,7 +55,6 @@ impl Page { // Init components let content = Arc::new(Content::new(action_page_open.clone())); let navigation = Arc::new(Navigation::new( - navigation_request_text, action_tab_page_navigation_base.clone(), action_tab_page_navigation_history_back.clone(), action_tab_page_navigation_history_forward.clone(), diff --git a/src/app/browser/window/tab/item/page/navigation.rs b/src/app/browser/window/tab/item/page/navigation.rs index 3c0708f3..53df15b0 100644 --- a/src/app/browser/window/tab/item/page/navigation.rs +++ b/src/app/browser/window/tab/item/page/navigation.rs @@ -32,7 +32,6 @@ pub struct Navigation { impl Navigation { pub fn new( - request_text: Option, action_tab_page_navigation_base: Arc, action_tab_page_navigation_history_back: Arc, action_tab_page_navigation_history_forward: Arc, @@ -47,7 +46,6 @@ impl Navigation { ); let reload = Reload::new(action_tab_page_navigation_reload.clone()); let request = Request::new( - request_text, action_update.clone(), action_tab_page_navigation_reload.clone(), ); 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 d9138a7a..82140579 100644 --- a/src/app/browser/window/tab/item/page/navigation/request.rs +++ b/src/app/browser/window/tab/item/page/navigation/request.rs @@ -25,7 +25,6 @@ pub struct Request { impl Request { // Construct pub fn new( - text: Option, // Actions action_update: Arc, action_tab_page_navigation_reload: Arc, // @TODO local `action_page_open`? @@ -34,10 +33,6 @@ impl Request { let widget = Entry::builder() .placeholder_text("URL or search term...") .hexpand(true) - .text(match text { - Some(text) => text, - None => GString::new(), - }) .build(); // Connect events