diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2001-02-10 10:10:00 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2001-02-10 10:10:00 +0000 |
commit | 1366ba7668973fede10bc34d0759b7cebd9d2099 (patch) | |
tree | 46771f043d3d5fdba99b663f1a42aacba23a8b0d | |
parent | 46e25ae29ee4cf5aab5e0b439aca9a68f91a2181 (diff) | |
download | drakx-1366ba7668973fede10bc34d0759b7cebd9d2099.tar drakx-1366ba7668973fede10bc34d0759b7cebd9d2099.tar.gz drakx-1366ba7668973fede10bc34d0759b7cebd9d2099.tar.bz2 drakx-1366ba7668973fede10bc34d0759b7cebd9d2099.tar.xz drakx-1366ba7668973fede10bc34d0759b7cebd9d2099.zip |
button behaviour now chosen, and implemented
-rw-r--r-- | perl-install/interactive.pm | 2 | ||||
-rw-r--r-- | perl-install/interactive_gtk.pm | 14 | ||||
-rw-r--r-- | perl-install/interactive_newt.pm | 20 |
3 files changed, 21 insertions, 15 deletions
diff --git a/perl-install/interactive.pm b/perl-install/interactive.pm index e584e5336..96f46898e 100644 --- a/perl-install/interactive.pm +++ b/perl-install/interactive.pm @@ -16,7 +16,7 @@ use common qw(:common :functional); #- advanced => wether it is shown in by default or only in advanced mode #- disabled => function returning wether it should be disabled (grayed) #- type => -#- button => (with text, clicked) (type defaults to button if clicked is there) +#- button => (with clicked) (type defaults to button if clicked is there) #- bool (with text) #- range (with min, max) #- combo (with list, not_edit) diff --git a/perl-install/interactive_gtk.pm b/perl-install/interactive_gtk.pm index c26f72a4b..7bb62fdd9 100644 --- a/perl-install/interactive_gtk.pm +++ b/perl-install/interactive_gtk.pm @@ -41,7 +41,7 @@ sub create_clist { my $select = sub { $list->set_focus_row($_[0]); $list->select_row($_[0], 0); - $list->moveto($_[0], 0, 0.5, 0); + $list->moveto($_[0], 0, 0.5, 0) if $list->row_is_visible($_[0]) ne 'full'; }; # ref $title && !@okcancel ? @@ -93,7 +93,7 @@ sub create_clist { $list, sub { my ($v) = @_; - eval { + eval { $select->(find_index { $_ eq $v } @{$e->{list}}); }; }; @@ -280,13 +280,15 @@ sub ask_from_entries_refW { $set = sub { $w->set_active($_[0]) }; $get = sub { $w->get_active }; } elsif ($e->{type} eq 'button') { - $w = Gtk::Button->new($e->{text}); + $w = Gtk::Button->new(''); $w->signal_connect(clicked => sub { - $o->{retval} = 1; - Gtk->main_quit; - $mainw->destroy; + $get_all->(); + $mainw->{rwindow}->hide; $e->{clicked}(); + $mainw->{rwindow}->show; + $set_all->(); }); + $set = sub { $w->child->set(may_apply($e->{format}, $_[0])) }; } elsif ($e->{type} eq 'range') { my $adj = create_adjustment(${$e->{val}}, $e->{min}, $e->{max}); $adj->signal_connect(value_changed => $changed); diff --git a/perl-install/interactive_newt.pm b/perl-install/interactive_newt.pm index b260d60af..4ea1a2a4f 100644 --- a/perl-install/interactive_newt.pm +++ b/perl-install/interactive_newt.pm @@ -102,7 +102,7 @@ sub ask_from_entries_refW { $set = sub { $w->CheckboxSetValue(checkval($_[0])) }; $get = sub { $w->CheckboxGetValue == ord '*' }; } elsif ($e->{type} eq 'button') { - $w = Newt::Component::Button(-1, -1, $e->{text} || ''); + $w = Newt::Component::Button(-1, -1, may_apply($e->{format}, ${$e->{val}})); } elsif ($e->{type} =~ /list/) { my ($h, $wi) = (5, 20); my $scroll = @{$e->{list}} > $h ? 1 << 2 : 0; @@ -182,19 +182,23 @@ sub ask_from_entries_refW { !$error; }; - my ($canceled, $r); + my $canceled; do { - $r = $form->RunForm; + my $r = $form->RunForm; + foreach (@widgets) { + if ($$r == ${$_->{w}}) { + $form->FormDestroy; + Newt::PopWindow; + $_->{e}{clicked}(); + return ask_from_entries_refW($o, $common, $l, $l2); + } + } $canceled = $cancel && $$r == $$cancel; + } until ($check->($common->{callbacks}{$canceled ? 'canceled' : 'complete'})); $form->FormDestroy; Newt::PopWindow; - - foreach (@widgets) { - $_->{e}{clicked}() if $$r == ${$_->{w}}; - } - !$canceled; } |