From 5769dcf8fe0e4ca6cbe9759bfe1dee1a2812a560 Mon Sep 17 00:00:00 2001 From: yggverse Date: Mon, 30 Sep 2024 14:49:37 +0300 Subject: [PATCH] rename action --- src/browser.rs | 10 +++++----- src/browser/header.rs | 4 ++-- src/browser/header/tray.rs | 4 ++-- src/browser/main.rs | 4 ++-- src/browser/main/tab.rs | 8 ++++---- src/browser/main/tab/page.rs | 8 ++++---- src/browser/main/tab/page/navigation.rs | 6 +++--- src/browser/main/tab/page/navigation/reload.rs | 13 +++++++------ src/browser/main/tab/page/navigation/request.rs | 4 ++-- src/main.rs | 4 ++-- 10 files changed, 33 insertions(+), 32 deletions(-) diff --git a/src/browser.rs b/src/browser.rs index 3c7538a0..0c9f7e21 100644 --- a/src/browser.rs +++ b/src/browser.rs @@ -36,7 +36,7 @@ impl Browser { action_tab_append: Arc, action_tab_close: Arc, action_tab_close_all: Arc, - action_tab_page_reload: Arc, + action_tab_page_navigation_reload: Arc, action_tab_pin: Arc, ) -> Browser { // Init database @@ -49,12 +49,12 @@ impl Browser { action_tab_append.clone(), action_tab_close.clone(), action_tab_close_all.clone(), - action_tab_page_reload.clone(), + action_tab_page_navigation_reload.clone(), action_tab_pin.clone(), )); let main = Arc::new(Main::new( - action_tab_page_reload.clone(), + action_tab_page_navigation_reload.clone(), action_update.clone(), )); @@ -74,7 +74,7 @@ impl Browser { widget.add_action(action_tab_append.as_ref()); widget.add_action(action_tab_close.as_ref()); widget.add_action(action_tab_close_all.as_ref()); - widget.add_action(action_tab_page_reload.as_ref()); + widget.add_action(action_tab_page_navigation_reload.as_ref()); widget.add_action(action_tab_pin.as_ref()); // Init events @@ -122,7 +122,7 @@ impl Browser { } }); - action_tab_page_reload.connect_activate({ + action_tab_page_navigation_reload.connect_activate({ let main = main.clone(); move |_, _| { main.tab_page_reload(); diff --git a/src/browser/header.rs b/src/browser/header.rs index 7f0b7db7..51f0f471 100644 --- a/src/browser/header.rs +++ b/src/browser/header.rs @@ -21,7 +21,7 @@ impl Header { action_tab_append: Arc, action_tab_close: Arc, action_tab_close_all: Arc, - action_tab_page_reload: Arc, + action_tab_page_navigation_reload: Arc, action_tab_pin: Arc, ) -> Self { // Init components @@ -31,7 +31,7 @@ impl Header { action_tab_append, action_tab_close, action_tab_close_all, - action_tab_page_reload, + action_tab_page_navigation_reload, action_tab_pin, ); diff --git a/src/browser/header/tray.rs b/src/browser/header/tray.rs index d1537b2c..f3c53851 100644 --- a/src/browser/header/tray.rs +++ b/src/browser/header/tray.rs @@ -23,7 +23,7 @@ impl Tray { action_tab_append: Arc, action_tab_close: Arc, action_tab_close_all: Arc, - action_tab_page_reload: Arc, + action_tab_page_navigation_reload: Arc, action_tab_pin: Arc, ) -> Self { // Init components @@ -35,7 +35,7 @@ impl Tray { action_tab_append, action_tab_close, action_tab_close_all, - action_tab_page_reload, + action_tab_page_navigation_reload, action_tab_pin, ); diff --git a/src/browser/main.rs b/src/browser/main.rs index 45d07fd7..628f5c7d 100644 --- a/src/browser/main.rs +++ b/src/browser/main.rs @@ -14,11 +14,11 @@ pub struct Main { impl Main { // Construct pub fn new( - action_tab_page_reload: Arc, + action_tab_page_navigation_reload: Arc, action_update: Arc, ) -> Self { // Init components - let tab = Arc::new(Tab::new(action_tab_page_reload, action_update)); + let tab = Arc::new(Tab::new(action_tab_page_navigation_reload, action_update)); tab.activate(tab.clone()); tab.append(Some(GString::from("gemini://geminiprotocol.net/")), true); // demo tab @TODO replace with session restore feature diff --git a/src/browser/main/tab.rs b/src/browser/main/tab.rs index 96f6f757..900fce30 100644 --- a/src/browser/main/tab.rs +++ b/src/browser/main/tab.rs @@ -17,7 +17,7 @@ pub struct Tab { // GTK widget: Notebook, // Keep action links in memory to not require them on every tab append - action_tab_page_reload: Arc, + action_tab_page_navigation_reload: Arc, action_update: Arc, // Dynamically allocated reference index labels: RefCell>>, @@ -27,7 +27,7 @@ pub struct Tab { impl Tab { // Construct pub fn new( - action_tab_page_reload: Arc, + action_tab_page_navigation_reload: Arc, action_update: Arc, ) -> Self { // Init widget @@ -38,7 +38,7 @@ impl Tab { // GTK widget, // Define action links - action_tab_page_reload, + action_tab_page_navigation_reload, action_update, // Init empty HashMap index as no tabs appended yet labels: RefCell::new(HashMap::new()), @@ -76,7 +76,7 @@ impl Tab { let page = Arc::new(Page::new( id.clone(), page_navigation_request_text.clone(), - self.action_tab_page_reload.clone(), + self.action_tab_page_navigation_reload.clone(), self.action_update.clone(), )); diff --git a/src/browser/main/tab/page.rs b/src/browser/main/tab/page.rs index 44af7c01..c66b2efc 100644 --- a/src/browser/main/tab/page.rs +++ b/src/browser/main/tab/page.rs @@ -24,7 +24,7 @@ pub struct Page { // GTK widget: Box, // Actions - // action_tab_page_reload: Arc, + // action_tab_page_navigation_reload: Arc, action_update: Arc, // Components navigation: Arc, @@ -38,7 +38,7 @@ impl Page { pub fn new( name: GString, navigation_request_text: Option, - action_tab_page_reload: Arc, + action_tab_page_navigation_reload: Arc, action_update: Arc, ) -> Page { // Init actions @@ -55,7 +55,7 @@ impl Page { let content = Arc::new(Content::new(action_page_open.clone())); let navigation = Arc::new(Navigation::new( navigation_request_text, - action_tab_page_reload.clone(), + action_tab_page_navigation_reload.clone(), action_update.clone(), )); @@ -94,7 +94,7 @@ impl Page { // GTK widget, // Actions - // action_tab_page_reload, + // action_tab_page_navigation_reload, action_update, // Components content, diff --git a/src/browser/main/tab/page/navigation.rs b/src/browser/main/tab/page/navigation.rs index 3054fbb9..bfe7ff26 100644 --- a/src/browser/main/tab/page/navigation.rs +++ b/src/browser/main/tab/page/navigation.rs @@ -33,17 +33,17 @@ pub struct Navigation { impl Navigation { pub fn new( request_text: Option, - action_tab_page_reload: Arc, + action_tab_page_navigation_reload: Arc, action_update: Arc, ) -> Self { // Init components let base = Base::new(); let history = History::new(); - let reload = Reload::new(action_tab_page_reload.clone()); + let reload = Reload::new(action_tab_page_navigation_reload.clone()); let request = Request::new( request_text, action_update.clone(), - action_tab_page_reload.clone(), + action_tab_page_navigation_reload.clone(), ); let bookmark = Bookmark::new(); diff --git a/src/browser/main/tab/page/navigation/reload.rs b/src/browser/main/tab/page/navigation/reload.rs index 7af3e657..c02ce35f 100644 --- a/src/browser/main/tab/page/navigation/reload.rs +++ b/src/browser/main/tab/page/navigation/reload.rs @@ -6,13 +6,13 @@ use gtk::{ use std::sync::Arc; pub struct Reload { - action_tab_page_reload: Arc, + action_tab_page_navigation_reload: Arc, widget: Button, } impl Reload { // Construct - pub fn new(action_tab_page_reload: Arc) -> Self { + pub fn new(action_tab_page_navigation_reload: Arc) -> Self { // Init widget let widget = Button::builder() .icon_name("view-refresh-symbolic") @@ -22,22 +22,23 @@ impl Reload { // Init events widget.connect_clicked({ - let action_tab_page_reload = action_tab_page_reload.clone(); + let action_tab_page_navigation_reload = action_tab_page_navigation_reload.clone(); move |_| { - action_tab_page_reload.activate(None); + action_tab_page_navigation_reload.activate(None); } }); // Return activated struct Self { - action_tab_page_reload, + action_tab_page_navigation_reload, widget, } } // Actions pub fn update(&self, is_enabled: bool) { - self.action_tab_page_reload.set_enabled(is_enabled); + self.action_tab_page_navigation_reload + .set_enabled(is_enabled); self.widget.set_sensitive(is_enabled); } diff --git a/src/browser/main/tab/page/navigation/request.rs b/src/browser/main/tab/page/navigation/request.rs index 28bcaff6..21eb1223 100644 --- a/src/browser/main/tab/page/navigation/request.rs +++ b/src/browser/main/tab/page/navigation/request.rs @@ -28,7 +28,7 @@ impl Request { text: Option, // Actions action_update: Arc, - action_tab_page_reload: Arc, + action_tab_page_navigation_reload: Arc, ) -> Self { // GTK let widget = Entry::builder() @@ -46,7 +46,7 @@ impl Request { }); widget.connect_activate(move |_| { - action_tab_page_reload.activate(None); + action_tab_page_navigation_reload.activate(None); }); // Init animated progressbar state diff --git a/src/main.rs b/src/main.rs index 30f8ec73..9021d349 100644 --- a/src/main.rs +++ b/src/main.rs @@ -25,7 +25,7 @@ fn main() -> ExitCode { let action_tab_append = Arc::new(SimpleAction::new("tab_append", None)); let action_tab_close = Arc::new(SimpleAction::new("tab_close", None)); let action_tab_close_all = Arc::new(SimpleAction::new("tab_close_all", None)); - let action_tab_page_reload = Arc::new(SimpleAction::new("tab_page_reload", None)); + let action_tab_page_navigation_reload = Arc::new(SimpleAction::new("tab_page_reload", None)); let action_tab_pin = Arc::new(SimpleAction::new("tab_pin", None)); // Init accels @@ -74,7 +74,7 @@ fn main() -> ExitCode { action_tab_append.clone(), action_tab_close.clone(), action_tab_close_all.clone(), - action_tab_page_reload.clone(), + action_tab_page_navigation_reload.clone(), action_tab_pin.clone(), ) .widget()