summaryrefslogtreecommitdiffstats
path: root/perl-install/standalone
diff options
context:
space:
mode:
authordamien <damien@mandriva.com>2001-02-27 17:28:29 +0000
committerdamien <damien@mandriva.com>2001-02-27 17:28:29 +0000
commit27fabea9afc09d2dd98ebf8e86e39b820b403d8f (patch)
tree6ebc9791ee75e23dfe259ab2ecc990120cfba09f /perl-install/standalone
parentcc59e14aff4834fc1a8dd2ebff42f568cffb1dc9 (diff)
downloaddrakx-27fabea9afc09d2dd98ebf8e86e39b820b403d8f.tar
drakx-27fabea9afc09d2dd98ebf8e86e39b820b403d8f.tar.gz
drakx-27fabea9afc09d2dd98ebf8e86e39b820b403d8f.tar.bz2
drakx-27fabea9afc09d2dd98ebf8e86e39b820b403d8f.tar.xz
drakx-27fabea9afc09d2dd98ebf8e86e39b820b403d8f.zip
pop up a dialog to quit X when accepting configuration
Diffstat (limited to 'perl-install/standalone')
-rwxr-xr-xperl-install/standalone/draknet48
1 files changed, 47 insertions, 1 deletions
diff --git a/perl-install/standalone/draknet b/perl-install/standalone/draknet
index 2903dda79..0454f087e 100755
--- a/perl-install/standalone/draknet
+++ b/perl-install/standalone/draknet
@@ -259,6 +259,52 @@ $bbox1->add($button_wizard );
my $button_ok = new Gtk::Button "OK";
$button_ok->signal_connect ( clicked => sub {
apply();
+ my @window_managers = ('kdeinit: kwin', qw(gnome-session icewm wmaker kwm afterstep fvwm fvwm2 fvwm95 mwm twm enlightenment xfce blackbox sawfish));
+ my $wm;
+ foreach (@window_managers) { $wm=$_ if (`pidof "$_"` > 0) };
+ my $dialog = new Gtk::Dialog();
+ $dialog->set_position(1);
+ $dialog->vbox->set_border_width(10);
+ my $label = new Gtk::Label(_("
+Warning:
+Applying the changes while running may crash your X environnement.") .
+ ($wm ? _("
+If you continue, I will shut down your %s environnement", $wm) : ""));
+ $dialog->vbox->pack_start($label,1,1,20);
+ my $bbox_dialog = new Gtk::HButtonBox;
+ $dialog->action_area->add($bbox_dialog);
+ $bbox_dialog->set_layout(-end);
+ my $button_ok = new Gtk::Button "OK";
+ $button_ok->signal_connect ( clicked => sub {
+ $label->set("Please Wait... Applying the configuration");
+ Gtk->main_iteration while Gtk->events_pending;
+ system("$prefix/etc/rc.d/init.d/network $_") foreach "stop", "start";
+ unless(fork) {
+ local $_=$wm;
+ system("kwmcom logout") if /kwm/;
+ system("dcop kdesktop default logout") if /kwin/;
+ system("save-session --kill") if /gnome-session/;
+ system("killall -QUIT icewm") if /icewm/;
+ open STDIN, "</dev/zero";
+ open STDOUT, ">/dev/null";
+ open STDERR, ">&STDERR";
+ c::setsid();
+ exec qw(perl -e), q{
+ my $wm = shift;
+ for (my $nb = 30; $nb && `pidof "$wm"` > 0; $nb--) { sleep 1 }
+ system("killall X ; killall -15 xdm gdm kdm prefdm") unless `pidof "$wm"` > 0;
+ }, $_;
+ }
+ Gtk->main_quit();
+ kill TERM, $CCPID;
+ });
+ $bbox_dialog->add($button_ok );
+ my $button_cancel = new Gtk::Button "Cancel";
+ $button_cancel->signal_connect ( clicked => sub { Gtk->main_quit(); });
+ $bbox_dialog->add($button_cancel);
+ $dialog->show_all;
+ Gtk->main();
+ $dialog->destroy;
quit_global();
});
$bbox1->add($button_ok);
@@ -294,11 +340,11 @@ $in->exit(0);
sub apply {
+
$old_profile=$netcnx->{PROFILE} ? $netcnx->{PROFILE} : "default";
netconnect::save_conf('', $netcnx, $netc, $intf);
network::configureNetwork2($prefix, $netc, $intf, \&standalone::pkgs_install);
$netcnx->{type} =~ /adsl/ or system("/sbin/chkconfig --del adsl 2> /dev/null");
- system("$prefix/etc/rc.d/init.d/network $_") foreach "stop", "start";
$button_apply->set_sensitive(0);
}