Browse Source

* Values for stripping working with "activate."

* $lib_bool, $bin_bool, $mod_bool
master
freesource 24 years ago
parent
commit
ebe2b7cab3
  1. 161
      YardBox.pm

161
YardBox.pm

@ -32,12 +32,10 @@ use Error;
my $yard_window; my $yard_window;
my $item_factory; my $item_factory;
my $accel_group;
my $true = 1; my $true = 1;
my $false = 0; my $false = 0;
my ($continue_button,$close_button,$save_button);
my $item_type = '<Title>';
my @menu_items = ( { path => '/File', my @menu_items = ( { path => '/File',
type => '<Branch>' }, type => '<Branch>' },
{ path => '/File/file_tearoff', { path => '/File/file_tearoff',
@ -46,7 +44,7 @@ my @menu_items = ( { path => '/File',
accelerator => '<control>S', accelerator => '<control>S',
callback => sub { print "hello"; } }, callback => sub { print "hello"; } },
{ path => '/File/Save _As ...', { path => '/File/Save _As ...',
accelerator => '<alt>A', accelerator => '<alt>S',
callback => sub { print "hello\n"; } }, callback => sub { print "hello\n"; } },
{ path => '/File/file_separator', { path => '/File/file_separator',
type => '<Separator>' }, type => '<Separator>' },
@ -120,34 +118,32 @@ my @menu_items = ( { path => '/File',
action => 17, action => 17,
type => '<CheckItem>' }, type => '<CheckItem>' },
{ path => '/_Tests', { path => '/_Tests',
type => '<Branch>' }, type => '<Branch>' },
{ path => '/Tests/tests_tearoff', { path => '/Tests/tests_tearoff',
type => '<Tearoff>' }, type => '<Tearoff>' },
{ path => '/Tests/fstab', { path => '/Tests/fstab',
action => 18, action => 30,
type => '<CheckItem>' }, type => '<CheckItem>' },
{ path => '/Tests/inittab', { path => '/Tests/inittab',
action => 19, action => 31,
type => '<CheckItem>' }, type => '<CheckItem>' },
{ path => '/Tests/scripts', { path => '/Tests/scripts',
action => 19, action => 32,
type => '<CheckItem>' }, type => '<CheckItem>' },
{ path => '/Tests/links', { path => '/Tests/links',
action => 20, action => 33,
type => '<CheckItem>' }, type => '<CheckItem>' },
{ path => '/Tests/passwd', { path => '/Tests/passwd',
action => 21, action => 34,
type => '<CheckItem>' }, type => '<CheckItem>' },
{ path => '/Tests/pam', { path => '/Tests/pam',
action => 22, action => 35,
type => '<CheckItem>' }, type => '<CheckItem>' },
{ path => '/Tests/nss', { path => '/Tests/nss',
action => 23, action => 36,
type => '<CheckItem>' }, type => '<CheckItem>' },
{ path => '/_Help', { path => '/_Help',
type => '<LastBranch>' }, type => '<LastBranch>' },
{ path => '/Help/help_tearoff', { path => '/Help/help_tearoff',
@ -160,8 +156,18 @@ my @menu_items = ( { path => '/File',
###### ######
sub yard { sub yard {
my ($kernel,$template_dir,$template) = @_; my ($ars) = @_;
my $error; my $error;
my $device = $ars->{device};
my $device_size = $ars->{device_size};
my $filename = $ars->{filename};
my $filename_size = $ars->{filename_size};
my $kernel = $ars->{kernel};
my $template_dir = $ars->{template_directory};
my $template = $ars->{template};
my $tmp = $ars->{tmp};
my $mnt = $ars->{mnt};
# Error handling in Yard will take some strategy # Error handling in Yard will take some strategy
if (!-d $kernel && -f $kernel) { if (!-d $kernel && -f $kernel) {
@ -204,6 +210,19 @@ sub yard {
} # end sub yard } # end sub yard
sub continue {
} # end sub continue
# cut little booleans for Gtk::CheckMenuItem
my $lib_bool = 1;
my $bin_bool = 1;
my $mod_bool = 1;
sub yard_box { sub yard_box {
$yard_window = new Gtk::Window "toplevel"; $yard_window = new Gtk::Window "toplevel";
@ -242,6 +261,84 @@ sub yard_box {
$vbox->pack_start( $table, $true, $true, 0 ); $vbox->pack_start( $table, $true, $true, 0 );
$table->show( ); $table->show( );
#_______________________________________
# Manipulate Gtk::ItemFactory -
# The trick here is to use the real path.
# Stripping
# Libraries
# objcopy parameters for Libraries
my $lib_all_strip = $item_factory->get_item
('/Edit/Settings/Stripping/settings/strip-all');
my $lib_debug_strip = $item_factory->get_item
('/Edit/Settings/Stripping/settings/strip-debug');
my $lib_strip = $item_factory->get_item
('/Edit/Settings/Stripping/Libraries');
$lib_strip->set_active($true);
$lib_strip->signal_connect( "activate",
sub {
# off
if ($lib_bool == 1) {
$lib_bool--;
$lib_strip->set_active($lib_bool);
}
# on
else {
$lib_bool++;
$lib_strip->set_active($lib_bool);
}
print "$lib_bool\n";
}
);
# Binaries
my $bin_strip = $item_factory->get_item
('/Edit/Settings/Stripping/Binaries');
$bin_strip->set_active($true);
$bin_strip->signal_connect( "activate",
sub {
# off
if ($bin_bool == 1) {
$bin_bool--;
$bin_strip->set_active($bin_bool);
}
# on
else {
$bin_bool++;
$bin_strip->set_active($bin_bool);
}
print "$bin_bool\n";
}
);
# Modules
my $mod_strip = $item_factory->get_item
('/Edit/Settings/Stripping/Modules');
$mod_strip->set_active($true);
$mod_strip->signal_connect( "activate",
sub {
# off
if ($mod_bool == 1) {
$mod_bool--;
$mod_strip->set_active($mod_bool);
}
# on
else {
$mod_bool++;
$mod_strip->set_active($mod_bool);
}
print "$mod_bool\n";
}
);
#_______________________________________ #_______________________________________
# Create the GtkText widget # Create the GtkText widget
my $length; my $length;
@ -285,6 +382,7 @@ sub yard_box {
$vbox->show(); $vbox->show();
my $check = new Gtk::CheckButton("Check"); my $check = new Gtk::CheckButton("Check");
$check->set_active($true);
$vbox->pack_start( $check, $true, $true, 10 ); $vbox->pack_start( $check, $true, $true, 10 );
show $check; show $check;
@ -317,23 +415,23 @@ sub yard_box {
$main_vbox->pack_start( $vbox, $false, $true, 0 ); $main_vbox->pack_start( $vbox, $false, $true, 0 );
$vbox->show(); $vbox->show();
my $button = new Gtk::Button( "Continue" ); $continue_button = new Gtk::Button( "Continue" );
$button->signal_connect( 'clicked', $continue_button->signal_connect( 'clicked',
sub { destroy $yard_window; } ); sub { destroy $yard_window; } );
$vbox->pack_start( $button, $true, $true, 0 ); $vbox->pack_start( $continue_button, $true, $true, 0 );
$button->show(); $continue_button->show();
$button = new Gtk::Button( "Close" ); $close_button = new Gtk::Button( "Close" );
$button->signal_connect( 'clicked', $close_button->signal_connect( 'clicked',
sub { destroy $yard_window; } ); sub { destroy $yard_window; } );
$vbox->pack_start( $button, $true, $true, 0 ); $vbox->pack_start( $close_button, $true, $true, 0 );
$button->show(); $close_button->show();
$button = new Gtk::Button( "Save" ); $save_button = new Gtk::Button( "Save" );
$button->signal_connect( 'clicked', $save_button->signal_connect( 'clicked',
sub { destroy $yard_window; } ); sub { destroy $yard_window; } );
$vbox->pack_start( $button, $true, $true, 0 ); $vbox->pack_start( $save_button, $true, $true, 0 );
$button->show(); $save_button->show();
show $yard_window; show $yard_window;
@ -352,7 +450,7 @@ sub yard_menu {
my ($window) = @_; my ($window) = @_;
$accel_group = new Gtk::AccelGroup(); my $accel_group = new Gtk::AccelGroup();
$item_factory = new Gtk::ItemFactory( 'Gtk::MenuBar', '<main>', $item_factory = new Gtk::ItemFactory( 'Gtk::MenuBar', '<main>',
$accel_group ); $accel_group );
$accel_group->attach($window); $accel_group->attach($window);
@ -360,17 +458,8 @@ sub yard_menu {
##$item_factory->delete_item('/File/Checkbox'); ##$item_factory->delete_item('/File/Checkbox');
##$item_factory->create_item(['/File/Checkbox', undef, undef, <Item>]); ##$item_factory->create_item(['/File/Checkbox', undef, undef, <Item>]);
# Manipulate Gtk::ItemFactory - The trick here is to use the real path.
##my $checkbox = $item_factory->get_item('/File/Checkbox');
##my $otherbox = $item_factory->get_item('/File/Save');
return ( $item_factory->get_widget( '<main>' ) ); return ( $item_factory->get_widget( '<main>' ) );
} }
1; 1;

Loading…
Cancel
Save