diff --git a/src/app/browser/window/tab/item/page/search.rs b/src/app/browser/window/tab/item/page/search.rs
index 8cfa8f8f..b7003b1f 100644
--- a/src/app/browser/window/tab/item/page/search.rs
+++ b/src/app/browser/window/tab/item/page/search.rs
@@ -1,3 +1,4 @@
+mod close;
mod form;
mod placeholder;
mod subject;
@@ -28,10 +29,11 @@ impl Search {
let subject = Rc::new(RefCell::new(None));
let form = Rc::new(Form::new(&subject));
let placeholder = Rc::new(Placeholder::new());
+ let close = close::new();
// Init main container
let g_box = Box::builder()
- .orientation(Orientation::Vertical)
+ .orientation(Orientation::Horizontal)
.valign(Align::Center)
.vexpand(false)
.visible(false)
@@ -39,12 +41,16 @@ impl Search {
g_box.append(&form.g_box);
g_box.append(&placeholder.label);
+ g_box.append(&close);
// Connect events
-
- form.close.connect_clicked({
+ close.connect_clicked({
+ let form = form.clone();
let g_box = g_box.clone();
- move |_| g_box.set_visible(false)
+ move |_| {
+ g_box.set_visible(false);
+ form.clean()
+ }
});
// Done
diff --git a/src/app/browser/window/tab/item/page/search/form/close.rs b/src/app/browser/window/tab/item/page/search/close.rs
similarity index 100%
rename from src/app/browser/window/tab/item/page/search/form/close.rs
rename to src/app/browser/window/tab/item/page/search/close.rs
diff --git a/src/app/browser/window/tab/item/page/search/form.rs b/src/app/browser/window/tab/item/page/search/form.rs
index 8ddabd53..7bfdce08 100644
--- a/src/app/browser/window/tab/item/page/search/form.rs
+++ b/src/app/browser/window/tab/item/page/search/form.rs
@@ -1,4 +1,3 @@
-mod close;
mod input;
mod match_case;
mod navigation;
@@ -11,12 +10,11 @@ use gtk::{
prelude::{
BoxExt, ButtonExt, CheckButtonExt, EditableExt, TextBufferExt, TextViewExt, WidgetExt,
},
- Align, Box, Button, Orientation, TextIter, TextSearchFlags,
+ Align, Box, Orientation, TextIter, TextSearchFlags,
};
use std::{cell::RefCell, rc::Rc};
pub struct Form {
- pub close: Button,
pub input: Rc,
pub g_box: Box,
}
@@ -27,7 +25,6 @@ impl Form {
/// Create new `Self`
pub fn new(subject: &Rc>>) -> Self {
// Init components
- let close = close::new();
let input = Rc::new(Input::new());
let match_case = match_case::new();
let navigation = Rc::new(Navigation::new());
@@ -43,14 +40,8 @@ impl Form {
g_box.append(&input.entry);
g_box.append(&navigation.g_box);
g_box.append(&match_case);
- g_box.append(&close);
// Connect events
- close.connect_clicked({
- let input = input.clone();
- move |_| input.clean()
- });
-
input.entry.connect_changed({
let input = input.clone();
let match_case = match_case.clone();
@@ -113,15 +104,15 @@ impl Form {
});
// Done
- Self {
- close,
- g_box,
- input,
- }
+ Self { g_box, input }
}
// Actions
+ pub fn clean(&self) {
+ self.input.clean();
+ }
+
pub fn show(&self) {
self.g_box.set_visible(true);
self.input.entry.grab_focus();