mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 17:45:28 +00:00
enable legacy widgets update feature
This commit is contained in:
parent
913030a955
commit
5383a5a638
1 changed files with 19 additions and 11 deletions
|
|
@ -8,7 +8,7 @@ mod widget;
|
||||||
|
|
||||||
use super::{BrowserAction, ItemAction, Profile, WindowAction};
|
use super::{BrowserAction, ItemAction, Profile, WindowAction};
|
||||||
use bookmark::Bookmark;
|
use bookmark::Bookmark;
|
||||||
use gtk::{Box, Button};
|
use gtk::{prelude::WidgetExt, Box, Button};
|
||||||
use history::History;
|
use history::History;
|
||||||
use home::Home;
|
use home::Home;
|
||||||
use reload::Reload;
|
use reload::Reload;
|
||||||
|
|
@ -19,6 +19,9 @@ use widget::Widget;
|
||||||
|
|
||||||
pub struct Navigation {
|
pub struct Navigation {
|
||||||
pub profile: Rc<Profile>,
|
pub profile: Rc<Profile>,
|
||||||
|
pub home: Button,
|
||||||
|
pub reload: Button,
|
||||||
|
pub bookmark: Button,
|
||||||
pub request: Rc<Request>,
|
pub request: Rc<Request>,
|
||||||
pub widget: Rc<Widget>,
|
pub widget: Rc<Widget>,
|
||||||
}
|
}
|
||||||
|
|
@ -35,21 +38,28 @@ impl Navigation {
|
||||||
) -> Self {
|
) -> Self {
|
||||||
// init children components
|
// init children components
|
||||||
|
|
||||||
|
let home = Button::home(window_action);
|
||||||
|
let history = Box::history(back_action_name, forward_action_name);
|
||||||
|
let reload = Button::reload(window_action);
|
||||||
let request = Rc::new(Request::build((browser_action, item_action)));
|
let request = Rc::new(Request::build((browser_action, item_action)));
|
||||||
|
let bookmark = Button::bookmark(window_action);
|
||||||
|
|
||||||
// init main widget
|
// init main widget
|
||||||
let widget = Rc::new(Widget::build(
|
let widget = Rc::new(Widget::build(
|
||||||
&Button::home(window_action),
|
&home,
|
||||||
&Box::history(back_action_name, forward_action_name),
|
&history,
|
||||||
&Button::reload(window_action),
|
&reload,
|
||||||
&request.widget.entry, // @TODO
|
&request.widget.entry, // @TODO
|
||||||
&Button::bookmark(window_action),
|
&bookmark,
|
||||||
));
|
));
|
||||||
|
|
||||||
// done
|
// done
|
||||||
Self {
|
Self {
|
||||||
profile: profile.clone(),
|
profile: profile.clone(),
|
||||||
|
home,
|
||||||
request,
|
request,
|
||||||
|
reload,
|
||||||
|
bookmark,
|
||||||
widget,
|
widget,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -57,26 +67,24 @@ impl Navigation {
|
||||||
// Actions
|
// Actions
|
||||||
|
|
||||||
pub fn update(&self) {
|
pub fn update(&self) {
|
||||||
/* @TODO
|
|
||||||
// init shared request value
|
// init shared request value
|
||||||
let request = self.request.strip_prefix();
|
let request = self.request.strip_prefix();
|
||||||
|
|
||||||
// update children components
|
// update children components
|
||||||
self.bookmark
|
self.bookmark
|
||||||
.update(self.profile.bookmark.get(&request).is_ok());
|
.set_sensitive(self.profile.bookmark.get(&request).is_ok());
|
||||||
self.history.update();
|
self.reload.set_sensitive(!request.is_empty());
|
||||||
self.reload.update(!request.is_empty());
|
|
||||||
self.request.update(
|
self.request.update(
|
||||||
self.profile
|
self.profile
|
||||||
.identity
|
.identity
|
||||||
.get(&self.request.strip_prefix())
|
.get(&self.request.strip_prefix())
|
||||||
.is_some(),
|
.is_some(),
|
||||||
);
|
);
|
||||||
self.home.update(
|
self.home.set_sensitive(
|
||||||
self.request
|
self.request
|
||||||
.home()
|
.home()
|
||||||
.is_some_and(|home| home.to_string() != request),
|
.is_some_and(|home| home.to_string() != request),
|
||||||
);*/
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn clean(
|
pub fn clean(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue