mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-03-31 16:45:27 +00:00
show uri base as title by default
This commit is contained in:
parent
f939e427b8
commit
10374b1b08
1 changed files with 11 additions and 1 deletions
|
|
@ -18,7 +18,7 @@ use gtk::{
|
|||
},
|
||||
Box, Orientation,
|
||||
};
|
||||
use std::{cell::RefCell, sync::Arc};
|
||||
use std::{cell::RefCell, path::Path, sync::Arc};
|
||||
|
||||
pub struct Page {
|
||||
// GTK
|
||||
|
|
@ -172,6 +172,16 @@ impl Page {
|
|||
// Format response
|
||||
meta.borrow_mut().progress_fraction = 1.0;
|
||||
meta.borrow_mut().description = host;
|
||||
meta.borrow_mut().title = uri.path();
|
||||
|
||||
// Try create short base for title
|
||||
let path = uri.path();
|
||||
let path = Path::new(&path);
|
||||
if let Some(base) = path.file_name() {
|
||||
if let Some(base_str) = base.to_str() {
|
||||
meta.borrow_mut().title = GString::from(base_str);
|
||||
}
|
||||
}
|
||||
|
||||
// Parse response @TODO read bytes
|
||||
let parts = Regex::split_simple(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue