From 4ce778e10f53e6355e688b30773c93ff3d01419a Mon Sep 17 00:00:00 2001 From: Sergiotarxz Date: Sun, 3 Mar 2024 12:21:10 +0100 Subject: [PATCH] Removing bug close on file dialog close. --- scripts/start.pl | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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 );