From 1cb92862bcf5d3b3763f035ae15bbd62b9be1027 Mon Sep 17 00:00:00 2001 From: freesource Date: Wed, 20 Dec 2000 00:22:02 +0000 Subject: [PATCH] * Now $ars is global to the program and can be called with ars(). This covers (filename, filesystem_size, kernel, template_directory, template). --- YardBox.pm | 25 ++++++++++++++----------- gBootRoot | 53 +++++++++++++++++++++++++++++++++++++++++++++++++---- 2 files changed, 63 insertions(+), 15 deletions(-) diff --git a/YardBox.pm b/YardBox.pm index e19e1a2..ce7d734 100644 --- a/YardBox.pm +++ b/YardBox.pm @@ -23,7 +23,7 @@ package YardBox; use vars qw(@ISA @EXPORT %EXPORT_TAGS); use Exporter; @ISA = qw(Exporter); -@EXPORT = qw(yard yard_box); +@EXPORT = qw(yard ars); use strict; use Yard; @@ -45,6 +45,19 @@ my $lib_bool = 1; my $bin_bool = 1; my $mod_bool = 1; +my $ars; +sub ars { $ars = $_[0]; + +$filename = $ars->{filename}; +$filesystem_size = $ars->{filesystem_size}; +$kernel = $ars->{kernel}; +$template_dir = $ars->{template_directory}; +$template = $ars->{template}; +$tmp = $ars->{tmp}; +$mnt = $ars->{mnt}; + +} + my @menu_items = ( { path => '/File', type => '' }, { path => '/File/file_tearoff', @@ -181,16 +194,6 @@ my @menu_items = ( { path => '/File', # YARD ###### sub yard { - - my ($ars) = @_; - - $filename = $ars->{filename}; - $filesystem_size = $ars->{filesystem_size}; - $kernel = $ars->{kernel}; - $template_dir = $ars->{template_directory}; - $template = $ars->{template}; - $tmp = $ars->{tmp}; - $mnt = $ars->{mnt}; # Error handling in Yard will take some strategy diff --git a/gBootRoot b/gBootRoot index 709f0b2..93887f2 100644 --- a/gBootRoot +++ b/gBootRoot @@ -154,6 +154,7 @@ my ($adj2,$adj3); my @strings; my ($root_device,$root_filename,$method,$template,$filesystem_size, $root_device_size); +my $ars = {}; # anonymous hash # My own creation - the roots touch the ground if three lines are added. my @xpm_data = ( @@ -342,9 +343,15 @@ $opt->show(); $box2->show(); # Second row +# Get to look three places for kernel value +# default ( null|gdkkbirdaao) && entry() && fileselect->file_ok_sel hbox(); my $entry2 = entry($true,1); $entry2->set_text($container[1]); +if ($container[1]) { + $ars->{kernel} = $container[1]; + ars($ars); +} button("Kernel Selection",$entry2,"Kernel Selection",1); # Third row @@ -751,6 +758,8 @@ sub advanced_root_section { label_advanced("Root Filename:",0,1,2,3,$table_advanced_root); $ear2 = entry_advanced(1,2,2,3,4,$table_advanced_root); $ear2->set_text("root_fs"); + $ars->{filename} = "root_fs"; + ars($ars); $tooltips->set_tip( $ear2, "Give the Root Filesystem file a name.", "" ); my $ear2_save = new Gtk::CheckButton("save"); @@ -782,8 +791,13 @@ sub advanced_root_section { $spinner_size->set_shadow_type( 'in' ); $spinner_size->show(); $filesystem_size = 4096 if !$filesystem_size; + $ars->{filesystem_size} = $filesystem_size; + ars($ars); $adj3->signal_connect( "value_changed", sub { - $filesystem_size = $spinner_size->get_value_as_int();}); + $filesystem_size = $spinner_size->get_value_as_int(); + $ars->{filesystem_size} = $filesystem_size; + ars($ars); + }); $spinner_size->set_value($filesystem_size) if $filesystem_size; #_______________________________________ @@ -898,7 +912,10 @@ sub advanced_root_section { "" ); $entry_advanced[7] = $combo->entry->get_text(); # nothing selected $combo->entry->signal_connect("changed", sub { - $entry_advanced[7] = $combo->entry->get_text(); } ); + $entry_advanced[7] = $combo->entry->get_text(); + $ars->{template} = $entry_advanced[7]; + ars($ars); + } ); $table_advanced_root->attach($combo,1,3,7,8, ['expand','fill'],['fill','shrink'],0,0); show $combo; @@ -964,6 +981,20 @@ sub Generate { # $root_device_size; # $filesystem_size; + $ars->{device} = $entry_advanced[3]; + $ars->{device_size} = $root_device_size; + $ars->{tmp} = $tmp; + $ars->{mnt} = $mnt; + $ars->{template_dir} = $template_dir; # static right now. + ars($ars); + +=pod + + foreach (%$ars) { + print $_, "=>", $ars->{$_}, "\n"; + } return; + + my $ars = { "device" => $entry_advanced[3], "device_size" => $root_device_size, "filename" => $entry_advanced[4], @@ -974,6 +1005,7 @@ sub Generate { "tmp" => $tmp, "mnt" => $mnt }; +=cut my $template = $ars->{template}; $root_device = $ars->{device}; @@ -1004,7 +1036,7 @@ sub Generate { if ($method eq "yard") { - yard($ars); + yard(); } @@ -1057,7 +1089,12 @@ sub entry_advanced { my $entry_advanced = new Gtk::Entry(); $entry_advanced->set_editable( $true ); $entry_advanced->signal_connect( "changed", sub { - $entry_advanced[$numa] = $entry_advanced->get_text();} ); + $entry_advanced[$numa] = $entry_advanced->get_text(); + if ($numa == 4) { + $ars->{filename} = $entry_advanced[$numa]; + ars($ars); + } + } ); $entry_advanced->set_usize(100,20); $_[5]->attach($entry_advanced,$_[0],$_[1],$_[2],$_[3], ['shrink','fill','expand'],['fill','shrink'],0,0); @@ -1275,6 +1312,10 @@ sub file_ok_sel { my $file = $file_selection->get_filename(); $entry->set_text($file); $container[$order] = $file; + if ($order == 1) { + $ars->{kernel} = $container[$order]; + ars($ars); + } # auto-detect compression if system has file if ($container[2]) { @@ -1332,6 +1373,10 @@ sub entry { else { $entry->signal_connect( "changed", sub { $container[$num] = $entry->get_text(); + if ($num == 1) { + $ars->{kernel} = $container[$num]; + ars($ars); + } # here's where types in entry3, types other places if (defined $ea1 and $num == 3) { $ea1->set_text($container[$num]);