aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xedit-urpm-sources.pl34
1 files changed, 34 insertions, 0 deletions
diff --git a/edit-urpm-sources.pl b/edit-urpm-sources.pl
index 38355f67..690402c8 100755
--- a/edit-urpm-sources.pl
+++ b/edit-urpm-sources.pl
@@ -26,6 +26,7 @@ use lib qw(/usr/lib/libDrakX);
use common;
use rpmdrake;
use URPM::Signature;
+use MDK::Common qw/max/;
BEGIN {
eval { require ugtk2; ugtk2->import(qw(:all)) };
@@ -59,6 +60,35 @@ sub remove_row {
$model->remove($iter);
}
+sub easy_add_callback {
+ my $m = choose_mirror(message =>
+N("This will attempt to install all official sources corresponding to your
+distribution (%s).
+
+I need to contact the Mandrakesoft website to get the mirror list.
+Please check that your network is currently running.
+
+Is it ok to continue?", $rpmdrake::mandrake_release)
+ ) or return 0;
+ my $wait = wait_msg(N("Please wait, adding media..."));
+ my $url = make_url_mirror_dist($m);
+ my $medium_name;
+ if ($rpmdrake::mandrake_release =~ /(\d+\.\d+) \((\w+)\)/) {
+ $medium_name = $2 . $1 . '-';
+ } else {
+ $medium_name = 'distrib';
+ }
+ #- ensure a unique medium name
+ my $initial_number = 1 + max map { $_->{name} =~ /\(\Q$medium_name\E(\d+)\b/ ? $1 : 0 } @{$urpm->{media}};
+ add_medium_and_check(
+ $urpm,
+ { nolock => 1, distrib => 1 },
+ $medium_name, $url, probe_with => 'synthesis', initial_number => $initial_number,
+ );
+ remove_wait_msg($wait);
+ return 1;
+}
+
sub add_callback {
my $w = ugtk2->new(N("Add a medium"), grab => 1, center => 1, transient => $mainw->{rwindow});
my %radios_infos = (local => { name => N("Local files"), url => N("Path:"), dirsel => 1 },
@@ -925,6 +955,10 @@ sub mainwindow {
),
gtksignal_connect(
Gtk2::Button->new(but(N("Add..."))),
+ clicked => sub { easy_add_callback() and $reread_media->() },
+ ),
+ gtksignal_connect(
+ Gtk2::Button->new(but(N("Add custom..."))),
clicked => sub { add_callback() and $reread_media->() },
),
gtksignal_connect(