enshort methods name

This commit is contained in:
yggverse 2024-11-05 03:19:52 +02:00
parent cf002cebd8
commit 9a4323fdda
5 changed files with 39 additions and 37 deletions

View File

@ -148,27 +148,27 @@ impl Browser {
action_page_home.connect_activate({ action_page_home.connect_activate({
let window = window.clone(); let window = window.clone();
move |this, _| { 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({ action_page_history_back.connect_activate({
let window = window.clone(); let window = window.clone();
move |this, _| { 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({ action_page_history_forward.connect_activate({
let window = window.clone(); let window = window.clone();
move |this, _| { 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({ action_page_reload.connect_activate({
let window = window.clone(); 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({ action_page_pin.connect_activate({

View File

@ -83,21 +83,21 @@ impl Window {
self.tab.append(page_position); self.tab.append(page_position);
} }
pub fn tab_page_navigation_home(&self, page_position: Option<i32>) { pub fn tab_page_home(&self, page_position: Option<i32>) {
self.tab.page_navigation_home(page_position); self.tab.page_home(page_position);
} }
pub fn tab_page_navigation_history_back(&self, page_position: Option<i32>) { pub fn tab_page_history_back(&self, page_position: Option<i32>) {
self.tab.page_navigation_history_back(page_position); self.tab.page_history_back(page_position);
} }
pub fn tab_page_navigation_history_forward(&self, page_position: Option<i32>) { pub fn tab_page_history_forward(&self, page_position: Option<i32>) {
self.tab.page_navigation_history_forward(page_position); self.tab.page_history_forward(page_position);
} }
/// Reload page at given position or selected page on `None` given /// Reload page at given position or selected page on `None` given
pub fn tab_page_navigation_reload(&self, position: Option<i32>) { pub fn tab_page_reload(&self, position: Option<i32>) {
self.tab.page_navigation_reload(position); self.tab.page_reload(position);
} }
/// Close page at given position or selected page on `None` given /// Close page at given position or selected page on `None` given

View File

@ -152,7 +152,7 @@ impl Tab {
if let Some(variant) = request { if let Some(variant) = request {
if let Some(value) = variant.get::<String>() { if let Some(value) = variant.get::<String>() {
item.set_page_navigation_request_text(value.as_str()); 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); self.widget.pin(page_position);
} }
pub fn page_navigation_home(&self, page_position: Option<i32>) { pub fn page_home(&self, page_position: Option<i32>) {
if let Some(page) = self.widget.page(page_position) { if let Some(page) = self.widget.page(page_position) {
if let Some(id) = page.keyword() { if let Some(id) = page.keyword() {
if let Some(item) = self.index.borrow().get(&id) { 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<i32>) { pub fn page_history_back(&self, page_position: Option<i32>) {
if let Some(page) = self.widget.page(page_position) { if let Some(page) = self.widget.page(page_position) {
if let Some(id) = page.keyword() { if let Some(id) = page.keyword() {
if let Some(item) = self.index.borrow().get(&id) { 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<i32>) { pub fn page_history_forward(&self, page_position: Option<i32>) {
if let Some(page) = self.widget.page(page_position) { if let Some(page) = self.widget.page(page_position) {
if let Some(id) = page.keyword() { if let Some(id) = page.keyword() {
if let Some(item) = self.index.borrow().get(&id) { 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 /// Reload page at `i32` position or selected page on `None` given
pub fn page_navigation_reload(&self, page_position: Option<i32>) { pub fn page_reload(&self, page_position: Option<i32>) {
if let Some(page) = self.widget.page(page_position) { if let Some(page) = self.widget.page(page_position) {
if let Some(id) = page.keyword() { if let Some(id) = page.keyword() {
if let Some(item) = self.index.borrow().get(&id) { if let Some(item) = self.index.borrow().get(&id) {
item.page_navigation_reload(); item.page_reload();
} }
} }
} }

View File

@ -69,20 +69,20 @@ impl Item {
} }
// Actions // Actions
pub fn page_navigation_home(&self) { pub fn page_home(&self) {
self.page.navigation_home() self.page.home()
} }
pub fn page_navigation_history_back(&self) { pub fn page_history_back(&self) {
self.page.navigation_history_back() self.page.history_back()
} }
pub fn page_navigation_history_forward(&self) { pub fn page_history_forward(&self) {
self.page.navigation_history_forward() self.page.history_forward()
} }
pub fn page_navigation_reload(&self) { pub fn page_reload(&self) {
self.page.navigation_reload() self.page.reload()
} }
pub fn page_navigation_request_grab_focus(&self) { pub fn page_navigation_request_grab_focus(&self) {

View File

@ -124,18 +124,15 @@ impl Page {
} }
// Actions // 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() { if let Some(url) = self.navigation.home_url() {
// Update with history record // Update with history record
self.action_page_open.activate(Some(&url.to_variant())); 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) { if let Some(request) = self.navigation.history_back(true) {
// Update // Update
self.navigation.set_request_text(&request); 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) { if let Some(request) = self.navigation.history_forward(true) {
// Update // Update
self.navigation.set_request_text(&request); self.navigation.set_request_text(&request);
@ -155,8 +152,7 @@ impl Page {
} }
} }
// @TODO rename to `load` pub fn reload(&self) {
pub fn navigation_reload(&self) {
/// Global limit to prevent infinitive redirects (ALL protocols) /// Global limit to prevent infinitive redirects (ALL protocols)
/// * every protocol implementation has own value checker, according to specification /// * every protocol implementation has own value checker, according to specification
const DEFAULT_MAX_REDIRECT_COUNT: i8 = 10; const DEFAULT_MAX_REDIRECT_COUNT: i8 = 10;
@ -359,12 +355,18 @@ impl Page {
Ok(()) Ok(())
} }
pub fn navigation_request_grab_focus(&self) {
self.navigation.request_grab_focus();
}
// Setters // Setters
pub fn set_navigation_request_text(&self, value: &str) { pub fn set_navigation_request_text(&self, value: &str) {
self.navigation.set_request_text(value); self.navigation.set_request_text(value);
} }
// Getters // Getters
pub fn progress_fraction(&self) -> Option<f64> { pub fn progress_fraction(&self) -> Option<f64> {
// Interpret status to progress fraction // Interpret status to progress fraction
match self.meta.status() { match self.meta.status() {