mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
update home button status detection
This commit is contained in:
parent
c5fad47a20
commit
5943ea622a
3 changed files with 27 additions and 23 deletions
|
|
@ -119,20 +119,19 @@ impl Request {
|
|||
strip_prefix(self.widget.entry.text())
|
||||
}
|
||||
|
||||
/// Parse home [Uri](https://docs.gtk.org/glib/struct.Uri.html) for self
|
||||
pub fn home(&self) -> Option<GString> {
|
||||
/// Parse home [Uri](https://docs.gtk.org/glib/struct.Uri.html) of `Self`
|
||||
pub fn home(&self) -> Option<Uri> {
|
||||
match self.uri() {
|
||||
Some(uri) => {
|
||||
let scheme = uri.scheme().replace("titan", "gemini");
|
||||
let port = uri.port();
|
||||
uri.host().map(|host| {
|
||||
if port.is_positive() {
|
||||
gformat!("{scheme}://{host}:{port}/")
|
||||
} else {
|
||||
gformat!("{scheme}://{host}/")
|
||||
}
|
||||
})
|
||||
}
|
||||
Some(uri) => Some(Uri::build(
|
||||
UriFlags::NONE,
|
||||
&uri.scheme(),
|
||||
uri.userinfo().as_deref(),
|
||||
uri.host().as_deref(),
|
||||
uri.port(),
|
||||
"/",
|
||||
None,
|
||||
None,
|
||||
)),
|
||||
None => None,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue