diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2001-04-10 16:33:07 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2001-04-10 16:33:07 +0000 |
commit | ea9bb377b25a6d76f2f21348f4098bdcf875a92d (patch) | |
tree | c0b13700d5ed86529d287560ebc8c122cd81743f | |
parent | 94fa7ff02849e8ad9fbc975cea36b4ebcd63ca36 (diff) | |
download | drakx-ea9bb377b25a6d76f2f21348f4098bdcf875a92d.tar drakx-ea9bb377b25a6d76f2f21348f4098bdcf875a92d.tar.gz drakx-ea9bb377b25a6d76f2f21348f4098bdcf875a92d.tar.bz2 drakx-ea9bb377b25a6d76f2f21348f4098bdcf875a92d.tar.xz drakx-ea9bb377b25a6d76f2f21348f4098bdcf875a92d.zip |
use gtkset_tip (so that no tip is set when tip eq '')
(create_boxradio): handle double_click
(ask_from_entries_refW): use radio boxes instead of list/clist if small number
of choices
-rw-r--r-- | perl-install/interactive_gtk.pm | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/perl-install/interactive_gtk.pm b/perl-install/interactive_gtk.pm index 57ddaf365..4b7483d83 100644 --- a/perl-install/interactive_gtk.pm +++ b/perl-install/interactive_gtk.pm @@ -34,7 +34,7 @@ sub ask_warn { } sub create_boxradio { - my ($e, $may_go_to_next, $changed) = @_; + my ($e, $may_go_to_next, $changed, $double_click) = @_; my @l = map { may_apply($e->{format}, $_) } @{$e->{list}}; my $boxradio = gtkpack2__(new Gtk::VBox(0, 0), @@ -43,14 +43,15 @@ sub create_boxradio { my $tips = new Gtk::Tooltips; mapn { my ($txt, $w) = @_; + $w->signal_connect(button_press_event => $double_click) if $double_click; $w->signal_connect(clicked => sub { ${$e->{val}} = $txt; &$changed; }); if ($e->{help}) { - $tips->set_tip($w, - ref($e->{help}) eq 'HASH' ? $e->{help}{$txt} : - ref($e->{help}) eq 'CODE' ? $e->{help}($txt) : $e->{help}); + gtkset_tip($tips, $w, + ref($e->{help}) eq 'HASH' ? $e->{help}{$txt} : + ref($e->{help}) eq 'CODE' ? $e->{help}($txt) : $e->{help}); } } $e->{list}, \@radios; @@ -284,9 +285,9 @@ sub create_list { $list->append_items($item); $item->show; if ($e->{help}) { - $tips->set_tip($item, - ref($e->{help}) eq 'HASH' ? $e->{help}{$_} : - ref($e->{help}) eq 'CODE' ? $e->{help}($_) : $e->{help}); + gtkset_tip($tips, $item, + ref($e->{help}) eq 'HASH' ? $e->{help}{$_} : + ref($e->{help}) eq 'CODE' ? $e->{help}($_) : $e->{help}); } $item->grab_focus if ${$e->{val}} && $_ eq ${$e->{val}}; } @$l; @@ -401,14 +402,15 @@ sub ask_from_entries_refW { sub { if ($_[1]{type} =~ /^2/) { $mainw->{retval} = 1; Gtk->main_quit } } : ''; my @para = ($e, $may_go_to_next, $changed, $quit_if_double_click); + my $use_boxradio = @{$e->{list}} <= 8; if ($e->{help}) { #- used only when needed, as key bindings are dropped by List (CList does not seems to accepts Tooltips). - ($w, $set) = create_list(@para); + ($w, $set) = $use_boxradio ? create_boxradio(@para) : create_list(@para); } elsif ($e->{type} eq 'treelist') { ($w, $set, $size) = create_ctree(@para); } else { - ($w, $set) = $::isWizard ? create_boxradio(@para) : create_clist(@para); + ($w, $set) = $use_boxradio ? create_boxradio(@para) : create_clist(@para); } if (@{$e->{list}} > 4) { $has_scroll = 1; |