summaryrefslogtreecommitdiffstats
path: root/gurpmi
diff options
context:
space:
mode:
Diffstat (limited to 'gurpmi')
-rw-r--r--gurpmi49
1 files changed, 10 insertions, 39 deletions
diff --git a/gurpmi b/gurpmi
index 3d42b780..56108041 100644
--- a/gurpmi
+++ b/gurpmi
@@ -10,42 +10,13 @@ BEGIN { #- set up a safe path and environment
delete @ENV{qw(ENV BASH_ENV IFS CDPATH)};
}
-#- This is needed because text printed by Gtk2 will always be encoded
-#- in UTF-8; we first check if LC_ALL is defined, because if it is,
-#- changing only LC_COLLATE will have no effect.
-use POSIX qw(setlocale LC_ALL LC_COLLATE);
-use locale;
-BEGIN {
- my $collation_locale = $ENV{LC_ALL};
- if ($collation_locale) {
- $collation_locale =~ /UTF-8/ or setlocale(LC_ALL, "$collation_locale.UTF-8");
- } else {
- $collation_locale = setlocale(LC_COLLATE);
- $collation_locale =~ /UTF-8/ or setlocale(LC_COLLATE, "$collation_locale.UTF-8");
- }
-}
-
-use urpm;
+use gurpmi;
use urpm::msg qw(N);
use Gtk2;
-use MDK::Common qw(partition);
-
-sub usage () {
- print STDERR <<USAGE;
-gurpmi version $urpm::VERSION
-Usage :
- gurpmi <rpm> [ <rpm>... ]
-USAGE
- exit 0;
-}
-
-#- fatal gurpmi initialisation error (*not* fatal urpmi errors)
-sub fatal { print STDERR "$_[0]\n"; exit 1 }
+use MDK::Common::Func qw(partition);
sub quit () { Gtk2->main_quit }
-sub but ($) { " $_[0] " }
-
#- globals
my (@all_rpms, $srpms, $rpms);
my ($mainw, $mainbox);
@@ -79,12 +50,12 @@ sub new_label {
#- Parse command line
foreach (@ARGV) {
if (/^-/) {
- /^--?[hv?]/ and usage;
- fatal N("Unknown option %s", $_);
+ /^--?[hv?]/ and gurpmi::usage();
+ gurpmi::fatal N("Unknown option %s", $_);
}
push @all_rpms, $_;
}
-@all_rpms or fatal N("No packages specified");
+@all_rpms or gurpmi::fatal N("No packages specified");
#- Now, the graphical stuff.
@@ -130,13 +101,13 @@ Proceed?", join "\n", @all_rpms)
}
{ #- buttons
- my $inst_button = Gtk2::Button->new(but N("_Install"));
- my $save_button = @all_rpms == 1 ? Gtk2::Button->new(but N("_Save")) : undef;
- my $ccel_button = Gtk2::Button->new(but N("_Cancel"));
+ my $inst_button = Gtk2::Button->new(gurpmi::but N("_Install"));
+ my $save_button = @all_rpms == 1 ? Gtk2::Button->new(gurpmi::but N("_Save")) : undef;
+ my $ccel_button = Gtk2::Button->new(gurpmi::but N("_Cancel"));
$inst_button->signal_connect(clicked => sub {
#- performs installation.
- quit;
+ quit();
#- we need to switch to root if we're not already (via consolehelper)
#- yes. hardcoded paths. safe.
exec $> ? '/usr/bin/gurpmi2' : '/usr/sbin/gurpmi2', @ARGV;
@@ -149,7 +120,7 @@ Proceed?", join "\n", @all_rpms)
$file_dialog->hide_fileop_buttons;
$file_dialog->ok_button->signal_connect(clicked => sub {
my $location = $file_dialog->get_filename;
- quit;
+ quit();
$location and exec '/bin/mv', '-f', $rpms->[0], $location;
});
$file_dialog->cancel_button->signal_connect(clicked => \&quit);