From 3577d8ff7d5b23cff0dd7d9fc385dafd65a6d51c Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Thu, 20 Mar 2008 12:59:20 +0000 Subject: (_build_tree) split it out of build_tree() (needed for next commits) --- Rpmdrake/gui.pm | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) (limited to 'Rpmdrake') diff --git a/Rpmdrake/gui.pm b/Rpmdrake/gui.pm index 5ce4ce28..7bafd9e3 100644 --- a/Rpmdrake/gui.pm +++ b/Rpmdrake/gui.pm @@ -805,6 +805,20 @@ sub ctreefy { join('|', map { translate($_) } split m|/|, $_[0]); } +sub _build_tree { + my ($elems, @elems) = @_; + #- we populate all the groups tree at first + %$elems = (); + # better loop on packages, create groups tree and push packages in the proper place: + foreach my $pkg (@elems) { + my $grp = $pkg->[1]; + add_parent($grp); + $elems->{$grp} ||= []; + push @{$elems->{$grp}}, $pkg; + } +} + + sub build_tree { my ($tree, $tree_model, $elems, $options, $force_rebuild, $flat, $mode) = @_; state $old_mode; @@ -864,15 +878,7 @@ or you already installed all of them.")); ? N("Upgradable") : N("Addable") ) foreach $sortmethods{flat}->(@elems); } else { - #- we populate all the groups tree at first - %$elems = (); - # better loop on packages, create groups tree and push packages in the proper place: - foreach my $pkg (@elems) { - my $grp = $pkg->[1]; - add_parent($grp); - $elems->{$grp} ||= []; - push @{$elems->{$grp}}, $pkg; - } + _build_tree($elems, @elems); } } statusbar_msg_remove($wait) if defined $wait; -- cgit v1.2.1