aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2008-03-17 21:28:48 +0000
committerThierry Vignaud <tv@mandriva.org>2008-03-17 21:28:48 +0000
commit3e727ce1e3a49fd0149625d77fabaf6326964be4 (patch)
tree72af6c8257324a8371e6fb4a21f9da4c7708d13b
parentacc76c2ac5fd1aeea737b0b0e03518a936796d33 (diff)
downloadrpmdrake-3e727ce1e3a49fd0149625d77fabaf6326964be4.tar
rpmdrake-3e727ce1e3a49fd0149625d77fabaf6326964be4.tar.gz
rpmdrake-3e727ce1e3a49fd0149625d77fabaf6326964be4.tar.bz2
rpmdrake-3e727ce1e3a49fd0149625d77fabaf6326964be4.tar.xz
rpmdrake-3e727ce1e3a49fd0149625d77fabaf6326964be4.zip
add a "mode" combo box, thus restoring flat mode (#25770) and allowing again to
sort packages by size (#25417)
-rw-r--r--NEWS2
-rw-r--r--Rpmdrake/gui.pm2
-rwxr-xr-xrpmdrake51
-rw-r--r--rpmdrake.pm4
4 files changed, 42 insertions, 17 deletions
diff --git a/NEWS b/NEWS
index cbf98c48..aff0404d 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,8 @@
- tell the user to "restart system" when needed (needs urpmi-5.14)
- rpmdrake:
o add tooltips to pull down menus & to search entry
+ o allow to sort packages by size (#25417)
+ o restore flat mode (#25770)
Version 4.7 - 17 March 2008, Thierry Vignaud
diff --git a/Rpmdrake/gui.pm b/Rpmdrake/gui.pm
index ffe4fe04..9f57701e 100644
--- a/Rpmdrake/gui.pm
+++ b/Rpmdrake/gui.pm
@@ -847,7 +847,7 @@ or you already installed all of them."));
by_medium => sub { sort { $a->[2] <=> $b->[2] || uc($a->[0]) cmp uc($b->[0]) } @_ },
);
if ($flat) {
- add_node($_->[0], '') foreach $sortmethods{$mode || 'flat'}->(@elems);
+ add_node($_->[0], '') foreach $sortmethods{$::mode->[0] || 'flat'}->(@elems);
} else {
if (0 && $MODE eq 'update') {
add_node($_->[0], N("All")) foreach $sortmethods{flat}->(@elems);
diff --git a/rpmdrake b/rpmdrake
index 1f181564..66b063e8 100755
--- a/rpmdrake
+++ b/rpmdrake
@@ -350,15 +350,18 @@ sub run_treeview_dialog {
my %rfilters = reverse %filters;
+ my %modes = (
+ flat => N("All packages, alphabetical"),
+ by_group => N("All packages, by group"),
+ by_leaves => N("Leaves only, sorted by install date"),
+ by_presence => N("All packages, by update availability"),
+ by_selection => N("All packages, by selection state"),
+ by_size => N("All packages, by size"),
+ );
+ my %rmodes = reverse %modes;
+
+
my %views = (all => N("All"),
- if_(0, # let's keep the translated strings (to be resurected as sorting the treeview):
- N("All packages, alphabetical"),
- by_presence => N("All packages, by update availability"),
- by_size => N("All packages, by size"),
- by_selection => N("All packages, by selection state"),
- by_leaves => N("Leaves only, sorted by install date"),
- by_group => N("All packages, by group"),
- ),
if_($is_backports, backports =>
#-PO: Backports media are newer but less-tested versions of some packages in main
#-PO: See http://wiki.mandriva.com/en/Policies/SoftwareMedia#.2Fmain.2Fbackports
@@ -400,15 +403,9 @@ sub run_treeview_dialog {
if (my @cat = $wanted_categories{$rviews{$val}} && @{$wanted_categories{$rviews{$val}}}) {
@$mandrakeupdate_wanted_categories = @cat;
}
- if (0) {
- reset_search();
- $options->{rebuild_tree}->();
- }
- $options->{state}{flat} = 0; # was 1 only for the "All packages, alphabetical", "All packages, by size", "All packages, by selection state", and "Leaves only, sorted by install date"
if ($options->{tree_mode} ne $val) {
- ($options->{tree_mode}) = $val =~ /^by/ ?
- $options->{tree_submode} : $rviews{$val};
+ $options->{tree_mode} = $rviews{$val};
$tree_mode->[0] = $options->{tree_mode};
$tree_flat->[0] = $options->{state}{flat};
reset_search();
@@ -442,6 +439,29 @@ sub run_treeview_dialog {
}
);
+ my $mode_box = gtknew(
+ 'ComboBox',
+ list => [ qw(flat by_group by_leaves by_presence by_selection by_size) ],
+ format => sub { $modes{$_[0]} }, text => $modes{$mode->[0]},
+ tip => N("Tree Mode"),
+ changed => sub {
+ my $val = $_[0]->get_text;
+ return if $val eq $old_value; # workarounding gtk+ sending us sometimes twice events
+ $old_value = $val;
+ $val = $rmodes{$val};
+ return if $mode->[0] eq $val;
+ $mode->[0] = $val;
+ $tree_flat->[0] = $options->{state}{flat} = member($mode->[0], qw(flat by_leaves by_selection by_size));
+
+ if ($options->{tree_mode} ne $val) {
+ reset_search();
+ slow_func($::main_window->window, sub { switch_pkg_list_mode($rmodes{$val}) });
+ $options->{rebuild_tree}->();
+ }
+ }
+ );
+
+
my @search_types = qw(normal descriptions summaries files);
my $current_search_type = $search_types[0];
my $search_menu = Gtk2::Menu->new;
@@ -577,6 +597,7 @@ sub run_treeview_dialog {
gtknew('HBox', spacing => 10),
0, $cbox,
0, $fbox,
+ 0, $mode_box,
1, gtkset_size_request(Gtk2::Alignment->new(0, 0, 0, 0), 100, 1),
0, $find_entry = gtknew('Sexy_IconEntry', clear_button => 1, width => 260,
primary_icon => Gtk2::Image->new_from_stock('gtk-find', 'menu'),
diff --git a/rpmdrake.pm b/rpmdrake.pm
index 9be62aed..d1bcb9c3 100644
--- a/rpmdrake.pm
+++ b/rpmdrake.pm
@@ -51,6 +51,7 @@ our @EXPORT = qw(
$dont_show_selections
$mandrakeupdate_wanted_categories
$max_info_in_descr
+ $mode
$offered_to_add_sources
$tree_flat
$tree_mode
@@ -148,7 +149,7 @@ my ($root) = grep { $_->[2] == 0 } list_passwd();
$ENV{HOME} = $> == 0 ? $root->[7] : $ENV{HOME} || '/root';
our $configfile = "$ENV{HOME}/.rpmdrake";
-our ($already_splashed, $changelog_first_config, $filter, $max_info_in_descr, $tree_flat, $tree_mode);
+our ($already_splashed, $changelog_first_config, $filter, $max_info_in_descr, $mode, $tree_flat, $tree_mode);
our ($mandrakeupdate_wanted_categories, $offered_to_add_sources, $no_confirmation);
our %config = (
mandrakeupdate_wanted_categories => { var => \$mandrakeupdate_wanted_categories, default => [ qw(security) ] },
@@ -161,6 +162,7 @@ our %config = (
changelog_first_config => { var => \$changelog_first_config, default => [ 0 ] },
'no-confirmation' => { var => \$no_confirmation, default => [ 0 ] },
filter => { var => \$filter, default => [ 'all' ] },
+ mode => { var => \$mode, default => [ 'by_group' ] },
);
sub readconf() {