add request text argument for new tab action

This commit is contained in:
yggverse 2024-09-27 16:04:27 +03:00
parent 404da1fa74
commit 5ce6090d7a
6 changed files with 18 additions and 10 deletions

View file

@ -32,10 +32,10 @@ pub struct Page {
impl Page {
// Construct
pub fn new(name: GString) -> Page {
pub fn new(name: GString, navigation_request_text: Option<GString>) -> Page {
// Init components
let content = Arc::new(Content::new());
let navigation = Arc::new(Navigation::new());
let navigation = Arc::new(Navigation::new(navigation_request_text));
// Init widget
let widget = Box::builder()

View file

@ -24,12 +24,12 @@ pub struct Navigation {
}
impl Navigation {
pub fn new() -> Self {
pub fn new(request_text: Option<GString>) -> Self {
// Init components
let base = Base::new();
let history = History::new();
let reload = Reload::new();
let request = Request::new();
let request = Request::new(request_text);
let bookmark = Bookmark::new();
// Init widget

View file

@ -10,13 +10,17 @@ pub struct Request {
impl Request {
// Construct
pub fn new() -> Self {
pub fn new(text: Option<GString>) -> Self {
// GTK
let widget = Entry::builder()
.placeholder_text("URL or search term...")
.hexpand(true)
.progress_fraction(0.0)
.progress_pulse_step(0.1)
.text(match text {
Some(text) => text,
None => GString::new(),
})
.build();
// Connect events