summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--gurpmi24
-rwxr-xr-xgurpmi210
2 files changed, 16 insertions, 18 deletions
diff --git a/gurpmi b/gurpmi
index 97dcc166..3d42b780 100644
--- a/gurpmi
+++ b/gurpmi
@@ -134,7 +134,13 @@ Proceed?", join "\n", @all_rpms)
my $save_button = @all_rpms == 1 ? Gtk2::Button->new(but N("_Save")) : undef;
my $ccel_button = Gtk2::Button->new(but N("_Cancel"));
- $inst_button->signal_connect(clicked => \&do_install);
+ $inst_button->signal_connect(clicked => sub {
+ #- performs installation.
+ 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;
+ });
$save_button and $save_button->signal_connect(clicked => sub {
my $file_dialog = Gtk2::FileSelection->new(N("Choose location to save file"));
$file_dialog->set_modal(1);
@@ -142,10 +148,10 @@ Proceed?", join "\n", @all_rpms)
$file_dialog->set_filename($rpms->[0]); #- TODO must work for srpms too
$file_dialog->hide_fileop_buttons;
$file_dialog->ok_button->signal_connect(clicked => sub {
- my $location = $file_dialog->get_filename;
- quit;
- $location and exec '/bin/mv', '-f', $rpms->[0], $location;
- });
+ my $location = $file_dialog->get_filename;
+ quit;
+ $location and exec '/bin/mv', '-f', $rpms->[0], $location;
+ });
$file_dialog->cancel_button->signal_connect(clicked => \&quit);
$file_dialog->show;
});
@@ -155,11 +161,3 @@ Proceed?", join "\n", @all_rpms)
$mainw->show_all;
Gtk2->main;
-
-#- Performs installation.
-sub do_install {
- 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;
-}
diff --git a/gurpmi2 b/gurpmi2
index 876cab7e..e3a06504 100755
--- a/gurpmi2
+++ b/gurpmi2
@@ -67,7 +67,7 @@ sub add_button_box {
$_->set_alignment(0.5, 0.5), $hbox->add($_) foreach @buttons;
}
-sub sync {
+sub sync () {
$mainw->show;
Gtk2->main_iteration while Gtk2->events_pending;
}
@@ -102,7 +102,7 @@ sub wait_label {
my (@all_rpms);
foreach (@ARGV) {
if (/^-/) {
- /^--?[hv?]/ and usage;
+ /^--?[hv?]/ and usage();
fatal N("Unknown option %s", $_);
}
push @all_rpms, $_;
@@ -149,7 +149,7 @@ $mainw->show_all;
Gtk2->main;
#- Creates and configure an urpm object for this application to use.
-sub configure_urpm {
+sub configure_urpm () {
my $urpm = new urpm;
$urpm->{fatal} = sub {
Gtk2::MessageDialog->new($mainw, [qw(modal destroy-with-parent)], 'error', 'ok', $_[1])->run;
@@ -231,7 +231,7 @@ sub do_install {
: goto &do_install_2;
}
-sub do_install_2 {
+sub do_install_2 () {
my @to_install;
foreach my $pkg (sort { $a->name cmp $b->name } @{$urpm->{depslist}}[keys %{$state->{selected}}]) {
$pkg->arch ne 'src' and push @to_install, scalar $pkg->fullname;
@@ -245,7 +245,7 @@ sub do_install_2 {
: goto \&do_install_3;
}
-sub do_install_3 {
+sub do_install_3 () {
wait_label(N("Package installation..."));
my ($local_sources, $list) = $urpm->get_source_packages($state->{selected});
$local_sources || $list or $urpm->{fatal}(3, N("unable to get source packages, aborting"));