summaryrefslogtreecommitdiffstats
path: root/drakpxelinux.pl
diff options
context:
space:
mode:
authorAntoine Ginies <aginies@mandriva.com>2004-08-11 05:56:03 +0000
committerAntoine Ginies <aginies@mandriva.com>2004-08-11 05:56:03 +0000
commit17293369935d0a75db30a08eae057225960df7d5 (patch)
tree3cabd65c7bf2b0c0e19456220f2278268ecba733 /drakpxelinux.pl
parent79b564b464045e6a900ddd3e27874c92fbdca0f3 (diff)
downloaddrakpxelinux-17293369935d0a75db30a08eae057225960df7d5.tar
drakpxelinux-17293369935d0a75db30a08eae057225960df7d5.tar.gz
drakpxelinux-17293369935d0a75db30a08eae057225960df7d5.tar.bz2
drakpxelinux-17293369935d0a75db30a08eae057225960df7d5.tar.xz
drakpxelinux-17293369935d0a75db30a08eae057225960df7d5.zip
add a file dialog box for directory
Diffstat (limited to 'drakpxelinux.pl')
-rw-r--r--drakpxelinux.pl66
1 files changed, 37 insertions, 29 deletions
diff --git a/drakpxelinux.pl b/drakpxelinux.pl
index abcf3d7..d1895fa 100644
--- a/drakpxelinux.pl
+++ b/drakpxelinux.pl
@@ -234,6 +234,7 @@ PROMPT 10
DEFAULT $default
DISPLAY messages
TIMEOUT 50
+F1 help.txt
label local
LOCALBOOT 0
@@ -454,21 +455,33 @@ sub edit_box_item {
$info->set_text($listpxe[$i]{info});
set_help_tip($info, 'info');
+ # create file dialog widget, with file or directory selection
+ my $fdwidget = sub {
+ my ($data, $test) = @_;
+ my $fd = new Gtk2::FileSelection(N("Selection"));
+ $fd->set_modal(TRUE);
+ $fd->signal_connect("destroy", sub { $fd->hide });
+ $fd->ok_button->signal_connect(clicked => sub {
+ my $file = $fd->get_filename;
+ if ($test eq "dir") {
+ -d $file or err_dialog(N("Error !"), "Should be a directory.") and return;
+ } else {
+ -f $file or err_dialog(N("Error !"), "Should be a file") and return;
+ $file = "images/" . basename($file);
+ }
+ $data->set_text($file);
+ $fd->hide;
+ }, $fd);
+ $fd->cancel_button->signal_connect(clicked => sub { $fd->hide });
+ return $fd;
+ };
+
+
my $kernel = Gtk2::Entry->new;
$kernel->set_text($listpxe[$i]{kernel});
set_help_tip($kernel, 'kernel');
- # file selection for kernel
- my $file_dialogk = new Gtk2::FileSelection(N("File Selection"));
- $file_dialogk->set_modal(TRUE);
- $file_dialogk->signal_connect("destroy", sub { $file_dialogk->hide });
- $file_dialogk->ok_button->signal_connect(clicked => sub {
- my $file = $file_dialogk->get_filename;
- -f $file or err_dialog(N("Error !"), "Should be a file") and return;
- $file = "images/" . basename($file);
- $kernel->set_text($file);
- $file_dialogk->hide;
- }, $file_dialogk);
- $file_dialogk->cancel_button->signal_connect(clicked => sub { $file_dialogk->hide });
+
+ my $file_dialogk = $fdwidget->($kernel, "");
# button kernel
my $buttonkernel = Gtk2::Button->new(N("Select kernel"));
$buttonkernel->signal_connect(clicked => sub { $file_dialogk->show });
@@ -476,18 +489,8 @@ sub edit_box_item {
my $initrd = Gtk2::Entry->new;
$initrd->set_text($listpxe[$i]{initrd});
set_help_tip($initrd, 'initrd');
- # file selection for initrd
- my $file_dialog = new Gtk2::FileSelection(N("File Selection"));
- $file_dialog->set_modal(TRUE);
- $file_dialog->signal_connect("destroy", sub { $file_dialog->hide });
- $file_dialog->ok_button->signal_connect(clicked => sub {
- my $filei = $file_dialog->get_filename;
- -f $filei or err_dialog(N("Error !"), "Should be a file") and return;
- $filei = "images/" . basename($filei);
- $initrd->set_text($filei);
- $file_dialog->hide;
- }, $file_dialog);
- $file_dialog->cancel_button->signal_connect(clicked => sub { $file_dialog->hide });
+
+ my $file_dialog = $fdwidget->($initrd, "");
my $buttoninitrd = Gtk2::Button->new("Select initrd");
$buttoninitrd->signal_connect(clicked => sub { $file_dialog->show });
@@ -515,6 +518,11 @@ sub edit_box_item {
$directory->set_text($listpxe[$i]{directory});
set_help_tip($directory, 'directory');
+ my $file_dialogd = $fdwidget->($directory, "dir");
+ my $buttondir = Gtk2::Button->new("Select directory");
+ $buttondir->signal_connect(clicked => sub { $file_dialogd->show });
+
+
my $ramdisk = new Gtk2::OptionMenu();
$ramdisk->set_popdown_strings(@list_ram);
$ramdisk->entry->set_text($listpxe[$i]{ramdisk});
@@ -553,7 +561,7 @@ sub edit_box_item {
),
0, gtkadd(Gtk2::Frame->new(N("Boot image")),
gtkpack_(gtkset_border_width(Gtk2::VBox->new, 3),
- 0, Gtk2::Label->new("Path are relative to $X86"),
+ 0, Gtk2::Label->new("Path are relative to $X86, file out of this directory\ncould not be downloaded via tftp, because tftp server is chrooted"),
0, $label_and_widgets->(N("Kernel"), $kernel, $buttonkernel),
0, $label_and_widgets->(N("Initrd"), $initrd, $buttoninitrd),
),
@@ -564,7 +572,7 @@ sub edit_box_item {
0, $label_and_widgets->(N("Interface"), $interface, ""),
0, $label_and_widgets->(N("Network"), $network, ""),
0, $label_and_widgets->(N("Server"), $server, ""),
- 0, $label_and_widgets->(N("Directory"), $directory, ""),
+ 0, $label_and_widgets->(N("Directory"), $directory, $buttondir),
),
),
0, gtkadd(Gtk2::Frame->new(N("Display")),
@@ -968,9 +976,9 @@ my $labelscombo = Gtk2::OptionMenu->new;
my $defaultlabel = get_default_pxe;
$labelscombo->entry->set_text($defaultlabel);
$labelscombo->entry->signal_connect("changed", sub { my $new_default = $labelscombo->entry->get_text;
- set_new_default($new_default);
- }
- );
+ set_new_default($new_default);
+ }
+ );
my @o = list_label_pxe;
$labelscombo->set_popdown_strings("", sort(@o));