From 12b224d0ed08d9adb5bb342768e441901b0e530c Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 22 Feb 2000 12:02:00 +0000 Subject: no_comment --- perl-install/ChangeLog | 8 ++++++++ perl-install/interactive_gtk.pm | 18 ++++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/perl-install/ChangeLog b/perl-install/ChangeLog index 7e178fc1c..91862a820 100644 --- a/perl-install/ChangeLog +++ b/perl-install/ChangeLog @@ -1,3 +1,11 @@ +2000-02-22 Pixel + + * install_steps_interactive.pm (timeConfig): use ask_from_treelist + + * interactive_gtk.pm (ask_from_treelist): creation of + ask_from_treelist. Usage is just the same as ask_from_list with + one more argument (the separator eg: |, /) + 2000-02-11 François Pons * diskdrake.pm: fixed deadlock while trying to create partition diff --git a/perl-install/interactive_gtk.pm b/perl-install/interactive_gtk.pm index 840dbdf95..62f0c3603 100644 --- a/perl-install/interactive_gtk.pm +++ b/perl-install/interactive_gtk.pm @@ -65,7 +65,7 @@ sub ask_from_treelist { my $s; foreach (split $sep, $_[0]) { $wtree{"$s$_$separator"} ||= - $tree->insert_node($s ? $parent->($s) : undef, undef, [$_], 2, (undef) x 4, 0, 0); + $tree->insert_node($s ? $parent->($s) : undef, undef, [$_], 5, (undef) x 4, 0, 0); $s .= "$_$separator"; } $wtree{$s}; @@ -73,7 +73,7 @@ sub ask_from_treelist { my ($root, $leaf, $wdef, $ndef); foreach (@$l) { ($root, $leaf) = /(.*)$sep(.+)/o or ($root, $leaf) = ('', $_); - my $node = $tree->insert_node($parent->($root), undef, [$leaf], 2, (undef) x 4, 1, 0); + my $node = $tree->insert_node($parent->($root), undef, [$leaf], 5, (undef) x 4, 1, 0); if ($def eq $_) { $wdef = $node; @@ -94,20 +94,30 @@ sub ask_from_treelist { $w->{retval} = join $separator, @l; Gtk->main_quit; }; + gtkadd($w->{window}, gtkpack_(new Gtk::VBox(0,0), 1, gtkset_usize(createScrolledWindow($tree), 200, 280), 0, $w->create_okcancel)); $tree->set_selection_mode('browse'); - $tree->signal_connect(tree_select_row => sub { $curr = $_[1] }); + $tree->signal_connect(tree_select_row => sub { $curr = $_[1]; }); $tree->signal_connect(button_press_event => sub { &$leave if $_[1]{type} =~ /^2/ }); + $tree->signal_connect(key_press_event => sub { + my ($w, $e) = @_; + my $c = chr $e->{keyval}; + + if ($e->{keyval} >= 0x100) { + &$leave if $c eq "\r" || $c eq "\x8d"; + } + 1; + }); $tree->focus_row($ndef) if $ndef; $tree->select($wdef) if $wdef; $tree->node_moveto($wdef, 0, 0.5, 0) if $wdef; $tree->grab_focus; - $w->{window}->show_all; + $w->main or die "ask_from_list cancel"; } -- cgit v1.2.1