use shared cancellable

This commit is contained in:
yggverse 2024-12-10 19:24:13 +02:00
parent 2e8ee31cb0
commit 5c8aba30c5

View File

@ -88,11 +88,12 @@ pub fn new(
.build(); .build();
open.connect_clicked({ open.connect_clicked({
let cancellable = cancellable.clone();
let file_launcher = file_launcher.clone(); let file_launcher = file_launcher.clone();
let status = status.clone(); let status = status.clone();
move |this| { move |this| {
this.set_sensitive(false); // lock this.set_sensitive(false); // lock
file_launcher.launch(Window::NONE, Cancellable::NONE, { file_launcher.launch(Window::NONE, Some(&cancellable), {
let status = status.clone(); let status = status.clone();
let this = this.clone(); let this = this.clone();
move |result| { move |result| {
@ -117,6 +118,7 @@ pub fn new(
choose.connect_clicked({ choose.connect_clicked({
// init shared references // init shared references
let cancellable = cancellable.clone();
let cancel = cancel.clone(); let cancel = cancel.clone();
let dialog = dialog.clone(); let dialog = dialog.clone();
let file_launcher = file_launcher.clone(); let file_launcher = file_launcher.clone();
@ -126,7 +128,7 @@ pub fn new(
move |this| { move |this| {
// lock choose button to prevent double click // lock choose button to prevent double click
this.set_sensitive(false); this.set_sensitive(false);
dialog.save(Window::NONE, Cancellable::NONE, { dialog.save(Window::NONE, Some(&cancellable), {
// delegate shared references // delegate shared references
let cancel = cancel.clone(); let cancel = cancel.clone();
let file_launcher = file_launcher.clone(); let file_launcher = file_launcher.clone();