aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-11-17 16:17:53 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-11-17 16:17:53 +0000
commitf1de580eee3adf2fefb9ee1d85471061024a0d7a (patch)
treeca3a5c7a7e55492a303c2262f8454b4585e58c35
parente50290ab293b7a6a1b60186ff79c34c7a5ac055a (diff)
downloadrpmdrake-f1de580eee3adf2fefb9ee1d85471061024a0d7a.tar
rpmdrake-f1de580eee3adf2fefb9ee1d85471061024a0d7a.tar.gz
rpmdrake-f1de580eee3adf2fefb9ee1d85471061024a0d7a.tar.bz2
rpmdrake-f1de580eee3adf2fefb9ee1d85471061024a0d7a.tar.xz
rpmdrake-f1de580eee3adf2fefb9ee1d85471061024a0d7a.zip
When modifying a media has failed, restore it (and don't keep it in the
intermediate state of being ignored)
-rwxr-xr-xedit-urpm-sources.pl22
1 files changed, 18 insertions, 4 deletions
diff --git a/edit-urpm-sources.pl b/edit-urpm-sources.pl
index 529befbc..11f772df 100755
--- a/edit-urpm-sources.pl
+++ b/edit-urpm-sources.pl
@@ -201,6 +201,7 @@ sub remove_callback {
remove_wait_msg($wait);
}
+#- returns the name of the media for which edition failed, or undef on success
sub edit_callback {
my $row = selrow();
$row == -1 and return;
@@ -253,9 +254,9 @@ sub edit_callback {
$urpm->select_media($name);
$urpm->remove_selected_media;
add_medium_and_check($urpm, { nolock => 1 }, $name, $url, $with_hdlist, update => $update);
- return 1;
+ return $name;
}
- return 0;
+ return undef;
}
sub update_callback {
@@ -693,9 +694,18 @@ sub mainwindow {
});
my $reread_media = sub {
+ my ($name) = @_;
$reorder_ok = 0;
$urpm = urpm->new;
$urpm->read_config;
+ if (defined $name) {
+ #- this media must be reconstructed since editing it failed
+ foreach (grep { $_->{name} eq $name } @{$urpm->{media}}) {
+ delete $_->{ignore};
+ }
+ $urpm->select_media($name);
+ $urpm->update_media(noclean => 1, nolock => 1);
+ }
$list->clear;
$list->append_set([ 0 => !$_->{ignore}, 1 => $_->{name} ]) foreach @{$urpm->{media}};
$reorder_ok = 1;
@@ -709,8 +719,12 @@ sub mainwindow {
0, gtkpack__(Gtk2::VBox->new(0, 5),
gtksignal_connect($remove = Gtk2::Button->new(but(N("Remove"))),
clicked => sub { remove_callback(); $reread_media->() }),
- gtksignal_connect($edit = Gtk2::Button->new(but(N("Edit"))),
- clicked => sub { edit_callback() and $reread_media->() }),
+ gtksignal_connect(
+ $edit = Gtk2::Button->new(but(N("Edit"))),
+ clicked => sub {
+ my $name = edit_callback(); defined $name and $reread_media->($name);
+ }
+ ),
gtksignal_connect(Gtk2::Button->new(but(N("Add..."))),
clicked => sub { add_callback() and $reread_media->() }),
gtksignal_connect(