diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2001-04-10 11:05:43 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2001-04-10 11:05:43 +0000 |
commit | 75ca72c84ed0b0c1e387d95f9040cffc45a9f45b (patch) | |
tree | 27c5989293ec3aa67588f2c7664ed48d2775ca56 /perl-install | |
parent | 33b23a749724c7e347a6d64810ca15664fa42fd2 (diff) | |
download | drakx-75ca72c84ed0b0c1e387d95f9040cffc45a9f45b.tar drakx-75ca72c84ed0b0c1e387d95f9040cffc45a9f45b.tar.gz drakx-75ca72c84ed0b0c1e387d95f9040cffc45a9f45b.tar.bz2 drakx-75ca72c84ed0b0c1e387d95f9040cffc45a9f45b.tar.xz drakx-75ca72c84ed0b0c1e387d95f9040cffc45a9f45b.zip |
(create_ctree): handle single click on node opens the node
Diffstat (limited to 'perl-install')
-rw-r--r-- | perl-install/interactive_gtk.pm | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/perl-install/interactive_gtk.pm b/perl-install/interactive_gtk.pm index 63cfca73e..57ddaf365 100644 --- a/perl-install/interactive_gtk.pm +++ b/perl-install/interactive_gtk.pm @@ -140,7 +140,7 @@ sub create_ctree { my $sep = quotemeta $e->{separator}; my $tree = Gtk::CTree->new(1, 0); - my (%wtree, %wleaves, $size); + my (%wtree, %wleaves, $size, $selected_via_click); my $parent; $parent = sub { if (my $w = $wtree{"$_[0]$e->{separator}"}) { return $w } my $s; @@ -178,17 +178,19 @@ sub create_ctree { $tree->set_selection_mode('browse'); $tree->signal_connect(tree_select_row => sub { $curr = $_[1]; - $curr->row->is_leaf or return; - my @ll; for (my $c = $curr; $c; $c = $c->row->parent) { - unshift @ll, first $tree->node_get_pixtext($c, 0); + if ($curr->row->is_leaf) { + my @ll; for (my $c = $curr; $c; $c = $c->row->parent) { + unshift @ll, first $tree->node_get_pixtext($c, 0); + } + my $val = join $e->{separator}, @ll; + mapn { + ${$e->{val}} = $_[1] if $val eq $_[0] + } \@l, $e->{list}; + &$changed; + } else { + $tree->expand($curr) if $selected_via_click; } - my $val = join $e->{separator}, @ll; - mapn { - ${$e->{val}} = $_[1] if $val eq $_[0] - } \@l, $e->{list}; - &$changed; }); -# $tree->signal_connect(button_press_event => sub { &$leave if $_[1]{type} =~ /^2/ }); my ($first_time, $starting_word, $start_reg) = (1, '', "^"); my $timeout; @@ -199,6 +201,7 @@ sub create_ctree { }; $tree->signal_connect(key_press_event => sub { my ($w, $event) = @_; + $selected_via_click = 0; my $c = chr($event->{keyval} & 0xff); $curr or return; Gtk->timeout_remove($timeout) if $timeout; $timeout = ''; @@ -245,7 +248,10 @@ sub create_ctree { } 1; }); - $tree->signal_connect(button_press_event => sub { &$double_click if $curr->row->is_leaf }) if $double_click; + $tree->signal_connect(button_press_event => sub { + $selected_via_click = 1; + &$double_click if $curr->row->is_leaf && $double_click; + }); $tree->set_row_height($tree->style->font->ascent + $tree->style->font->descent + 1); |