diff --git a/scripts/start.pl b/scripts/start.pl index 166abbf..04d1217 100644 --- a/scripts/start.pl +++ b/scripts/start.pl @@ -97,13 +97,20 @@ sub activate_open { my $saves = shift; my $extra = shift; my $save_as = shift; + my $cancellable = Glib::IO::Cancellable->new; + $cancellable->signal_connect(cancelled => sub { + say 'cancelled'; + }); my $dialog = Gtk4::FileDialog->new; my $curdir = Glib::IO::File::new_for_path('.'); $dialog->set_initial_folder($curdir); $dialog->open( - $win, undef, + $win, $cancellable, sub { my ( $self, $res ) = @_; + if ($res->had_error) { + return; + } my $file = $dialog->open_finish($res); return if !defined $file; $file = path( $file->get_path ); @@ -123,6 +130,9 @@ sub activate_save { $win, undef, sub { my ( $self, $res ) = @_; + if ($res->had_error) { + return; + } my $file = $dialog->open_finish($res); return if !defined $file; $file = path( $file->get_path );