]> git.proxmox.com Git - pve-installer.git/commitdiff
fix #4643: show a confirmation dialog when clicking abort
authorMaximiliano Sandoval <m.sandoval@proxmox.com>
Wed, 21 Jun 2023 08:55:05 +0000 (10:55 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Wed, 21 Jun 2023 10:29:02 +0000 (12:29 +0200)
Note that unlike the rest of the file, we connect to the response signal
instead of using Gtk3::Dialog->run, the reason is that run blocks the
main loop used by GTK and this undesirable to the point where
Gtk3::Dialog->run was removed for GTK 4.

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
proxinstall

index 8c49cd6f55916b557ac76643490c775c0eefdce9..3d2039f9f7ca9cb6a06c07581e7ae6b78d55427e 100755 (executable)
@@ -180,7 +180,19 @@ sub create_main_window {
     my $abort = Gtk3::Button->new('_Abort');
     $abort->set_can_focus(0);
     $cmdbox->pack_start($abort, 0, 0, 10);
-    $abort->signal_connect(clicked => sub { app_quit(-1); });
+    $abort->signal_connect(clicked => sub {
+       my $msg = 'Abort Installation';
+       my $secondary_text = 'Are you sure you want to abort the installation?';
+       my $dialog = Gtk3::MessageDialog->new($window, 'modal', 'question', 'yes-no', $msg);
+       $dialog->format_secondary_text($secondary_text);
+       $dialog->signal_connect(response => sub {
+           my ($dialog, $response) = @_;
+
+           $dialog->close();
+           app_quit(-1) if $response eq 'yes';
+       });
+       $dialog->present();
+    });
 
     my $vbox2 = Gtk3::Box->new('vertical', 0);
     $hbox->add($vbox2);