From 9c46bcf3d81dd0a8fc5bcc9e8bef6eea6d384060 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Tue, 13 Jan 2004 17:45:11 +0000 Subject: sanitize buttons through reusing create_okcancel() --- perl-install/standalone/drakconnect | 47 +++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 23 deletions(-) (limited to 'perl-install/standalone/drakconnect') diff --git a/perl-install/standalone/drakconnect b/perl-install/standalone/drakconnect index 69e5a0237..45b08ba47 100755 --- a/perl-install/standalone/drakconnect +++ b/perl-install/standalone/drakconnect @@ -203,17 +203,7 @@ sub manage { my $notebook = Gtk2::Notebook->new; $notebook->set_property('show-tabs', 0); $notebook->set_property('show-border', 0); - my $apply_button; - $apply_button = gtksignal_connect(Gtk2::Button->new(N("Apply")), - clicked => sub { save($netc, $netcnx, $intf, $gui, $apply_button) }); - - each_index { - my $interface = $_; - $gui->{$interface}{index} = $::i; - build_notebook($window, $netc, $intf->{$interface}, $gui->{$interface}, $interface, $apply_button); - $notebook->append_page(gtkpack(Gtk2::VBox->new(0,0), $gui->{$interface}{notebook})); - } (sort keys %$intf); $window->{rwindow}->add(gtkpack_(Gtk2::VBox->new, 0, $interface_menu = gtksignal_connect(Gtk2::OptionMenu->new, @@ -223,20 +213,31 @@ sub manage { }, ), 1, $notebook, - 0, gtkpack(Gtk2::HButtonBox->new, - gtksignal_connect(Gtk2::Button->new(N("Cancel")), clicked => sub { $window->destroy; - Gtk2->main_quit }), - gtksignal_connect(Gtk2::Button->new(N("Help")), clicked => sub {}), - $apply_button, - gtksignal_connect(Gtk2::Button->new(N("Ok")), clicked => sub { - if ($apply_button->get_property('sensitive')) { - save($netc, $netcnx, $intf, $gui, $apply_button); - $window->destroy; - Gtk2->main_quit; - } - }), + 0, create_okcancel(my $oc = + { + cancel_clicked => sub { $window->destroy; Gtk2->main_quit }, + ok_clicked => sub { + if ($apply_button->get_property('sensitive')) { + save($netc, $netcnx, $intf, $gui, $apply_button); + $window->destroy; + Gtk2->main_quit; + } + }, + }, + undef, undef, '', + [ N("Help"), sub { exec("drakhelp --id internet-connection") unless fork() } ], + [ N("Apply"), sub { save($netc, $netcnx, $intf, $gui, $apply_button) } ], + ), ), - )); + ); + $apply_button = $oc->{buttons}{N("Apply")}; + each_index { + my $interface = $_; + $gui->{$interface}{index} = $::i; + build_notebook($window, $netc, $intf->{$interface}, $gui->{$interface}, $interface, $apply_button); + $notebook->append_page(gtkpack(Gtk2::VBox->new(0,0), $gui->{$interface}{notebook})); + } (sort keys %$intf); + $interface_menu->set_popdown_strings(sort keys %$intf); $apply_button->set_sensitive(0); -- cgit v1.2.1