Browse Source

show uri base as title by default

master
yggverse 2 months ago
parent
commit
10374b1b08
  1. 12
      src/browser/main/tab/page/mod.rs

12
src/browser/main/tab/page/mod.rs

@ -18,7 +18,7 @@ use gtk::{ @@ -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 { @@ -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…
Cancel
Save