summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone/drakclock
diff options
context:
space:
mode:
authorThierry Vignaud <tvignaud@mandriva.org>2003-12-22 14:55:06 +0000
committerThierry Vignaud <tvignaud@mandriva.org>2003-12-22 14:55:06 +0000
commit9be1ade1b32d200dde18c35796d9bd18f72f46c8 (patch)
tree535bd3453bd182a8af645cc291809f86867fc044 /perl-install/standalone/drakclock
parentad119c13ec7a9018ec0c13c96b6f2ff5ded22ee5 (diff)
downloaddrakx-9be1ade1b32d200dde18c35796d9bd18f72f46c8.tar
drakx-9be1ade1b32d200dde18c35796d9bd18f72f46c8.tar.gz
drakx-9be1ade1b32d200dde18c35796d9bd18f72f46c8.tar.bz2
drakx-9be1ade1b32d200dde18c35796d9bd18f72f46c8.tar.xz
drakx-9be1ade1b32d200dde18c35796d9bd18f72f46c8.zip
clean that crappy code
Diffstat (limited to 'perl-install/standalone/drakclock')
-rwxr-xr-xperl-install/standalone/drakclock33
1 files changed, 10 insertions, 23 deletions
diff --git a/perl-install/standalone/drakclock b/perl-install/standalone/drakclock
index eb581fcbe..1b52328d4 100755
--- a/perl-install/standalone/drakclock
+++ b/perl-install/standalone/drakclock
@@ -186,38 +186,25 @@ $my_win->main;
ugtk2->exit(0);
sub ntp_widget_state {
- my $state = shift;
+ my ($state) = @_;
$check_ntp->set_active($state);
$hb_ntp->set_sensitive($state);
$mode = $state;
}
sub install_ntp() {
- my $w = ugtk2->new("Want to install ntp ?", grab => 1, center => 1, if_(!$::isEmbedded, transient => $my_win->{rwindow}));
- gtkadd($w->{window},
- gtkpack__(Gtk2::VBox->new(0,5),
- Gtk2::Label->new(N("We need to install ntp package\n to enable Network Time Protocol")),
- Gtk2::HSeparator->new,
- gtkpack(create_hbox(),
- gtksignal_connect(Gtk2::Button->new(N("Yes")), clicked => sub {
- Gtk2->main_quit;
- $in->do_pkgs->install('ntp');
- }),
- gtksignal_connect(Gtk2::Button->new(N("No")), clicked => sub {
- Gtk2->main_quit;
- ntp_widget_state(0);
- }))));
$my_win->{window}->set_sensitive(0);
- $w->main;
+ if (warn_dialog(N("Warning"), N("We need to install ntp package\n to enable Network Time Protocol
+
+Do you want to install ntp ?"))) {
+ $in->do_pkgs->install('ntp');
+ } else {
+ ntp_widget_state(0);
+ }
$my_win->{window}->set_sensitive(1);
}
sub get_server() {
- my ($servs, @sv);
- $servs = timezone::ntp_servers();
- foreach my $l (keys %$servs) {
- my $c = $l . " (" . $servs->{$l} . ")";
- push(@sv, $c);
- }
- \@sv
+ my $servs = timezone::ntp_servers();
+ [ map { "$_ ($servs->{$_})" } keys %$servs ]
}
sub update_time() {
Repaint($drawing_area, 1);
he configuration?") . ($bad_card ? "\n" . N("Warning: testing this graphic card may freeze your computer") : ''), !$bad_card) or return 1; } unlink "$::prefix/tmp/.X9-lock"; #- create a link from the non-prefixed /tmp/.X11-unix/X9 to the prefixed one #- that way, you can talk to :9 without doing a chroot #- but take care of non X11 install :-) if (-d "/tmp/.X11-unix") { symlinkf "$::prefix/tmp/.X11-unix/X9", "/tmp/.X11-unix/X9" if $::prefix; } else { symlinkf "$::prefix/tmp/.X11-unix", "/tmp/.X11-unix" if $::prefix; } #- ensure xfs is running fuzzy_pidofs(qr/\bxfs\b/) or do { run_program::rooted($::prefix, "/etc/rc.d/init.d/xfs", $_) foreach 'stop', 'start' }; fuzzy_pidofs(qr/\bxfs\b/) or die "xfs is not running"; my $f = $::testing ? $tmpconfig : "/etc/X11/XF86Config.test"; $raw_X->{Xconfig::card::using_xf4($card) ? 'xfree4' : 'xfree3'}->write("$::prefix/$f"); $ENV{HOME} || $::isInstall or die q($HOME is unset, so I don't know where to put my temporary files); my $f_err = "$::prefix$ENV{HOME}/tmp/.drakx.Xoutput"; my $pid; unless ($pid = fork) { system("xauth add :9 . `mcookie`"); open STDERR, ">$f_err"; chroot $::prefix if $::prefix; exec $card->{prog}, if_($card->{prog} !~ /Xsun/, "-xf86config", $f), ":9" or c::_exit(0); } do { sleep 1 } until xtest(":9") || waitpid($pid, c::WNOHANG()); my $b = before_leaving { unlink $f_err }; if (!xtest(":9")) { local *F; open F, $f_err; local $_; i: while (<F>) { if (Xconfig::card::using_xf4($card)) { if (/^\(EE\)/ && !/Disabling/ || /^Fatal\b/) { my @msg = !/error/ && $_; local $_; while (<F>) { /reporting a problem/ and last; push @msg, $_; $in->ask_warn('', [ N("An error occurred:"), " ", @msg, N("\ntry to change some parameters") ]); return 0; } } } else { if (/\b(error|not supported)\b/i) { my @msg = !/error/ && $_; local $_; while (<F>) { /not fatal/ and last i; /^$/ and last; push @msg, $_; } $in->ask_warn('', [ N("An error occurred:"), " ", @msg, N("\ntry to change some parameters") ]); return 0; } } } } $::noShadow = 1; local *F; open F, "|perl 2>/dev/null"; print F "use lib qw(", join(' ', @INC), ");\n"; print F q( BEGIN { $::no_ugtk_init = 1 } require lang; require my_gtk; my_gtk->import(qw(:wrappers)); #- help perl_checker use interactive::gtk; use run_program; $::prefix = ") . $::prefix . q("; $::isStandalone = 1; lang::bindtextdomain(); $ENV{DISPLAY} = ":9"; gtkset_background(200 * 257, 210 * 257, 210 * 257); my ($h, $w) = Gtk::Gdk::Window->new_foreign(Gtk::Gdk->ROOT_WINDOW)->get_size; $my_gtk::force_position = [ $w / 3, $h / 2.4 ]; $my_gtk::force_focus = 1; my $text = Gtk::Label->new; my $time = 12; Gtk->timeout_add(1000, sub { $text->set(N("Leaving in %d seconds", $time)); $time-- or Gtk->main_quit; 1; }); my $background = "/usr/share/mdk/xfdrake/xfdrake-test-card.jpg"; my $qiv = "/usr/bin/qiv"; run_program::rooted($::prefix, $qiv, "-y", $background) if -r "$::prefix/$background" && -x "$::prefix/$qiv"; my $in = interactive::gtk->new; $in->exit($in->ask_yesorno('', [ N("Is this the correct setting?"), $text ], 0) ? 0 : 222); ); my $rc = close F; my $err = $?; $rc || $err == 222 << 8 or $in->ask_warn('', N("An error occurred, try to change some parameters")); unlink "$::prefix/$f", "$::prefix/$f-4"; unlink "/tmp/.X11-unix/X9" if $::prefix; kill 2, $pid; $::noShadow = 0; $rc; }