mirror of
https://github.com/YGGverse/Yoda.git
synced 2026-04-01 17:15:28 +00:00
remove extra Rc wrap
This commit is contained in:
parent
584d85d434
commit
929dcc917a
1 changed files with 11 additions and 15 deletions
|
|
@ -17,17 +17,16 @@ impl Header {
|
||||||
AlertDialog, ResponseAppearance,
|
AlertDialog, ResponseAppearance,
|
||||||
};
|
};
|
||||||
use form::Form;
|
use form::Form;
|
||||||
use std::rc::Rc;
|
|
||||||
|
|
||||||
// Response variants
|
// Response variants
|
||||||
const RESPONSE_APPLY: (&str, &str) = ("apply", "Apply");
|
const RESPONSE_APPLY: (&str, &str) = ("apply", "Apply");
|
||||||
const RESPONSE_CANCEL: (&str, &str) = ("cancel", "Cancel");
|
const RESPONSE_CANCEL: (&str, &str) = ("cancel", "Cancel");
|
||||||
|
|
||||||
// Init form components
|
// Init form components
|
||||||
let form = Rc::new(Form::build(
|
let form = Form::build(
|
||||||
&self.mime.unwrap_or_default(),
|
&self.mime.unwrap_or_default(),
|
||||||
&self.token.unwrap_or_default(),
|
&self.token.unwrap_or_default(),
|
||||||
));
|
);
|
||||||
|
|
||||||
// Init main widget
|
// Init main widget
|
||||||
let alert_dialog = AlertDialog::builder()
|
let alert_dialog = AlertDialog::builder()
|
||||||
|
|
@ -47,18 +46,15 @@ impl Header {
|
||||||
|
|
||||||
// Init events
|
// Init events
|
||||||
|
|
||||||
alert_dialog.connect_response(None, {
|
alert_dialog.connect_response(None, move |this, response| {
|
||||||
let form = form.clone();
|
this.set_response_enabled(response, false); // prevent double-click
|
||||||
move |this, response| {
|
if response == RESPONSE_APPLY.0 {
|
||||||
this.set_response_enabled(response, false); // prevent double-click
|
callback(Self {
|
||||||
if response == RESPONSE_APPLY.0 {
|
mime: form.mime(),
|
||||||
callback(Self {
|
token: form.token(),
|
||||||
mime: form.mime(),
|
})
|
||||||
token: form.token(),
|
} else {
|
||||||
})
|
// @TODO restore
|
||||||
} else {
|
|
||||||
// @TODO restore
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue