connect search widget

This commit is contained in:
yggverse 2024-12-16 12:57:46 +02:00
parent 441bbc504f
commit 93602322a4
2 changed files with 8 additions and 5 deletions

View File

@ -9,7 +9,7 @@ use source::Source;
use super::{TabAction, WindowAction}; use super::{TabAction, WindowAction};
use gtk::{ use gtk::{
glib::Uri, glib::Uri,
prelude::{BoxExt, ButtonExt, TextViewExt,WidgetExt}, prelude::{BoxExt, ButtonExt, TextViewExt, WidgetExt},
Box, Orientation, ScrolledWindow, Box, Orientation, ScrolledWindow,
}; };
use std::rc::Rc; use std::rc::Rc;
@ -37,18 +37,20 @@ impl Text {
// Init main widget // Init main widget
let g_box = Box::builder().orientation(Orientation::Vertical).build(); let g_box = Box::builder().orientation(Orientation::Vertical).build();
g_box.append( g_box.append(
&ScrolledWindow::builder() &ScrolledWindow::builder()
.child(&gemini.widget.clamp_scrollable) .child(&gemini.widget.clamp_scrollable)
.build(), .build(),
); );
g_box.append(&search.g_box);
// Connect events // Connect events
window_action.find.connect_activate({ window_action.find.connect_activate({
let search = search.clone(); let search = search.clone();
let text_view = gemini.reader.widget.text_view.clone();
move |_| { move |_| {
// @TODO show search.g_box.set_visible(true);
search.input.entry.grab_focus(); search.input.entry.grab_focus();
} }
}); });
@ -74,9 +76,9 @@ impl Text {
}); });
search.close.connect_clicked({ search.close.connect_clicked({
let text_view = gemini.reader.widget.text_view.clone(); let search = search.clone();
move |_| { move |_| {
// @TODO hide search.g_box.set_visible(false);
} }
}); });

View File

@ -35,6 +35,7 @@ impl Search {
let g_box = Box::builder() let g_box = Box::builder()
// .css_classes(["app-notification"]) // .css_classes(["app-notification"])
.orientation(Orientation::Horizontal) .orientation(Orientation::Horizontal)
.visible(false)
.build(); .build();
g_box.append(&input.entry); g_box.append(&input.entry);