summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xperl-install/standalone/draknet94
1 files changed, 85 insertions, 9 deletions
diff --git a/perl-install/standalone/draknet b/perl-install/standalone/draknet
index b4760edde..3d2e9a273 100755
--- a/perl-install/standalone/draknet
+++ b/perl-install/standalone/draknet
@@ -20,7 +20,6 @@
use Data::Dumper;
use lib qw(/usr/lib/libDrakX);
-use lib qw(..);
use interactive;
use standalone;
@@ -71,6 +70,7 @@ $window1->signal_connect ( delete_event => sub { Gtk->exit(0); });
$window1->set_position(1);
$window1->set_title(_("Network configuration (%d adapters)", @all_cards));
$window1->border_width(10);
+$window1->set_usize(500, 400);
my $vbox1 = new Gtk::VBox(0,0);
$window1->add($vbox1);
my $hbox1 = new Gtk::HBox(0,0);
@@ -82,6 +82,66 @@ my $old_profile=$netcnx->{PROFILE};
$combo1->entry->set_text($netcnx->{PROFILE} ? $netcnx->{PROFILE} : "default");
$combo1->entry->set_editable(0);
$hbox1->pack_start($combo1,0,0,0);
+my $button_del = new Gtk::Button(_("Del profile..."));
+$button_del->signal_connect( clicked => sub {
+ my $dialog = new Gtk::Dialog();
+ $dialog->set_position(1);
+ $dialog->vbox->set_border_width(10);
+ $dialog->vbox->pack_start(new Gtk::Label(_("Profile to delete:")),1,1,0);
+ my $combo_dialog = new Gtk::Combo;
+ $combo_dialog->set_popdown_strings ( grep { ! /default/ } netconnect::get_profiles() );
+ $combo_dialog->entry->set_editable(0);
+ $dialog->vbox->pack_start($combo_dialog,1,1,0);
+ 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 {
+ netconnect::del_profile('', $netcnx, $combo_dialog->entry->get_text());
+ $netcnx->{PROFILE} eq $combo_dialog->entry->get_text() and $netcnx->{PROFILE}="default";
+ Gtk->main_quit();
+ });
+ $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;
+ $combo1->entry->set_text((-e "/etc/sysconfig/network-scripts/draknet_conf." . $combo1->entry->get_text) ? $combo1->entry->get_text : "default");
+ $combo1->set_popdown_strings(netconnect::get_profiles());
+ apply();
+ });
+$hbox1->pack_start($button_del,0,0,5);
+$button_del->set_sensitive(netconnect::get_profiles() > 1);
+my $button_new = new Gtk::Button(_("New profile..."));
+$button_new->signal_connect( clicked => sub {
+ my $dialog = new Gtk::Dialog();
+ $dialog->set_position(1);
+ $dialog->vbox->set_border_width(10);
+ $dialog->vbox->pack_start(new Gtk::Label(_("Name of the profile to create:")),1,1,0);
+ my $entry_dialog = new Gtk::Entry;
+ $dialog->vbox->pack_start($entry_dialog,1,1,0);
+ 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 {
+ netconnect::add_profile('', $netcnx, $entry_dialog->get_text());
+ $netcnx->{PROFILE} = $entry_dialog->get_text();
+ Gtk->main_quit();
+ });
+ $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;
+ $combo1->entry->set_text((-e "/etc/sysconfig/network-scripts/draknet_conf." . $netcnx->{PROFILE}) ? $netcnx->{PROFILE} : "default");
+ $combo1->set_popdown_strings(netconnect::get_profiles());
+});
+$hbox1->pack_start($button_new,0,0,5);
my $hbox2 = new Gtk::HBox(0,0);
$vbox1->pack_start($hbox2,1,1,0);
$hbox2->pack_start(new Gtk::Label(_("Hostname: ")),0,0,0);
@@ -180,6 +240,7 @@ $vbox2->pack_start($hbox3, 0, 0, 0);
my $bbox1 = new Gtk::HButtonBox;
$vbox1->pack_start($bbox1,0,0,0);
$bbox1->set_layout(-end);
+$bbox1->set_border_width(5);
my $button_wizard = new Gtk::Button "Wizard...";
$button_wizard->signal_connect ( clicked => sub {
@@ -191,14 +252,16 @@ $button_wizard->signal_connect ( clicked => sub {
$bbox1->add($button_wizard );
my $button_ok = new Gtk::Button "OK";
$button_ok->signal_connect ( clicked => sub {
- $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";
+ apply();
quit_global();
-});
+ });
$bbox1->add($button_ok);
+my $button_apply = new Gtk::Button "Apply";
+$button_apply->signal_connect ( clicked => sub {
+ apply();
+ });
+$button_apply->set_sensitive(0);
+$bbox1->add($button_apply);
my $button_cancel = new Gtk::Button "Cancel";
$button_cancel->signal_connect ( clicked => sub {
$combo1->entry->set_text($old_profile);
@@ -212,6 +275,7 @@ $combo1->entry->signal_connect( 'changed', sub {
$netcnx->{$_}=$netc->{$_} foreach qw(NET_DEVICE NET_INTERFACE);
netconnect::set_net_conf('', $netcnx, $netc, $intf);
update();
+ $button_apply->set_sensitive(1);
});
$window1->show_all();
@@ -223,6 +287,15 @@ netconnect::intro('', $netcnx, $in, sub { $in->standalone::pkgs_install(@_) });
$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);
+}
+
sub update {
chop (my $h = `hostname`);
$label_host->set ($h);
@@ -235,6 +308,7 @@ sub update {
$clist1->set_selectable($_, 0);
}
$clist1->thaw();
+ $button_del->set_sensitive(netconnect::get_profiles() > 1);
}
sub quit_global {
@@ -310,6 +384,7 @@ sub configure_lan {
$i++;
}
update();
+ $button_apply->set_sensitive(1);
$window->destroy(); Gtk->main_quit;
});
$bbox1->add($button_ok);
@@ -350,8 +425,8 @@ sub configure_net {
$table1->attach(new Gtk::Label(_($netcnx->{PROFILE})), 1, 2, 0, 1, 'fill', 'fill',0,0);
$table1->attach(new Gtk::Label(_("Connection type: ")), 0, 1, 1, 2, 'fill', 'fill',0,0);
$table1->attach(new Gtk::Label(_($netcnx->{type})), 1, 2, 1, 2, 'fill', 'fill',0,0);
- my $button1 = new Gtk::Button(_("Reconfigure using wizard..."));
- $table1->attach($button1, 2, 4, 0, 2, 'fill', 'fill',0,0);
+# my $button1 = new Gtk::Button(_("Reconfigure using wizard..."));
+# $table1->attach($button1, 2, 4, 0, 2, 'fill', 'fill',0,0);
$vbox1->pack_start(new Gtk::HSeparator,0,0,5);
my $frame1 = new Gtk::Frame (_("Parameters"));
@@ -427,6 +502,7 @@ sub configure_net {
$i++;
}
update();
+ $button_apply->set_sensitive(1);
$window->destroy(); Gtk->main_quit;
});
$bbox1->add($button_ok);