aboutsummaryrefslogtreecommitdiffstats
path: root/Rpmdrake/edit_urpm_sources.pm
diff options
context:
space:
mode:
authorThierry Vignaud <tv@mandriva.org>2007-03-01 15:45:45 +0000
committerThierry Vignaud <tv@mandriva.org>2007-03-01 15:45:45 +0000
commit67025e7bfe767d0943245f4395666af296b3bf74 (patch)
tree4aa7f26fc3af14e201acf9ecdc50c34f221b7b50 /Rpmdrake/edit_urpm_sources.pm
parentcd4e323f435cb0da5de5cef6510db97f0cfe1532 (diff)
downloadrpmdrake-67025e7bfe767d0943245f4395666af296b3bf74.tar
rpmdrake-67025e7bfe767d0943245f4395666af296b3bf74.tar.gz
rpmdrake-67025e7bfe767d0943245f4395666af296b3bf74.tar.bz2
rpmdrake-67025e7bfe767d0943245f4395666af296b3bf74.tar.xz
rpmdrake-67025e7bfe767d0943245f4395666af296b3bf74.zip
adapt to multiple selection: disable "edit" button if there's more than one selected row
Diffstat (limited to 'Rpmdrake/edit_urpm_sources.pm')
-rwxr-xr-xRpmdrake/edit_urpm_sources.pm14
1 files changed, 10 insertions, 4 deletions
diff --git a/Rpmdrake/edit_urpm_sources.pm b/Rpmdrake/edit_urpm_sources.pm
index 79319e77..e0c4fb7e 100755
--- a/Rpmdrake/edit_urpm_sources.pm
+++ b/Rpmdrake/edit_urpm_sources.pm
@@ -895,10 +895,16 @@ sub mainwindow() {
$list_tv->get_selection->set_mode('multiple');
my ($dw_button, $edit_button, $up_button, $update_button);
$list_tv->get_selection->signal_connect(changed => sub {
- my ($model, $iter) = $_[0]->get_selected;
- $_ and $_->set_sensitive(defined $iter) foreach $remove_button, $edit_button;
- return if !$iter;
- my $curr_path = $model->get_path($iter);
+ my ($selection) = @_;
+ my @rows = $selection->get_selected_rows;
+ my $model = $list;
+ # we can delete several medium at a time:
+ $remove_button and $remove_button->set_sensitive($#rows != -1);
+ # we can only edit/move one item at a time:
+ $_ and $_->set_sensitive($#rows == 0) foreach $up_button, $dw_button, $edit_button;
+ return if !$#rows == 0;
+
+ my $curr_path = $rows[0];
my $first_path = $model->get_path($model->get_iter_first);
$up_button->set_sensitive($first_path && $first_path->compare($curr_path));