From d076acea4a244bf2b4209920dc99916443502bdd Mon Sep 17 00:00:00 2001 From: Rafael Garcia-Suarez Date: Mon, 16 Aug 2004 01:58:52 +0000 Subject: Optionally use zenity instead of gchooser if found, it's much prettier --- urpm/msg.pm | 1 + urpmi | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/urpm/msg.pm b/urpm/msg.pm index 1957916f..308deda3 100644 --- a/urpm/msg.pm +++ b/urpm/msg.pm @@ -35,6 +35,7 @@ sub log_it { sub to_utf8 { Locale::gettext::iconv($_[0], undef, "UTF-8") } +#- this function returns a value via $?. this is evil; FIXME (and use zenity) sub gmessage { my ($msg, %params) = @_; my $ok = to_utf8($params{ok} || N("Ok")); diff --git a/urpmi b/urpmi index 37041910..11ebb69e 100755 --- a/urpmi +++ b/urpmi @@ -400,8 +400,14 @@ sub ask_choice { if (@l > 1 && !$urpm->{options}{auto}) { my $msg = N("One of the following packages is needed:"); if ($urpm::args::options{X}) { - system(qq(gchooser "$msg" @l)); - $n = $? >> 8 or die "\n"; + if (-x '/usr/bin/zenity') { + my $choice = qx(zenity --list --column=RPM --text="$msg" @l); + chomp $choice; + each_index { $_ eq $choice and $n = $::i } @l; + } else { + system(qq(gchooser "$msg" @l)); + $n = $? >> 8 or die "\n"; + } } else { message($msg); my $i = 0; foreach (@l) { message(" " . ++$i . "- $_") } -- cgit v1.2.1