diff options
author | Thierry Vignaud <tv@mandriva.org> | 2008-03-17 13:08:33 +0000 |
---|---|---|
committer | Thierry Vignaud <tv@mandriva.org> | 2008-03-17 13:08:33 +0000 |
commit | 57cd86ef19df8f718d2b99de9c00487078ec1d15 (patch) | |
tree | 51d39ba7f247f279640b5e95221a59bd9218e1cb /Rpmdrake | |
parent | c992bb2820182f1ecd26c00b2f721bb21f40c7ad (diff) | |
download | rpmdrake-57cd86ef19df8f718d2b99de9c00487078ec1d15.tar rpmdrake-57cd86ef19df8f718d2b99de9c00487078ec1d15.tar.gz rpmdrake-57cd86ef19df8f718d2b99de9c00487078ec1d15.tar.bz2 rpmdrake-57cd86ef19df8f718d2b99de9c00487078ec1d15.tar.xz rpmdrake-57cd86ef19df8f718d2b99de9c00487078ec1d15.zip |
split filters (all, installed, non installed) from views (GUI, meta packages,
updates, ...)
Diffstat (limited to 'Rpmdrake')
-rw-r--r-- | Rpmdrake/gui.pm | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/Rpmdrake/gui.pm b/Rpmdrake/gui.pm index ff24e6be..90963552 100644 --- a/Rpmdrake/gui.pm +++ b/Rpmdrake/gui.pm @@ -71,7 +71,7 @@ our @EXPORT = qw( toggle_nodes ); -our ($descriptions, @filtered_pkgs, %filter_methods, $force_displaying_group, $force_rebuild, @initial_selection, $pkgs, $size_free, $size_selected, $urpm); +our ($descriptions, %filters, @filtered_pkgs, %filter_methods, $force_displaying_group, $force_rebuild, @initial_selection, $pkgs, $size_free, $size_selected, $urpm); our %grp_columns = ( label => 0, @@ -520,10 +520,13 @@ sub pkgs_provider { my $h = &get_pkgs($options); # was given (1, @_) for updates ($urpm, $descriptions) = @$h{qw(urpm update_descr)}; $pkgs = $h->{all_pkgs}; + %filters = ( + non_installed => $h->{installable}, + installed => $h->{installed}, + all => [ keys %$pkgs ], + ); my %tmp_filter_methods = ( all => sub { @filtered_pkgs = keys %$pkgs }, - installed => sub { @filtered_pkgs = @{$h->{installed}} }, - non_installed => sub { @filtered_pkgs = @{$h->{installable}} }, all_updates => sub { @filtered_pkgs = @{$h->{updates}}; # potential "updates" from media not tagged as updates: @@ -544,7 +547,13 @@ sub pkgs_provider { }; } - %filter_methods = %tmp_filter_methods; + undef %filter_methods; + foreach my $type (keys %tmp_filter_methods) { + $filter_methods{$type} = sub { + $force_rebuild = 1; # force rebuilding tree since we changed filter (FIXME: switch to SortModel) + @filtered_pkgs = intersection($filters{$filter->[0]}, [ $tmp_filter_methods{$type}->() ]); + }; + } switch_pkg_list_mode($mode); } |