diff options
author | Guillaume Cottenceau <gc@mandriva.com> | 2002-12-23 14:35:24 +0000 |
---|---|---|
committer | Guillaume Cottenceau <gc@mandriva.com> | 2002-12-23 14:35:24 +0000 |
commit | 7a55a1f5fa4ca17b09898e4b2e439b0291214a84 (patch) | |
tree | 8f394c44b7fe6d5e96748d7d82cffa4667d30280 /perl-install/interactive/gtk.pm | |
parent | ee589f2884fd2b673d5dd0186f526523570b4ccb (diff) | |
download | drakx-backup-do-not-use-7a55a1f5fa4ca17b09898e4b2e439b0291214a84.tar drakx-backup-do-not-use-7a55a1f5fa4ca17b09898e4b2e439b0291214a84.tar.gz drakx-backup-do-not-use-7a55a1f5fa4ca17b09898e4b2e439b0291214a84.tar.bz2 drakx-backup-do-not-use-7a55a1f5fa4ca17b09898e4b2e439b0291214a84.tar.xz drakx-backup-do-not-use-7a55a1f5fa4ca17b09898e4b2e439b0291214a84.zip |
be more efficient in precomputing, previous situation could lead to several tens of seconds of wait in XFdrake-monitor
Diffstat (limited to 'perl-install/interactive/gtk.pm')
-rw-r--r-- | perl-install/interactive/gtk.pm | 29 |
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); |