From cf86cc2a14cf1cb90965b90c5c7edaf06f5c2f25 Mon Sep 17 00:00:00 2001 From: yggverse Date: Wed, 16 Oct 2024 19:46:06 +0300 Subject: [PATCH] hide input on page reload --- src/app/browser/window/tab/item/page.rs | 4 ++++ src/app/browser/window/tab/item/page/input.rs | 10 +++++++++- .../browser/window/tab/item/page/input/widget.rs | 13 ++++++++++--- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/src/app/browser/window/tab/item/page.rs b/src/app/browser/window/tab/item/page.rs index 81033c67..8d3e0ff3 100644 --- a/src/app/browser/window/tab/item/page.rs +++ b/src/app/browser/window/tab/item/page.rs @@ -158,6 +158,9 @@ impl Page { } pub fn navigation_reload(&self) { + // Reset components + self.input.hide(); + // Init globals let request_text = self.navigation.request_text(); @@ -282,6 +285,7 @@ impl Page { // Make input form input.set_default(action_page_open, uri, Some(&description), Some(1024)); + input.show(); // Update meta meta.borrow_mut().status = Some(status); diff --git a/src/app/browser/window/tab/item/page/input.rs b/src/app/browser/window/tab/item/page/input.rs index 493e80a4..1edfb6e4 100644 --- a/src/app/browser/window/tab/item/page/input.rs +++ b/src/app/browser/window/tab/item/page/input.rs @@ -23,6 +23,14 @@ impl Input { } // Actions + pub fn show(&self) { + self.widget.show() + } + + pub fn hide(&self) { + self.widget.hide() + } + pub fn set_default( &self, action_page_open: Arc, @@ -30,7 +38,7 @@ impl Input { title: Option<&str>, size_limit: Option, ) { - self.widget.update(Some( + self.widget.set_child(Some( &Default::new_arc(action_page_open, base, title, size_limit).gobject(), )); } diff --git a/src/app/browser/window/tab/item/page/input/widget.rs b/src/app/browser/window/tab/item/page/input/widget.rs index 9b297c4b..709bb936 100644 --- a/src/app/browser/window/tab/item/page/input/widget.rs +++ b/src/app/browser/window/tab/item/page/input/widget.rs @@ -19,12 +19,19 @@ impl Widget { } // Actions - pub fn update(&self, child: Option<&Box>) { + pub fn show(&self) { + self.gobject.set_visible(true) + } + + pub fn hide(&self) { + self.gobject.set_visible(false) + } + + pub fn set_child(&self, child: Option<&Box>) { if child.is_some() { self.gobject.set_child(child); - self.gobject.set_visible(true); } else { - self.gobject.set_visible(false) + self.hide() } }