diff options
author | Olivier Blin <oblin@mandriva.org> | 2005-09-15 15:28:39 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.org> | 2005-09-15 15:28:39 +0000 |
commit | f7e9316da3f6944adbc9f2f5ce83a3da9767cbf2 (patch) | |
tree | 37a6f46b07de573fe164432ad198ff16aa391ebf /perl-install/standalone/net_applet | |
parent | 1adffcebcf35045242243bd568d15a19e42e6a9b (diff) | |
download | drakx-backup-do-not-use-f7e9316da3f6944adbc9f2f5ce83a3da9767cbf2.tar drakx-backup-do-not-use-f7e9316da3f6944adbc9f2f5ce83a3da9767cbf2.tar.gz drakx-backup-do-not-use-f7e9316da3f6944adbc9f2f5ce83a3da9767cbf2.tar.bz2 drakx-backup-do-not-use-f7e9316da3f6944adbc9f2f5ce83a3da9767cbf2.tar.xz drakx-backup-do-not-use-f7e9316da3f6944adbc9f2f5ce83a3da9767cbf2.zip |
allow to up/down any network interface (backport of my 2005 patch for PSA)
Diffstat (limited to 'perl-install/standalone/net_applet')
-rw-r--r-- | perl-install/standalone/net_applet | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/perl-install/standalone/net_applet b/perl-install/standalone/net_applet index 6de5f3845..53aae8816 100644 --- a/perl-install/standalone/net_applet +++ b/perl-install/standalone/net_applet @@ -68,6 +68,26 @@ my %actions = ( checkNetworkForce(); } }, + 'setInterface' => { + name => N("Network interface"), + choices => sub { sort keys %{$net->{ifcfg}} }, + format_choice => sub { + my ($is_up, $_gw) = network::tools::get_interface_status($_[0]); + $is_up ? N("Disconnect %s", $_[0]) : N("Connect %s", $_[0]); + }, + choice_selected => sub { + my ($is_up, $_gw) = network::tools::get_interface_status($_[0]); + $is_up; + }, + launch => sub { + my ($is_up, $_gw) = network::tools::get_interface_status($_[0]); + if ($is_up) { + network::tools::stop_interface($_[0], 1); + } else { + network::tools::start_interface($_[0], 1); + } + } + }, 'chooseProfile' => { name => N("Profiles"), choices => sub { network::network::netprofile_list() }, @@ -274,9 +294,10 @@ sub generate_menu { $w = gtksignal_connect(gtkshow(Gtk2::MenuItem->new_with_label($name)), activate => sub { $launch->($interface) }); } elsif (@choices > 1) { my $selected = $actions{$action}{choice_selected}; + my $format = $actions{$action}{format_choice}; $w = gtkshow(create_menu($name, map { my $choice = $_; - my $w = gtkshow(gtkset_active(Gtk2::CheckMenuItem->new_with_label($choice), $selected->($choice))); + my $w = gtkshow(gtkset_active(Gtk2::CheckMenuItem->new_with_label($format ? $format->($choice) : $choice), $selected->($choice))); gtksignal_connect($w, activate => sub { $launch->($choice) }); $w->set_draw_as_radio(1); $w; @@ -316,6 +337,7 @@ sub generate_menu { $menu->append(gtkshow(Gtk2::SeparatorMenuItem->new)); $wireless_device and $menu->append(gtkshow($wireless_menu = create_menu(N("Wireless networks"), map { $_->{menuitem} } values %wireless_networks))); + $menu->append($create_item->('setInterface')) if $current_state ne 'notconfigured'; $menu->append(gtkshow(create_menu(N("Settings"), grep { $_ } @settings))); $menu->append(gtkshow(Gtk2::SeparatorMenuItem->new)); $menu->append($create_item->('help')); |