mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-02 01:25:27 +00:00
use tuple for actions
This commit is contained in:
parent
b70a5a7867
commit
61010e0a42
6 changed files with 24 additions and 39 deletions
|
|
@ -18,13 +18,9 @@ pub struct Request {
|
|||
|
||||
impl Request {
|
||||
// Construct
|
||||
pub fn new(
|
||||
// Actions
|
||||
browser_action: Rc<BrowserAction>,
|
||||
tab_action: Rc<TabAction>,
|
||||
) -> Self {
|
||||
pub fn new(action: (Rc<BrowserAction>, Rc<TabAction>)) -> Self {
|
||||
Self {
|
||||
widget: Rc::new(Widget::new(browser_action, tab_action)),
|
||||
widget: Rc::new(Widget::new(action)),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ pub struct Widget {
|
|||
|
||||
impl Widget {
|
||||
// Construct
|
||||
pub fn new(browser_action: Rc<BrowserAction>, tab_action: Rc<TabAction>) -> Self {
|
||||
pub fn new(action: (Rc<BrowserAction>, Rc<TabAction>)) -> Self {
|
||||
// Init animated progress bar state
|
||||
let progress = Rc::new(Progress {
|
||||
fraction: RefCell::new(0.0),
|
||||
|
|
@ -42,11 +42,11 @@ impl Widget {
|
|||
|
||||
// Connect events
|
||||
gobject.connect_changed(move |_| {
|
||||
browser_action.update().activate(None);
|
||||
action.0.update().activate(None);
|
||||
});
|
||||
|
||||
gobject.connect_activate(move |this| {
|
||||
tab_action.load().activate(Some(&this.text()), true);
|
||||
action.1.load().activate(Some(&this.text()), true);
|
||||
});
|
||||
|
||||
gobject.connect_state_flags_changed({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue