summaryrefslogtreecommitdiffstats
path: root/drakpxelinux.pl
diff options
context:
space:
mode:
authorAntoine Ginies <aginies@mandriva.com>2005-08-29 17:58:07 +0000
committerAntoine Ginies <aginies@mandriva.com>2005-08-29 17:58:07 +0000
commit044eb03c76001b8897e44292b65c165b3197ba74 (patch)
tree4b50e044d08135862420168a473fb27c83e444f7 /drakpxelinux.pl
parent84e6982ee1a13c5e188a1b461368f742c62bd655 (diff)
downloaddrakpxelinux-044eb03c76001b8897e44292b65c165b3197ba74.tar
drakpxelinux-044eb03c76001b8897e44292b65c165b3197ba74.tar.gz
drakpxelinux-044eb03c76001b8897e44292b65c165b3197ba74.tar.bz2
drakpxelinux-044eb03c76001b8897e44292b65c165b3197ba74.tar.xz
drakpxelinux-044eb03c76001b8897e44292b65c165b3197ba74.zip
clic on profile load data in treeview
Diffstat (limited to 'drakpxelinux.pl')
-rw-r--r--drakpxelinux.pl56
1 files changed, 35 insertions, 21 deletions
diff --git a/drakpxelinux.pl b/drakpxelinux.pl
index e029d23..efa187a 100644
--- a/drakpxelinux.pl
+++ b/drakpxelinux.pl
@@ -43,10 +43,13 @@ use Gtk2::SimpleList;
use Gtk2::Helper;
use run_program;
use IO::Socket;
+use Data::Dumper;
use constant FALSE => 0;
use constant TRUE => 1;
+my ($treeview, $model);
+
# ie of entry menu in PXE:
#label linux
# KERNEL images/vmlinuz
@@ -206,9 +209,13 @@ sub set_pxelinux_entry_at_iter {
sub create_model() {
# my $model = Gtk2::ListStore->new(("Glib::String") x NUM_COLUMNS);
- my $model = Gtk2::ListStore->new("Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String");
- set_pxelinux_entry_at_iter($model, $model->append, $_) foreach @{$pxelinux_conf->{entries}};
- return $model;
+ my $model = Gtk2::ListStore->new("Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String", "Glib::String");
+# set_pxelinux_entry_at_iter($model, $model->append, $_) foreach @{$pxelinux_conf->{entries}};
+ return $model;
+}
+
+sub fill_model() {
+ set_pxelinux_entry_at_iter($model, $model->append, $_) foreach @{$pxelinux_conf->{entries}};
}
# wizard to add an entry in PXE menu
@@ -813,21 +820,21 @@ my $profiles_conf = network::pxe::read_profiles();
my $systems = Gtk2::SimpleList->new(
N("MAC address") => 'text',
- N("Installed") => 'bool',
- N("System") => 'text',
+ N("Profil 1") => 'text',
+ N("Profil 2") => 'text',
);
-$systems->get_selection->set_mode('multiple');
+$systems->get_selection->set_mode('single');
$systems->get_model->set_sort_column_id(0, 'ascending');
#- don't let the user modify the "Installed" state
$systems->get_column(1)->get_cell_renderers->set_property('mode', 'inert');
-my $profiles = Gtk2::SimpleList->new(undef => 'text');
-$profiles->set_headers_visible(0);
+my $profiles = Gtk2::SimpleList->new("Profile name" => 'text');
+$profiles->set_headers_visible(1);
$profiles->get_selection->set_mode('browse');
$profiles->get_selection->signal_connect(changed => sub {
my ($model, $iter) = $_[0]->get_selected or return;
profile_selected($model->get($iter, 0));
- });
+ });
my $log_text = gtknew('TextView');
@@ -890,16 +897,24 @@ sub add_profile() {
$w->main;
}
-sub profile_selected {
- my ($profile) = @_;
- $install_button->set_sensitive(exists $profiles_conf->{profiles}{install}{$profile});
-}
-
-
-
###############
# Main Program
###############
+# create model
+our $model = create_model();
+our $treeview = Gtk2::TreeView->new_with_model($model);
+
+sub profile_selected {
+ my ($profile) = @_;
+ # force type = boot
+ my $type = "boot";
+ my ($config_file, $help_file) = network::pxe::get_pxelinux_profile_path($profile, $type);
+ print "----- $config_file $help_file\n";
+ my $pxelinux_conf = network::pxe::read_pxelinux_conf($config_file, $help_file);
+ print Dumper($pxelinux_conf);
+ set_pxelinux_entry_at_iter($model, $model->append, $_) foreach (@{$pxelinux_conf->{entries}});
+}
+
# check if first launch
if (!-f ($network::pxe::pxelinux_client_root . "/drakwizard_pxe")) {
@@ -920,13 +935,12 @@ sub launch_pxe_server() {
# disable wizard
$::isWizard = 0;
-# create model
-my $model = create_model();
+profile_selected;
my $w = ugtk2->new(N("Drakpxelinux"));
#$w->{rwindow}->set_size_request(800, 500) unless $::isEmbedded;
-my $treeview = Gtk2::TreeView->new_with_model($model);
+#my $treeview = Gtk2::TreeView->new_with_model($model);
$treeview->set_rules_hint(TRUE);
$treeview->get_selection->set_mode('single');
add_columns($treeview);
@@ -980,8 +994,8 @@ gtkpack($w->{window},
1, gtknew('HBox', spacing => 1, children => [
1, gtknew('ScrolledWindow', width => 500, height => 300, child => $treeview),
0, gtknew('VBox', children => [
- 0, gtknew('Label', text => N("Profiles")),
- 0, gtknew('ScrolledWindow', child => $profiles),
+ 0, gtknew('Label', text => N("Profiles list")),
+ 0, gtknew('ScrolledWindow', height => 170, child => $profiles),
0, gtknew('VButtonBox', layout => 'start', children_loose => [
gtksignal_connect(gtknew('Button', text => N("Add profile")), clicked => \&add_profile),
gtksignal_connect(gtknew('Button', text => N("Clone profile")), clicked => sub {