From 9a4323fdda19fa2cfe593a15c4aa0339387e4f34 Mon Sep 17 00:00:00 2001 From: yggverse Date: Tue, 5 Nov 2024 03:19:52 +0200 Subject: [PATCH] enshort methods name --- src/app/browser.rs | 8 ++++---- src/app/browser/window.rs | 16 ++++++++-------- src/app/browser/window/tab.rs | 18 +++++++++--------- src/app/browser/window/tab/item.rs | 16 ++++++++-------- src/app/browser/window/tab/item/page.rs | 18 ++++++++++-------- 5 files changed, 39 insertions(+), 37 deletions(-) diff --git a/src/app/browser.rs b/src/app/browser.rs index b3588d10..783c1d62 100644 --- a/src/app/browser.rs +++ b/src/app/browser.rs @@ -148,27 +148,27 @@ impl Browser { action_page_home.connect_activate({ let window = window.clone(); move |this, _| { - window.tab_page_navigation_home(page_position_from_action_state(this)); + window.tab_page_home(page_position_from_action_state(this)); } }); action_page_history_back.connect_activate({ let window = window.clone(); move |this, _| { - window.tab_page_navigation_history_back(page_position_from_action_state(this)); + window.tab_page_history_back(page_position_from_action_state(this)); } }); action_page_history_forward.connect_activate({ let window = window.clone(); move |this, _| { - window.tab_page_navigation_history_forward(page_position_from_action_state(this)); + window.tab_page_history_forward(page_position_from_action_state(this)); } }); action_page_reload.connect_activate({ let window = window.clone(); - move |this, _| window.tab_page_navigation_reload(page_position_from_action_state(this)) + move |this, _| window.tab_page_reload(page_position_from_action_state(this)) }); action_page_pin.connect_activate({ diff --git a/src/app/browser/window.rs b/src/app/browser/window.rs index 519e0330..75aeb4ae 100644 --- a/src/app/browser/window.rs +++ b/src/app/browser/window.rs @@ -83,21 +83,21 @@ impl Window { self.tab.append(page_position); } - pub fn tab_page_navigation_home(&self, page_position: Option) { - self.tab.page_navigation_home(page_position); + pub fn tab_page_home(&self, page_position: Option) { + self.tab.page_home(page_position); } - pub fn tab_page_navigation_history_back(&self, page_position: Option) { - self.tab.page_navigation_history_back(page_position); + pub fn tab_page_history_back(&self, page_position: Option) { + self.tab.page_history_back(page_position); } - pub fn tab_page_navigation_history_forward(&self, page_position: Option) { - self.tab.page_navigation_history_forward(page_position); + pub fn tab_page_history_forward(&self, page_position: Option) { + self.tab.page_history_forward(page_position); } /// Reload page at given position or selected page on `None` given - pub fn tab_page_navigation_reload(&self, position: Option) { - self.tab.page_navigation_reload(position); + pub fn tab_page_reload(&self, position: Option) { + self.tab.page_reload(position); } /// Close page at given position or selected page on `None` given diff --git a/src/app/browser/window/tab.rs b/src/app/browser/window/tab.rs index 3f5778e3..0678afd5 100644 --- a/src/app/browser/window/tab.rs +++ b/src/app/browser/window/tab.rs @@ -152,7 +152,7 @@ impl Tab { if let Some(variant) = request { if let Some(value) = variant.get::() { item.set_page_navigation_request_text(value.as_str()); - item.page_navigation_reload(); + item.page_reload(); } } } @@ -216,42 +216,42 @@ impl Tab { self.widget.pin(page_position); } - pub fn page_navigation_home(&self, page_position: Option) { + pub fn page_home(&self, page_position: Option) { if let Some(page) = self.widget.page(page_position) { if let Some(id) = page.keyword() { if let Some(item) = self.index.borrow().get(&id) { - item.page_navigation_home(); + item.page_home(); } } } } - pub fn page_navigation_history_back(&self, page_position: Option) { + pub fn page_history_back(&self, page_position: Option) { if let Some(page) = self.widget.page(page_position) { if let Some(id) = page.keyword() { if let Some(item) = self.index.borrow().get(&id) { - item.page_navigation_history_back(); + item.page_history_back(); } } } } - pub fn page_navigation_history_forward(&self, page_position: Option) { + pub fn page_history_forward(&self, page_position: Option) { if let Some(page) = self.widget.page(page_position) { if let Some(id) = page.keyword() { if let Some(item) = self.index.borrow().get(&id) { - item.page_navigation_history_forward(); + item.page_history_forward(); } } } } /// Reload page at `i32` position or selected page on `None` given - pub fn page_navigation_reload(&self, page_position: Option) { + pub fn page_reload(&self, page_position: Option) { if let Some(page) = self.widget.page(page_position) { if let Some(id) = page.keyword() { if let Some(item) = self.index.borrow().get(&id) { - item.page_navigation_reload(); + item.page_reload(); } } } diff --git a/src/app/browser/window/tab/item.rs b/src/app/browser/window/tab/item.rs index 024b37e9..2ace1020 100644 --- a/src/app/browser/window/tab/item.rs +++ b/src/app/browser/window/tab/item.rs @@ -69,20 +69,20 @@ impl Item { } // Actions - pub fn page_navigation_home(&self) { - self.page.navigation_home() + pub fn page_home(&self) { + self.page.home() } - pub fn page_navigation_history_back(&self) { - self.page.navigation_history_back() + pub fn page_history_back(&self) { + self.page.history_back() } - pub fn page_navigation_history_forward(&self) { - self.page.navigation_history_forward() + pub fn page_history_forward(&self) { + self.page.history_forward() } - pub fn page_navigation_reload(&self) { - self.page.navigation_reload() + pub fn page_reload(&self) { + self.page.reload() } pub fn page_navigation_request_grab_focus(&self) { diff --git a/src/app/browser/window/tab/item/page.rs b/src/app/browser/window/tab/item/page.rs index 133011cd..910d2aa4 100644 --- a/src/app/browser/window/tab/item/page.rs +++ b/src/app/browser/window/tab/item/page.rs @@ -124,18 +124,15 @@ impl Page { } // Actions - pub fn navigation_request_grab_focus(&self) { - self.navigation.request_grab_focus(); - } - pub fn navigation_home(&self) { + pub fn home(&self) { if let Some(url) = self.navigation.home_url() { // Update with history record self.action_page_open.activate(Some(&url.to_variant())); } } - pub fn navigation_history_back(&self) { + pub fn history_back(&self) { if let Some(request) = self.navigation.history_back(true) { // Update self.navigation.set_request_text(&request); @@ -145,7 +142,7 @@ impl Page { } } - pub fn navigation_history_forward(&self) { + pub fn history_forward(&self) { if let Some(request) = self.navigation.history_forward(true) { // Update self.navigation.set_request_text(&request); @@ -155,8 +152,7 @@ impl Page { } } - // @TODO rename to `load` - pub fn navigation_reload(&self) { + pub fn reload(&self) { /// Global limit to prevent infinitive redirects (ALL protocols) /// * every protocol implementation has own value checker, according to specification const DEFAULT_MAX_REDIRECT_COUNT: i8 = 10; @@ -359,12 +355,18 @@ impl Page { Ok(()) } + pub fn navigation_request_grab_focus(&self) { + self.navigation.request_grab_focus(); + } + // Setters + pub fn set_navigation_request_text(&self, value: &str) { self.navigation.set_request_text(value); } // Getters + pub fn progress_fraction(&self) -> Option { // Interpret status to progress fraction match self.meta.status() {