summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2002-12-23 14:35:24 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2002-12-23 14:35:24 +0000
commit7a55a1f5fa4ca17b09898e4b2e439b0291214a84 (patch)
tree8f394c44b7fe6d5e96748d7d82cffa4667d30280
parentee589f2884fd2b673d5dd0186f526523570b4ccb (diff)
downloaddrakx-7a55a1f5fa4ca17b09898e4b2e439b0291214a84.tar
drakx-7a55a1f5fa4ca17b09898e4b2e439b0291214a84.tar.gz
drakx-7a55a1f5fa4ca17b09898e4b2e439b0291214a84.tar.bz2
drakx-7a55a1f5fa4ca17b09898e4b2e439b0291214a84.tar.xz
drakx-7a55a1f5fa4ca17b09898e4b2e439b0291214a84.zip
be more efficient in precomputing, previous situation could lead to several tens of seconds of wait in XFdrake-monitor
-rw-r--r--perl-install/interactive/gtk.pm29
1 files changed, 10 insertions, 19 deletions
diff --git a/perl-install/interactive/gtk.pm b/perl-install/interactive/gtk.pm
index d58195d81..c9cffa3b0 100644
--- a/perl-install/interactive/gtk.pm
+++ b/perl-install/interactive/gtk.pm
@@ -172,30 +172,21 @@ sub create_treeview_tree {
}
$wtree{$s};
};
- foreach (@l) {
- my ($root, $leaf) = /(.*)$sep(.+)/ ? ($1, $2) : ('', $_);
+
+ #- do some precomputing to not slowdown selection change and key press
+ my (%precomp, @ordered_keys);
+ mapn {
+ my ($root, $leaf) = $_[0] =~ /(.*)$sep(.+)/ ? ($1, $2) : ('', $_[0]);
my $iter = $tree_model->append_set($parent->($root), [ 0 => $leaf ]);
- $wleaves{$_} = $tree_model->get_path_str($iter);
+ my $pathstr = $tree_model->get_path_str($iter);
$iter->free;
- }
+ $precomp{$pathstr} = { value => $leaf, fullvalue => $_[0], listvalue => $_[1] };
+ push @ordered_keys, $pathstr;
+ $wleaves{$_[0]} = $pathstr;
+ } \@l, $e->{list};
$_->free foreach values %wtree;
undef %wtree;
- #- do some precomputing to not slowdown selection change and key press
- my (%precomp, @ordered_keys);
- $tree_model->foreach(sub {
- my (undef, $path_, $iter) = @_;
- my ($path, $pathstr, @ll, $val, $listval);
- $path = $path_->copy;
- $pathstr = $path->to_string;
- while ($path->get_depth) { unshift @ll, $tree_model->get($path, 0); $path->up }
- $val = join($e->{separator}, @ll);
- mapn { $listval = $_[1] if $val eq $_[0] } \@l, $e->{list};
- $precomp{$pathstr} = { value => $tree_model->get($iter, 0), fullvalue => $val, listvalue => $listval };
- push @ordered_keys, $pathstr;
- 0
- }, undef);
-
my $select = sub {
my ($path_str) = @_;
my $path = Gtk2::TreePath->new_from_string($path_str);