pve-installer/Proxmox/UI/Gtk3.pm
Thomas Lamprecht bc05a8fc6b add basic UI plugin infrastructure
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2023-06-19 21:49:00 +02:00

40 lines
808 B
Perl

package Proxmox::UI::Gtk3;
use strict;
use warnings;
use Gtk3;
use base qw(Proxmox::UI::Base);
sub message {
my ($self, $msg) = @_;
my $window = $self->{state}->{window};
my $dialog = Gtk3::MessageDialog->new($window, 'modal', 'info', 'ok', $msg);
$dialog->run();
$dialog->destroy();
}
sub error {
my ($self, $msg) = @_;
my $window = $self->{state}->{window};
my $dialog = Gtk3::MessageDialog->new($window, 'modal', 'error', 'ok', $msg);
$dialog->run();
$dialog->destroy();
}
sub prompt {
my ($self, $query) = @_;
my $window = $self->{state}->{window};
my $dialog = Gtk3::MessageDialog->new($window, 'modal', 'question', 'ok-cancel', $query);
my $response = $dialog->run();
$dialog->destroy();
return ($response // '') eq 'ok';
}
1;