From 0130f5d402e27dc0c91390065aaba3baf6c5d151 Mon Sep 17 00:00:00 2001 From: Guillaume Cottenceau Date: Mon, 9 Feb 2004 18:14:39 +0000 Subject: gurpmi: handle case where user clicked on a src.rpm, suggest user is misleaded, allow to do nothing, really install, or save on disk --- urpmi | 32 +++++++++++++++++++++++++++++--- urpmi.spec | 6 +++++- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/urpmi b/urpmi index c2a0216b..88507f35 100755 --- a/urpmi +++ b/urpmi @@ -140,9 +140,10 @@ usage: sub to_utf8 { Locale::gettext::iconv($_[0], undef, "UTF-8") } sub gmessage { my ($msg, %params) = @_; - my $ok = to_utf8(N("Ok")); - my $cancel = to_utf8(N("Cancel")); - my $buttons = ($params{ok_only} ? "$ok:0" : "$ok:0,$cancel:2") . $params{add_buttons}; + my $ok = to_utf8($params{ok} || N("Ok")); + my $cancel = to_utf8($params{cancel} || N("Cancel")); + my $buttons = $params{ok_only} ? "$ok:0" : "$ok:0,$cancel:2"; + $params{add_buttons} and $buttons .= ",$params{add_buttons}"; $msg = to_utf8($msg); `gmessage -default "$ok" -buttons "$buttons" "$msg"`; } @@ -254,6 +255,31 @@ if ($install_src) { @names = (); } +if ($X && @src_files == 1 && @files == 0 && @names == 0 && @src_names == 0 && !$force) { + gmessage( +N("You have selected a source package: + +%s + +You probably didn't want to install it on your computer (installing it +would allow you to make modifications to its sourcecode then compile it). + +What would you like to do?", $src_files[0]), + ok => N("Do nothing"), + cancel => N("Yes\\, really install it"), + add_buttons => N("Save file") . ':1'); + my $rc = $? >> 8; + if ($rc == 0) { + exit(1); + } elsif ($rc == 1) { + my $msg = N("Choose location to save file"); + my $location = `gfilechooser "$msg"`; + if (!$? && $msg) { + exec 'mv', '-f', $src_files[0], $location; + } + } +} + #- question to describe what user who clicked on a rpm in file explorer is really doing if ($X && @files == 1 && @names == 0 && $verbose >= 0) { gmessage( diff --git a/urpmi.spec b/urpmi.spec index c9c5385c..f848423f 100644 --- a/urpmi.spec +++ b/urpmi.spec @@ -44,7 +44,7 @@ You can compare rpm vs. urpmi with insmod vs. modprobe %package -n gurpmi Summary: User mode rpm GUI install Group: %{group} -Requires: urpmi >= %{version}-%{release} drakxtools > 10-0.4mdk gchooser gmessage usermode menu +Requires: urpmi >= %{version}-%{release} drakxtools > 10-0.4mdk gtkdialogs >= 2.1 usermode menu Obsoletes: grpmi %description -n gurpmi @@ -236,11 +236,15 @@ $urpm->update_media(nolock => 1, nopubkey => 1); %{compat_perl_vendorlib}/urpm/parallel_ssh.pm %changelog + - fix bug #7472: progressbar forced to be thicker than default (gc) - gurpmi: when cancel button is destroyed forever from within rpmdrake (after all downloads completed) ask gtk to recompute size of toplevel window to not end up with an ugly void space (gc) - gurpmi: add application/x-urpmi mimetype (gc) +- gurpmi: handle case where user clicked on a src.rpm, suggest + user is misleaded, allow to do nothing, really install, or + save on disk (gc) * Tue Feb 3 2004 François Pons 4.4.5-3mdk - fixed bug of reference of ../ in hdlists file. -- cgit v1.2.1