mirror of
https://github.com/YGGverse/Yoda.git
synced 2025-03-13 06:01:21 +00:00
use actionable object
This commit is contained in:
parent
01307f4925
commit
c466982fbc
@ -39,8 +39,12 @@ impl Navigation {
|
||||
// Init components
|
||||
let base = Base::new();
|
||||
let history = History::new();
|
||||
let reload = Reload::new(action_tab_page_reload);
|
||||
let request = Request::new(request_text, action_update);
|
||||
let reload = Reload::new(action_tab_page_reload.clone());
|
||||
let request = Request::new(
|
||||
request_text,
|
||||
action_update.clone(),
|
||||
action_tab_page_reload.clone(),
|
||||
);
|
||||
let bookmark = Bookmark::new();
|
||||
|
||||
// Init widget
|
||||
|
@ -1,7 +1,7 @@
|
||||
use gtk::{
|
||||
gio::SimpleAction,
|
||||
glib::{GString, Uri, UriFlags},
|
||||
prelude::{ActionExt, EditableExt, EntryExt, WidgetExt},
|
||||
prelude::{ActionExt, EditableExt, EntryExt},
|
||||
Entry,
|
||||
};
|
||||
|
||||
@ -13,7 +13,11 @@ pub struct Request {
|
||||
|
||||
impl Request {
|
||||
// Construct
|
||||
pub fn new(text: Option<GString>, action_update: Arc<SimpleAction>) -> Self {
|
||||
pub fn new(
|
||||
text: Option<GString>,
|
||||
action_update: Arc<SimpleAction>,
|
||||
tab_page_reload: Arc<SimpleAction>,
|
||||
) -> Self {
|
||||
// GTK
|
||||
let widget = Entry::builder()
|
||||
.placeholder_text("URL or search term...")
|
||||
@ -31,10 +35,8 @@ impl Request {
|
||||
action_update.activate(None);
|
||||
});
|
||||
|
||||
widget.connect_activate(|entry| {
|
||||
entry
|
||||
.activate_action("win.tab_page_reload", None) // @TODO
|
||||
.expect("Action `win.tab_page_reload` not found")
|
||||
widget.connect_activate(move |_| {
|
||||
tab_page_reload.activate(None);
|
||||
});
|
||||
|
||||
// Result
|
||||
|
Loading…
x
Reference in New Issue
Block a user