mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
fix blank menu item labels
This commit is contained in:
parent
7fc25fe4f5
commit
8533e9daab
1 changed files with 2 additions and 6 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
use super::{BrowserAction, Profile, WindowAction};
|
use super::{BrowserAction, Profile, WindowAction};
|
||||||
use gtk::{
|
use gtk::{
|
||||||
gio::{self},
|
gio::{self},
|
||||||
glib::{gformat, GString, Uri},
|
glib::{GString, Uri},
|
||||||
prelude::{ActionExt, ToVariant},
|
prelude::{ActionExt, ToVariant},
|
||||||
Align, MenuButton,
|
Align, MenuButton,
|
||||||
};
|
};
|
||||||
|
|
@ -272,12 +272,8 @@ fn ellipsize(value: &str, limit: usize) -> String {
|
||||||
/// as [MenuItem](https://docs.gtk.org/gio/class.MenuItem.html) label
|
/// as [MenuItem](https://docs.gtk.org/gio/class.MenuItem.html) label
|
||||||
fn uri_to_label(uri: &Uri, is_parent: bool) -> GString {
|
fn uri_to_label(uri: &Uri, is_parent: bool) -> GString {
|
||||||
let path = uri.path();
|
let path = uri.path();
|
||||||
// Show hostname for index pages (or entire URL on possible unwrap failure)
|
if path == "/" || path.is_empty() || is_parent {
|
||||||
if path == "/" {
|
|
||||||
uri.host().unwrap_or(uri.to_str())
|
uri.host().unwrap_or(uri.to_str())
|
||||||
// Parental item names have some format exception
|
|
||||||
} else if is_parent {
|
|
||||||
gformat!("{}{}", uri.host().unwrap_or(uri.to_str()), uri.path())
|
|
||||||
} else {
|
} else {
|
||||||
path
|
path
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue