mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-03-13 06:01:21 +00:00
add comments, rename address getter to url
This commit is contained in:
parent
68898d8da0
commit
4e7565297a
@ -114,8 +114,8 @@ impl Page {
|
||||
}
|
||||
|
||||
pub fn navigation_base(&self) {
|
||||
if let Some(address) = self.navigation.base_address() {
|
||||
self.action_page_open.activate(Some(&address.to_variant()));
|
||||
if let Some(url) = self.navigation.base_url() {
|
||||
self.action_page_open.activate(Some(&url.to_variant()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -103,8 +103,8 @@ impl Navigation {
|
||||
&self.widget
|
||||
}
|
||||
|
||||
pub fn base_address(&self) -> Option<GString> {
|
||||
self.base.address()
|
||||
pub fn base_url(&self) -> Option<GString> {
|
||||
self.base.url()
|
||||
}
|
||||
|
||||
pub fn request_text(&self) -> GString {
|
||||
|
@ -7,8 +7,11 @@ use gtk::{
|
||||
use std::{cell::RefCell, sync::Arc};
|
||||
|
||||
pub struct Base {
|
||||
// Actions
|
||||
action_tab_page_navigation_base: Arc<SimpleAction>,
|
||||
// Mutable URI cache (parsed on update)
|
||||
uri: RefCell<Option<Uri>>,
|
||||
// GTK
|
||||
widget: Button,
|
||||
}
|
||||
|
||||
@ -58,7 +61,8 @@ impl Base {
|
||||
&self.widget
|
||||
}
|
||||
|
||||
pub fn address(&self) -> Option<GString> {
|
||||
pub fn url(&self) -> Option<GString> {
|
||||
// Build URL from parsed URI cache
|
||||
if let Some(uri) = self.uri.take() {
|
||||
let scheme = uri.scheme();
|
||||
let port = uri.port();
|
||||
@ -67,7 +71,7 @@ impl Base {
|
||||
return Some(gformat!("{scheme}://{host}:{port}/"));
|
||||
} else {
|
||||
return Some(gformat!("{scheme}://{host}/"));
|
||||
}
|
||||
} // @TODO auth params
|
||||
}
|
||||
}
|
||||
None
|
||||
|
Loading…
x
Reference in New Issue
Block a user