diff options
-rwxr-xr-x | rpmdrake | 43 |
1 files changed, 23 insertions, 20 deletions
@@ -226,6 +226,28 @@ sub quit() { real_quit(); } +sub reset_selection { + my ($tree) = @_; + if ($MODE ne 'remove') { + my $db = eval { open_rpm_db() }; + if (!ref($db)) { + statusbar_msg(N("Reset aborted (RPM DB is locked by another process)"), 1); + return; + } + $urpm->disable_selected( + $db, $urpm->{state}, + map { if_($pkgs->{$_}{selected}, $pkgs->{$_}{pkg}) } keys %$pkgs, + ); + } + undef $pkgs->{$_}{selected} foreach keys %$pkgs; + reset_search(); + $size_selected = 0; + $force_displaying_group = 1; + my $tree_selection = $tree->get_selection; + $tree_selection->select_path(Gtk3::TreePath->new_from_string('0')) if !$tree_selection->get_selected; + $tree_selection->signal_emit('changed'); +} + sub show_about_dlg { my $license = formatAlaTeX(translate($::license)); $license =~ s/\n/\n\n/sg; # nicer formatting @@ -574,26 +596,7 @@ sub run_treeview_dialog { and $reload_db_and_clear_all->(); }, undef, '<Item>' ] ), - [ N("_File") . N("_Reset the selection"), undef, sub { - if ($MODE ne 'remove') { - my $db = eval { open_rpm_db() }; - if (!ref($db)) { - statusbar_msg(N("Reset aborted (RPM DB is locked by another process)"), 1); - return; - } - $urpm->disable_selected( - $db, $urpm->{state}, - map { if_($pkgs->{$_}{selected}, $pkgs->{$_}{pkg}) } keys %$pkgs, - ); - } - undef $pkgs->{$_}{selected} foreach keys %$pkgs; - reset_search(); - $size_selected = 0; - $force_displaying_group = 1; - my $tree_selection = $tree->get_selection; - $tree_selection->select_path(Gtk3::TreePath->new_from_string('0')) if !$tree_selection->get_selected; - $tree_selection->signal_emit('changed'); - }, undef, '<Item>' ], + [ N("_File") . N("_Reset the selection"), undef, sub { reset_selection($tree) }, undef, '<Item>' ], [ N("_File") . N("Reload the _packages list"), undef, $reload_db_and_clear_all, undef, '<Item>' ], [ N("_File") . N("_Quit"), N("<control>Q"), \&quit, undef, '<Item>', ], #[ N("_View"), undef, undef, undef, '<Branch>' ], |