aboutsummaryrefslogtreecommitdiffstats
path: root/edit-urpm-sources.pl
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-12-17 17:46:45 +0000
committerRafael Garcia-Suarez <rgarciasuarez@mandriva.org>2004-12-17 17:46:45 +0000
commit25114a8e380b2c7e9d03476c1a8a0310f772a533 (patch)
tree46281c32b3bf49df4cf350204eeca7ac478d1454 /edit-urpm-sources.pl
parent9ce2357d0c4168740ba9f68da3652e6df3e22f43 (diff)
downloadrpmdrake-25114a8e380b2c7e9d03476c1a8a0310f772a533.tar
rpmdrake-25114a8e380b2c7e9d03476c1a8a0310f772a533.tar.gz
rpmdrake-25114a8e380b2c7e9d03476c1a8a0310f772a533.tar.bz2
rpmdrake-25114a8e380b2c7e9d03476c1a8a0310f772a533.tar.xz
rpmdrake-25114a8e380b2c7e9d03476c1a8a0310f772a533.zip
Add the ability to reorder the media in the software media manager
Diffstat (limited to 'edit-urpm-sources.pl')
-rwxr-xr-xedit-urpm-sources.pl30
1 files changed, 28 insertions, 2 deletions
diff --git a/edit-urpm-sources.pl b/edit-urpm-sources.pl
index 42c04ec0..38355f67 100755
--- a/edit-urpm-sources.pl
+++ b/edit-urpm-sources.pl
@@ -303,6 +303,29 @@ sub remove_callback {
remove_wait_msg($wait);
}
+sub renum_media ($$$) {
+ my ($model, @iters) = @_;
+ my @rows = map { $model->get_path($_)->to_string } @iters;
+ my @media = map { $urpm->{media}[$_] } @rows;
+ $urpm->{media}[$rows[$_]] = $media[1 - $_] foreach 0, 1;
+ my $i = 1;
+ $_->{priority} = $i++ foreach @{$urpm->{media}};
+ $model->swap(@iters);
+ $urpm->write_config; $urpm = urpm->new; $urpm->read_config;
+}
+
+sub upwards_callback {
+ my ($model, $iter) = $list_tv->get_selection->get_selected; $model && $iter or return;
+ my $prev = $model->get_iter_from_string($model->get_path($iter)->to_string - 1);
+ defined $prev and renum_media($model, $iter, $prev);
+}
+
+sub downwards_callback {
+ my ($model, $iter) = $list_tv->get_selection->get_selected; $model && $iter or return;
+ my $next = $model->iter_next($iter);
+ defined $next and renum_media($model, $iter, $next);
+}
+
#- returns the name of the media for which edition failed, or undef on success
sub edit_callback {
my $row = selrow();
@@ -783,7 +806,6 @@ sub keys_callback {
$w->main;
}
-
sub mainwindow {
$mainw = ugtk2->new(N("Configure media"), center => 1);
@@ -913,6 +935,11 @@ sub mainwindow {
gtksignal_connect(Gtk2::Button->new(but(N("Proxy..."))), clicked => \&proxy_callback),
gtksignal_connect(Gtk2::Button->new(but(N("Parallel..."))), clicked => \&parallel_callback),
gtksignal_connect(Gtk2::Button->new(but(N("Global options..."))), clicked => \&options_callback),
+ gtkpack(
+ Gtk2::HBox->new(0, 0),
+ gtksignal_connect(gtkadd(Gtk2::Button->new, Gtk2::Arrow->new("up", "none")), clicked => \&upwards_callback),
+ gtksignal_connect(gtkadd(Gtk2::Button->new, Gtk2::Arrow->new("down", "none")), clicked => \&downwards_callback),
+ ),
)
),
0, Gtk2::HSeparator->new,
@@ -933,7 +960,6 @@ sub mainwindow {
$mainw->main;
}
-
readconf();
if (!member(basename($0), @$already_splashed)) {