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({
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({

View File

@ -83,21 +83,21 @@ impl Window {
self.tab.append(page_position);
}
pub fn tab_page_navigation_home(&self, page_position: Option<i32>) {
self.tab.page_navigation_home(page_position);
pub fn tab_page_home(&self, page_position: Option<i32>) {
self.tab.page_home(page_position);
}
pub fn tab_page_navigation_history_back(&self, page_position: Option<i32>) {
self.tab.page_navigation_history_back(page_position);
pub fn tab_page_history_back(&self, page_position: Option<i32>) {
self.tab.page_history_back(page_position);
}
pub fn tab_page_navigation_history_forward(&self, page_position: Option<i32>) {
self.tab.page_navigation_history_forward(page_position);
pub fn tab_page_history_forward(&self, page_position: Option<i32>) {
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<i32>) {
self.tab.page_navigation_reload(position);
pub fn tab_page_reload(&self, position: Option<i32>) {
self.tab.page_reload(position);
}
/// 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(value) = variant.get::<String>() {
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<i32>) {
pub fn page_home(&self, page_position: Option<i32>) {
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<i32>) {
pub fn page_history_back(&self, page_position: Option<i32>) {
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<i32>) {
pub fn page_history_forward(&self, page_position: Option<i32>) {
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<i32>) {
pub fn page_reload(&self, page_position: Option<i32>) {
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();
}
}
}

View File

@ -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) {

View File

@ -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<f64> {
// Interpret status to progress fraction
match self.meta.status() {