diff options
author | Olivier Blin <oblin@mandriva.com> | 2008-11-17 20:43:45 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.com> | 2008-11-17 20:43:45 +0000 |
commit | 01cd98df1c0475bf4492bce77e106191769d57a4 (patch) | |
tree | 3cc4f73e12a6efb8a412b49df794a79bcb02147c | |
parent | bc933aa5e2e347c557d4b152ec162b7a3dba88dd (diff) | |
download | drakx-net-01cd98df1c0475bf4492bce77e106191769d57a4.tar drakx-net-01cd98df1c0475bf4492bce77e106191769d57a4.tar.gz drakx-net-01cd98df1c0475bf4492bce77e106191769d57a4.tar.bz2 drakx-net-01cd98df1c0475bf4492bce77e106191769d57a4.tar.xz drakx-net-01cd98df1c0475bf4492bce77e106191769d57a4.zip |
- net_applet: show interface type name instead of just the interface
- detect cellular_card types from ifcfg file
(backport from trunk)
-rwxr-xr-x | bin/net_applet | 32 | ||||
-rw-r--r-- | lib/network/connection/cellular_card.pm | 5 |
2 files changed, 29 insertions, 8 deletions
diff --git a/bin/net_applet b/bin/net_applet index d20f5ed..5da2da5 100755 --- a/bin/net_applet +++ b/bin/net_applet @@ -103,9 +103,29 @@ Run the \"%s\" assistant from the Mandriva Linux Control Center", N("Set up a ne ); } +sub get_interface_type { + my ($interface) = @_; + my $ifcfg = $net->{ifcfg}{$interface}; + require network::connection; + $ifcfg && network::connection->find_ifcfg_type($ifcfg); +} + +sub get_interface_icon { + my ($interface) = @_; + my $type = get_interface_type($interface); + $type && $type->get_type_icon; +} + +sub get_interface_name { + my ($interface) = @_; + my $type = get_interface_type($interface); + my $type_name = $type && $type->get_type_name; + $type_name ? "$type_name ($interface)" : $interface; +} + my %actions = ( - 'upNetwork' => { name => sub { N("Connect %s", $_[0]) }, launch => sub { network::tools::start_interface($_[0], 1) } }, - 'downNetwork' => { name => sub { N("Disconnect %s", $_[0]) }, launch => sub { network::tools::stop_interface($_[0], 1) } }, + 'upNetwork' => { name => sub { N("Connect %s", get_interface_name($_[0])) }, launch => sub { network::tools::start_interface($_[0], 1) } }, + 'downNetwork' => { name => sub { N("Disconnect %s", get_interface_name($_[0])) }, launch => sub { network::tools::stop_interface($_[0], 1) } }, 'monitorNetwork' => { name => N("Monitor Network"), launch => \&run_net_monitor }, 'monitorIFW' => { name => N("Interactive Firewall"), launch => \&run_drakids }, 'wireless' => { name => N("Manage wireless networks"), launch => sub { run_drakroam() } }, @@ -132,12 +152,8 @@ my %actions = ( my ($is_up, $_gw) = network::tools::get_interface_status($_[0]); $is_up; }, - get_icon => sub { - my $ifcfg = $net->{ifcfg}{$_[0]}; - require network::connection; - my $type = $ifcfg && network::connection->find_ifcfg_type($ifcfg); - $type && $type->get_type_icon; - }, + format_choice => \&get_interface_name, + get_icon => \&get_interface_icon, launch => sub { my ($is_up, $_gw) = network::tools::get_interface_status($_[0]); if ($is_up) { diff --git a/lib/network/connection/cellular_card.pm b/lib/network/connection/cellular_card.pm index 00f7b39..4581ea3 100644 --- a/lib/network/connection/cellular_card.pm +++ b/lib/network/connection/cellular_card.pm @@ -21,6 +21,11 @@ sub get_metric { 40 } sub get_packages { 'comgt', 'ppp' } +sub handles_ifcfg { + my ($_class, $ifcfg) = @_; + exists $ifcfg->{CELLULAR_CID}; +} + my @thirdparty_settings = ( { name => 'nozomi', |