diff options
author | Thierry Vignaud <thierry.vignaud@gmail.com> | 2013-11-25 02:34:54 +0100 |
---|---|---|
committer | Thierry Vignaud <thierry.vignaud@gmail.com> | 2013-12-05 14:16:07 +0100 |
commit | f8b6be73c7d664a5b3e87ce6e363f76a17788b79 (patch) | |
tree | 312a918e0909f866d8f92626e881755e9e71f9ed | |
parent | eba0f6447a998febdc1e7424b0c8434e8c32b272 (diff) | |
download | rpmdrake-f8b6be73c7d664a5b3e87ce6e363f76a17788b79.tar rpmdrake-f8b6be73c7d664a5b3e87ce6e363f76a17788b79.tar.gz rpmdrake-f8b6be73c7d664a5b3e87ce6e363f76a17788b79.tar.bz2 rpmdrake-f8b6be73c7d664a5b3e87ce6e363f76a17788b79.tar.xz rpmdrake-f8b6be73c7d664a5b3e87ce6e363f76a17788b79.zip |
(reset_selection) split it out
(needed for next commits)
-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>' ], |