diff options
-rwxr-xr-x | perl-install/standalone/drakconnect | 254 |
1 files changed, 127 insertions, 127 deletions
diff --git a/perl-install/standalone/drakconnect b/perl-install/standalone/drakconnect index f1e878be8..b1641b8aa 100755 --- a/perl-install/standalone/drakconnect +++ b/perl-install/standalone/drakconnect @@ -211,7 +211,7 @@ sub manage { foreach (keys %$intf) { /^ippp/ and $p->{isdn} = { kind => $_ }; /^ppp0/ and $p->{modem} = { kind => $_ }; - }; + } $window->{rwindow}->add(gtkpack_(Gtk2::VBox->new, 0, gtkpack__(Gtk2::HBox->new, @@ -225,22 +225,22 @@ sub manage { ), 1, $notebook, 0, create_okcancel(my $oc = - { - cancel_clicked => sub { $window->destroy; Gtk2->main_quit }, - ok_clicked => sub { - if ($apply_button->get_property('sensitive')) { - save($netc, $p, $apply_button); - } - $window->destroy; - Gtk2->main_quit; - }, - }, - undef, undef, '', - [ N("Help"), sub { exec("drakhelp --id internet-connection") unless fork() } ], - [ N("Apply"), sub { save($netc, $p, $apply_button) }, 0, 1 ], - ), - ), - ); + { + cancel_clicked => sub { $window->destroy; Gtk2->main_quit }, + ok_clicked => sub { + if ($apply_button->get_property('sensitive')) { + save($netc, $p, $apply_button); + } + $window->destroy; + Gtk2->main_quit; + }, + }, + undef, undef, '', + [ N("Help"), sub { exec("drakhelp --id internet-connection") unless fork() } ], + [ N("Apply"), sub { save($netc, $p, $apply_button) }, 0, 1 ], + ), + ), + ); $apply_button = $oc->{buttons}{N("Apply")}; each_index { @@ -270,7 +270,7 @@ sub build_tree { $netc->{at_boot} = $intf->{ONBOOT} eq 'yes' ? 1 : 0; network::adsl::adsl_conf_backend($in, $intf, $netc, $interface_kind, $protocol) }; - } + } elsif ($interface eq 'modem') { $intf->{pages} = { 'TCP/IP' => 1, 'Account' => 1, 'Modem' => 1, 'Options' => 1 }; # FIXME: code duplication, should be in network::modem::read_config @@ -283,14 +283,14 @@ sub build_tree { ($intf->{dns1}, $intf->{dns2}) = split(',', $l{DNS}); $intf->{$_->[0]} = $l{$_->[1]} foreach [ 'connection' , 'Name' ], [ 'domain', 'Domain' ], [ 'login', 'Username' ], - [ 'Timeout', 'Timeout' ], [ 'UseLockFile', 'UseLockFile' ], [ 'Enter', 'Enter' ], - [ 'BusyWait', 'BusyWait' ], [ 'FlowControl', 'FlowControl' ], [ 'Speed', 'Speed' ], - [ 'DialTone', 'DialTone' ], [ 'Volume', 'Volume' ]; + [ 'Timeout', 'Timeout' ], [ 'UseLockFile', 'UseLockFile' ], [ 'Enter', 'Enter' ], + [ 'BusyWait', 'BusyWait' ], [ 'FlowControl', 'FlowControl' ], [ 'Speed', 'Speed' ], + [ 'DialTone', 'DialTone' ], [ 'Volume', 'Volume' ]; /.*ATDT(\d*)/ and $intf->{phone} = $1 foreach cat_("/etc/sysconfig/network-scripts/chat-ppp0"); /NAME=(['"]?)(.*)\1/ and $intf->{login} ||= $2 foreach cat_("/etc/sysconfig/network-scripts/ifcfg-ppp0"); $_->{login} eq $intf->{login} and $intf->{passwd} = $_->{passwd} foreach @{network::tools::read_secret_backend()}; $intf->{save} = sub { network::modem::ppp_configure($in, $intf) }; - } + } elsif ($interface eq 'isdn') { $intf->{pages} = { 'TCP/IP' => 1, 'Account' => 1, 'Modem' => 1, 'Options' => 1 }; network::isdn::isdn_read_config($intf); @@ -313,19 +313,19 @@ sub build_notebook { gtkadd(gtkcreate_frame(N("IP configuration")), gtkpack_(gtkset_border_width(Gtk2::VBox->new, 5), if_($is_ethernet, - 0, gtkpack__(Gtk2::HBox->new, - $gui->{intf}{BOOTPROTO} = gtksignal_connect(Gtk2::OptionMenu->new, - changed => sub { - return if !$_[0]->realized; - my $proto = $gui->{intf}{BOOTPROTO}; - my $protocol = $intf->{BOOTPROTO} = { reverse %{$proto->{protocols}} }->{$proto->get_text}; - - foreach ($gui->{intf}{IPADDR}, $gui->{intf}{NETMASK}, $gui->{netc}{GATEWAY}) { - $_->set_sensitive($protocol eq "static" ? 1 : 0) - }; $apply->() }, - ), - ), - ), + 0, gtkpack__(Gtk2::HBox->new, + $gui->{intf}{BOOTPROTO} = gtksignal_connect(Gtk2::OptionMenu->new, + changed => sub { + return if !$_[0]->realized; + my $proto = $gui->{intf}{BOOTPROTO}; + my $protocol = $intf->{BOOTPROTO} = { reverse %{$proto->{protocols}} }->{$proto->get_text}; + + foreach ($gui->{intf}{IPADDR}, $gui->{intf}{NETMASK}, $gui->{netc}{GATEWAY}) { + $_->set_sensitive($protocol eq "static" ? 1 : 0) + }; $apply->() }, + ), + ), + ), 0, gtkpack(Gtk2::VBox->new(1,0), gtkpack__(Gtk2::HBox->new, Gtk2::Label->new(N("IP address"))), gtkpack__(Gtk2::HBox->new, gtksignal_connect($gui->{intf}{IPADDR} = Gtk2::Entry->new, @@ -337,12 +337,12 @@ sub build_notebook { key_press_event => $apply)), ), if_($is_ethernet, - 0, gtkpack(Gtk2::VBox->new(1,0), - gtkpack__(Gtk2::HBox->new, Gtk2::Label->new(N("Gateway"))), - gtkpack__(Gtk2::HBox->new, gtksignal_connect($gui->{netc}{GATEWAY} = Gtk2::Entry->new, - key_press_event => $apply)), - ), - ), + 0, gtkpack(Gtk2::VBox->new(1,0), + gtkpack__(Gtk2::HBox->new, Gtk2::Label->new(N("Gateway"))), + gtkpack__(Gtk2::HBox->new, gtksignal_connect($gui->{netc}{GATEWAY} = Gtk2::Entry->new, + key_press_event => $apply)), + ), + ), ), ), gtkpack_(Gtk2::VBox->new, @@ -359,13 +359,13 @@ sub build_notebook { ); if ($is_ethernet) { - my $proto = $gui->{intf}{BOOTPROTO}; - $proto->{protocols} = { static => N("static"), dhcp => N("DHCP") }; - $proto->set_popdown_strings(@{$proto->{protocols}}{qw(dhcp static)}); - $proto->set_text($proto->{protocols}{$intf->{BOOTPROTO}}); - foreach ($gui->{intf}{IPADDR}, $gui->{intf}{NETMASK}, $gui->{netc}{GATEWAY}) { - $_->set_sensitive($intf->{BOOTPROTO} eq 'static' ? 1 : 0) - }; + my $proto = $gui->{intf}{BOOTPROTO}; + $proto->{protocols} = { static => N("static"), dhcp => N("DHCP") }; + $proto->set_popdown_strings(@{$proto->{protocols}}{qw(dhcp static)}); + $proto->set_text($proto->{protocols}{$intf->{BOOTPROTO}}); + foreach ($gui->{intf}{IPADDR}, $gui->{intf}{NETMASK}, $gui->{netc}{GATEWAY}) { + $_->set_sensitive($intf->{BOOTPROTO} eq 'static' ? 1 : 0) + }; } else { $_->set_sensitive(0) foreach $gui->{intf}{IPADDR}, $gui->{intf}{NETMASK}; delete $gui->{intf}{BOOTPROTO}; @@ -414,30 +414,30 @@ sub build_notebook { $gui->{intf_bool}{ONBOOT} = gtksignal_connect(Gtk2::CheckButton->new(N("Start at boot")), toggled => $apply), if_($is_ethernet, - map { ($gui->{intf_bool}{$_->[0]} = gtksignal_connect(Gtk2::CheckButton->new($_->[1]), - toggled => $apply)) - } ([ "HWADDR", N("Track network card id (useful for laptops)") ], - [ "MII_NOT_SUPPORTED", N("Network Hotplugging") ], - ), - ), + map { ($gui->{intf_bool}{$_->[0]} = gtksignal_connect(Gtk2::CheckButton->new($_->[1]), + toggled => $apply)) + } ([ "HWADDR", N("Track network card id (useful for laptops)") ], + [ "MII_NOT_SUPPORTED", N("Network Hotplugging") ], + ), + ), if_($interface eq 'isdn', - gtkpack(Gtk2::HBox->new(0,0), - gtkpack__(new Gtk2::VBox(0,0), - Gtk2::Label->new(N("Dialing mode")), - my @dialing_mode_radio = gtkradio(("auto") x 2, "manual"), - ), - Gtk2::VSeparator->new, - gtkpack__(new Gtk2::VBox(0,0), - Gtk2::Label->new(N("Connection speed")), - my @speed_radio = gtkradio(("64 Kb/s") x 2, "128 Kb/s"), - ), - ), - gtkpack_(Gtk2::HBox->new(0,0), - 0, Gtk2::Label->new(N("Connection timeout (in sec)")), - 1, gtksignal_connect($gui->{intf}{huptimeout} = Gtk2::Entry->new, - key_press_event => $apply), - ), - ), + gtkpack(Gtk2::HBox->new(0,0), + gtkpack__(new Gtk2::VBox(0,0), + Gtk2::Label->new(N("Dialing mode")), + my @dialing_mode_radio = gtkradio(("auto") x 2, "manual"), + ), + Gtk2::VSeparator->new, + gtkpack__(new Gtk2::VBox(0,0), + Gtk2::Label->new(N("Connection speed")), + my @speed_radio = gtkradio(("64 Kb/s") x 2, "128 Kb/s"), + ), + ), + gtkpack_(Gtk2::HBox->new(0,0), + 0, Gtk2::Label->new(N("Connection timeout (in sec)")), + 1, gtksignal_connect($gui->{intf}{huptimeout} = Gtk2::Entry->new, + key_press_event => $apply), + ), + ), )); $dialing_mode_radio[0]->signal_connect(toggled => sub { $gui->{intf_radio}{dialing_mode} = 'auto'; $apply->() }); $dialing_mode_radio[1]->signal_connect(toggled => sub { $gui->{intf_radio}{dialing_mode} = 'static'; $apply->() }); @@ -454,7 +454,7 @@ sub build_notebook { } gtkpack_(gtkset_border_width($gui->{sheet}{Account} = Gtk2::VBox->new, 5), if_($interface eq 'modem', - 0, gtkpack(Gtk2::VBox->new(1,0), + 0, gtkpack(Gtk2::VBox->new(1,0), gtkpack__(Gtk2::HBox->new, Gtk2::Label->new(N("Authentication"))), gtkpack__(Gtk2::HBox->new, $gui->{intf}{auth} = gtksignal_connect(Gtk2::OptionMenu->new, changed => $apply)), @@ -480,65 +480,65 @@ sub build_notebook { if ($intf->{pages}{Modem}) { gtkpack(gtkset_border_width($gui->{sheet}{Modem} = Gtk2::HBox->new(0,0), 5), if_($interface eq 'modem', - gtkpack__(Gtk2::VBox->new(0,5), - (map { (gtkpack(Gtk2::VBox->new(1,0), + gtkpack__(Gtk2::VBox->new(0,5), + (map { (gtkpack(Gtk2::VBox->new(1,0), gtkpack__(Gtk2::HBox->new, Gtk2::Label->new($_->[0])), gtkpack__(Gtk2::HBox->new, $gui->{intf}{$_->[1]} = gtksignal_connect(Gtk2::OptionMenu->new, changed => $apply)), ), - ), - } ([ N("Flow control"), 'FlowControl' ], - [ N("Line termination"), 'Enter' ], - [ N("Connection speed"), 'Speed' ], - )), - # gtkpack(Gtk2::VBox->new(0,0), # no relative kppp option found :-( - # Gtk2::Label->new(N("Dialing mode")), - # gtkradio('', N("Tone dialing"), N("Pulse dialing")), - # ), - ), - Gtk2::VSeparator->new, - gtkpack__(new Gtk2::VBox(0,10), - gtkpack__(Gtk2::HBox->new(0,5), - Gtk2::Label->new(N("Modem timeout")), - $gui->{intf}{Timeout} = gtksignal_connect(Gtk2::SpinButton->new(Gtk2::Adjustment->new($intf->{Timeout}, 0, 120, 1, 5, 0), 0, 0), - value_changed => $apply), - ), - gtksignal_connect($gui->{intf_bool}{UseLockFile} = Gtk2::CheckButton->new(N("Use lock file")), - toggled => $apply), - gtkpack__(Gtk2::HBox->new, gtksignal_connect($gui->{intf_bool}{WaitForDialTone} = Gtk2::CheckButton->new(N("Wait for dialup tone before dialing")), - toggled => $apply)), - gtkpack__(Gtk2::HBox->new(0,5), - Gtk2::Label->new(N("Busy wait")), - $gui->{intf}{BusyWait} = gtksignal_connect(Gtk2::SpinButton->new(Gtk2::Adjustment->new($intf->{BusyWait}, 0, 120, 1, 5, 0), 0, 0), - value_changed => $apply), - ), - gtkpack__(Gtk2::HBox->new(0,5), - Gtk2::Label->new(N("Modem sound")), - gtkpack__(Gtk2::VBox->new(0,5), my @volume_radio = gtkradio('', N("Enable"), N("Disable"))), ), - ), - ), + } ([ N("Flow control"), 'FlowControl' ], + [ N("Line termination"), 'Enter' ], + [ N("Connection speed"), 'Speed' ], + )), + # gtkpack(Gtk2::VBox->new(0,0), # no relative kppp option found :-( + # Gtk2::Label->new(N("Dialing mode")), + # gtkradio('', N("Tone dialing"), N("Pulse dialing")), + # ), + ), + Gtk2::VSeparator->new, + gtkpack__(new Gtk2::VBox(0,10), + gtkpack__(Gtk2::HBox->new(0,5), + Gtk2::Label->new(N("Modem timeout")), + $gui->{intf}{Timeout} = gtksignal_connect(Gtk2::SpinButton->new(Gtk2::Adjustment->new($intf->{Timeout}, 0, 120, 1, 5, 0), 0, 0), + value_changed => $apply), + ), + gtksignal_connect($gui->{intf_bool}{UseLockFile} = Gtk2::CheckButton->new(N("Use lock file")), + toggled => $apply), + gtkpack__(Gtk2::HBox->new, gtksignal_connect($gui->{intf_bool}{WaitForDialTone} = Gtk2::CheckButton->new(N("Wait for dialup tone before dialing")), + toggled => $apply)), + gtkpack__(Gtk2::HBox->new(0,5), + Gtk2::Label->new(N("Busy wait")), + $gui->{intf}{BusyWait} = gtksignal_connect(Gtk2::SpinButton->new(Gtk2::Adjustment->new($intf->{BusyWait}, 0, 120, 1, 5, 0), 0, 0), + value_changed => $apply), + ), + gtkpack__(Gtk2::HBox->new(0,5), + Gtk2::Label->new(N("Modem sound")), + gtkpack__(Gtk2::VBox->new(0,5), my @volume_radio = gtkradio('', N("Enable"), N("Disable"))), + ), + ), + ), if_($interface eq 'isdn', - gtkpack_(Gtk2::VBox->new(0,0), - map { (0, gtkpack(Gtk2::VBox->new(1,0), + gtkpack_(Gtk2::VBox->new(0,0), + map { (0, gtkpack(Gtk2::VBox->new(1,0), gtkpack__(Gtk2::HBox->new, Gtk2::Label->new($_->[0])), gtkpack__(Gtk2::HBox->new, $gui->{intf}{$_->[1]} = gtksignal_connect(Gtk2::Entry->new, - key_press_event => $apply)), + key_press_event => $apply)), ), - ); - } ([ N("Card IRQ"), 'irq' ], - [ N("Card mem (DMA)"), 'mem' ], - [ N("Card IO"), 'io' ], - [ N("Card IO_0"), 'io0' ], - ), - ), - Gtk2::VSeparator->new, - gtkpack__(new Gtk2::VBox(0,0), - Gtk2::Label->new(N("Protocol")), - my @protocol_radio = gtkradio('', N("European protocol (EDSS1)"), - N("Protocol for the rest of the world\nNo D-Channel (leased lines)")), - ), - ), + ); + } ([ N("Card IRQ"), 'irq' ], + [ N("Card mem (DMA)"), 'mem' ], + [ N("Card IO"), 'io' ], + [ N("Card IO_0"), 'io0' ], + ), + ), + Gtk2::VSeparator->new, + gtkpack__(new Gtk2::VBox(0,0), + Gtk2::Label->new(N("Protocol")), + my @protocol_radio = gtkradio('', N("European protocol (EDSS1)"), + N("Protocol for the rest of the world\nNo D-Channel (leased lines)")), + ), + ), ); $protocol_radio[0]->signal_connect(toggled => sub { $gui->{intf_radio}{protocol} = 2; $apply->() }); $protocol_radio[1]->signal_connect(toggled => sub { $gui->{intf_radio}{protocol} = 3; $apply->() }); @@ -553,10 +553,10 @@ sub build_notebook { my ($info) = $gui->{description} ? find { $_->{description} eq $gui->{description} } detect_devices::probeall : network::ethernet::mapIntfToDevice($interface_kind); if (is_empty_hash_ref($info) and my @intfs = grep { $interface_kind eq $_->[0] } @all_cards) { - my $driver; - if ($#intfs == 0 and $driver = $intfs[0][1] and my @cards = grep { $_->{driver} eq $driver } detect_devices::probeall()) { - $info = $cards[0] if $#cards == 0; - } + my $driver; + if ($#intfs == 0 and $driver = $intfs[0][1] and my @cards = grep { $_->{driver} eq $driver } detect_devices::probeall()) { + $info = $cards[0] if $#cards == 0; + } } gtkpack($gui->{sheet}{Information} = Gtk2::VBox->new(0,0), @@ -618,7 +618,7 @@ sub save_notebook { check_field($intf, 'IPADDR', 'NETMASK') or $in->ask_warn(N("Error"), N("IP address should be in format 1.2.3.4")) and return 0; } if ($netc->{GATEWAY}) { - check_field($netc, 'GATEWAY') or $in->ask_warn(N("Error"), N("Gateway address should be in format 1.2.3.4")) and return 0; + check_field($netc, 'GATEWAY') or $in->ask_warn(N("Error"), N("Gateway address should be in format 1.2.3.4")) and return 0; } 1; } |