From 7104f670206cca4298c80a0db8fe11c950053e20 Mon Sep 17 00:00:00 2001 From: Antoine Ginies Date: Fri, 2 Sep 2005 15:07:41 +0000 Subject: add an entry only if a profile is selected --- drakpxelinux.pl | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) (limited to 'drakpxelinux.pl') diff --git a/drakpxelinux.pl b/drakpxelinux.pl index 9ea92f8..99a1837 100644 --- a/drakpxelinux.pl +++ b/drakpxelinux.pl @@ -1054,7 +1054,7 @@ sub refresh_menu { } $menu_combo->signal_connect(changed => sub { $pxelinux_conf->{default} = $menu_combo->get_active_text; - write_conf($pxelinux_conf, $treeview); + $pxelinux_conf and write_conf($pxelinux_conf, $treeview); }); } @@ -1065,7 +1065,7 @@ sub add_profile() { $w->{ok_clicked} = sub { my $profile = $entry->get_text; network::pxe::profile_exists($profiles_conf, $profile) and err_dialog(N("Add profile"), N("The %s profile already exists!", $profile)), return; - network::pxe::add_empty_profile($profiles_conf, $profile); # + network::pxe::add_empty_profile($profiles_conf, $profile); refresh_profiles(); Gtk2->main_quit; }; @@ -1077,6 +1077,17 @@ sub add_profile() { $w->main; } +sub set_global_pxe_settings { + my ($profiles_conf, $profile) = @_; + put_in_hash($pxelinux_conf, { + 'prompt' => 1, + 'default' => '', + 'display' => 'messages', + 'timeout' => '50', + 'f1' => 'help-$profile.txt', + }); +} + sub write_profile_conf { my ($mac, $profile, $profile2, $name); output($conf_mac_profiles_name, "# auto generated by drakpxelinux\n"); @@ -1154,7 +1165,8 @@ my $menu = $factory->get_widget('
'); my $okcancel = create_okcancel({ cancel_clicked => sub { ugtk2->exit }, ok_clicked => sub { - write_conf(get_pxelinux_conf_from_profile(), $treeview); + my $pxe_conf = get_pxelinux_conf_from_profile(); + $pxe_conf and write_conf($pxe_conf, $treeview); write_profile_conf(); ugtk2->exit }, }, @@ -1200,17 +1212,17 @@ gtkpack($w->{window}, gtknew('VBox', spacing => 0, children => [ ), 0, gtknew('HButtonBox', layout => 'start', children => [ 0, gtksignal_connect(set_help_tip(Gtk2::Button->new(N("Add a PXE entry")), 'addpxe'), clicked => sub { - my $pxelinux_conf = get_pxelinux_conf_from_profile(); - eval { wizard_add_entry($model, $treeview, $pxelinux_conf); - write_conf($pxelinux_conf, $treeview); - }; - my $err = $@; - $::WizardWindow->destroy if defined $::WizardWindow; - undef $::WizardWindow; - if ($err && $err !~ /wizcancel/) { - err_dialog(N("Error"), N("The PXE entry wizard has unexpectedly failed:") . "\n\n" . $err); - } - }), + my $pxelinux_conf = get_pxelinux_conf_from_profile(); + $pxelinux_conf and eval { wizard_add_entry($model, $treeview, $pxelinux_conf); + write_conf($pxelinux_conf, $treeview); + }; + my $err = $@; + $::WizardWindow->destroy if defined $::WizardWindow; + undef $::WizardWindow; + if ($err && $err !~ /wizcancel/) { + err_dialog(N("Error"), N("The PXE entry wizard has unexpectedly failed:") . "\n\n" . $err); + } + }), 0, gtksignal_connect(set_help_tip(Gtk2::Button->new(N("Remove PXE entry")), 'removepxe'), clicked => sub { my $pxelinux_conf = get_pxelinux_conf_from_profile(); remove_item($model, $treeview, $pxelinux_conf); @@ -1224,7 +1236,6 @@ gtkpack($w->{window}, gtknew('VBox', spacing => 0, children => [ 0, gtksignal_connect(Gtk2::Button->new(N("Clone PXE entry")), clicked => sub { my $pxelinux_conf = get_pxelinux_conf_from_profile(); clone_box_item($model, $treeview, $pxelinux_conf); - }), ]), ]), -- cgit v1.2.1