From 8a427e6a327c5accfb420a37ee3ec193970a3a08 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Wed, 19 Sep 2007 23:19:39 +0000 Subject: do not hardcode icon size in get_type_icon implementation, make it optional --- lib/network/connection.pm | 19 ++++++++++++++++++- lib/network/connection/cable.pm | 2 +- lib/network/connection/cellular_bluetooth.pm | 2 +- lib/network/connection/cellular_card.pm | 2 +- lib/network/connection/dvb.pm | 2 +- lib/network/connection/ethernet.pm | 2 +- lib/network/connection/isdn.pm | 2 +- lib/network/connection/pots.pm | 2 +- lib/network/connection/wireless.pm | 2 +- lib/network/connection/xdsl.pm | 2 +- 10 files changed, 27 insertions(+), 10 deletions(-) diff --git a/lib/network/connection.pm b/lib/network/connection.pm index cf3d14c..570935b 100644 --- a/lib/network/connection.pm +++ b/lib/network/connection.pm @@ -25,7 +25,12 @@ Get the connection type icon path =cut -sub get_type_icon() { '/usr/share/mcc/themes/default/drakconnect-mdk' } +sub get_type_icon { + my ($self, $o_size) = @_; + my $size = $o_size || 24; + my $icon = eval { $self->_get_type_icon . '-' . $size }; + $icon || '/usr/share/mcc/themes/default/drakconnect-mdk'; +} =item get_devices() @@ -248,4 +253,16 @@ sub get_status_message { }->{$status}; } +=head2 Pure virtual private instance methods + +=over + +=item _get_type_icon + +Get the icon prefix for the connection type + +=back + +=cut + 1; diff --git a/lib/network/connection/cable.pm b/lib/network/connection/cable.pm index 8d4fe07..15030a2 100644 --- a/lib/network/connection/cable.pm +++ b/lib/network/connection/cable.pm @@ -12,7 +12,7 @@ use detect_devices; sub get_type_name() { N("Cable") } sub get_type_description() { N("Cable modem") } -sub get_type_icon() { 'cablemodem-24' } +sub _get_type_icon() { 'cablemodem' } sub get_metric { 20 } sub handles_ifcfg { diff --git a/lib/network/connection/cellular_bluetooth.pm b/lib/network/connection/cellular_bluetooth.pm index 0b16ba1..cc75be7 100644 --- a/lib/network/connection/cellular_bluetooth.pm +++ b/lib/network/connection/cellular_bluetooth.pm @@ -9,7 +9,7 @@ my $rfcomm_dev_prefix = "/dev/rfcomm"; sub get_type_name { N("Bluetooth") } sub get_type_description { N("Bluetooth Dial Up Networking") } -sub get_type_icon { 'bluetooth-24' } +sub _get_type_icon { 'bluetooth' } sub get_devices { search_services('DUN') } sub get_metric { 45 } sub get_interface { "ppp0" } diff --git a/lib/network/connection/cellular_card.pm b/lib/network/connection/cellular_card.pm index 6ed31b6..c2ad0d4 100644 --- a/lib/network/connection/cellular_card.pm +++ b/lib/network/connection/cellular_card.pm @@ -6,7 +6,7 @@ use strict; use common; sub get_type_name() { N("GPRS/Edge/3G") } -sub get_type_icon() { 'cellular-24' } +sub _get_type_icon() { 'cellular' } sub get_devices() { require detect_devices; my @maybe_usbserial_modules = ('usbserial_generic', 'unknown'); diff --git a/lib/network/connection/dvb.pm b/lib/network/connection/dvb.pm index ec085b3..48c9832 100644 --- a/lib/network/connection/dvb.pm +++ b/lib/network/connection/dvb.pm @@ -11,7 +11,7 @@ use modules; sub get_type_name() { N("DVB") } sub get_type_description() { N("Satellite (DVB)") } -sub get_type_icon() { 'dvb-24' } +sub _get_type_icon() { 'dvb' } sub get_devices() { require detect_devices; diff --git a/lib/network/connection/ethernet.pm b/lib/network/connection/ethernet.pm index cccaa32..7b7cfc4 100644 --- a/lib/network/connection/ethernet.pm +++ b/lib/network/connection/ethernet.pm @@ -8,7 +8,7 @@ use common; our @dhcp_clients = qw(dhclient dhcpcd pump dhcpxd); sub get_type_name() { N("Ethernet") } -sub get_type_icon() { 'ethernet-24' } +sub _get_type_icon() { 'ethernet' } sub get_devices() { #require list_modules; diff --git a/lib/network/connection/isdn.pm b/lib/network/connection/isdn.pm index 84c2d10..e26d15c 100644 --- a/lib/network/connection/isdn.pm +++ b/lib/network/connection/isdn.pm @@ -6,7 +6,7 @@ use strict; use common; sub get_type_name { N("ISDN") } -sub get_type_icon { 'isdn-24' } +sub _get_type_icon { 'isdn' } sub get_devices { require modules; diff --git a/lib/network/connection/pots.pm b/lib/network/connection/pots.pm index 449d58d..0e5f233 100644 --- a/lib/network/connection/pots.pm +++ b/lib/network/connection/pots.pm @@ -15,7 +15,7 @@ sub get_type_description { #-PO: for example, in French, it can be translated as "RTC" N("Analog telephone modem (POTS)"); } -sub get_type_icon { 'potsmodem-24' } +sub _get_type_icon { 'potsmodem' } sub get_metric { 50 } sub handles_ifcfg { diff --git a/lib/network/connection/wireless.pm b/lib/network/connection/wireless.pm index 996aaa8..8b7d6ee 100644 --- a/lib/network/connection/wireless.pm +++ b/lib/network/connection/wireless.pm @@ -9,7 +9,7 @@ use strict; use common; sub get_type_name() { N("Wireless") } -sub get_type_icon() { 'wireless-24' } +sub _get_type_icon() { 'wireless' } sub get_devices { my ($_class, %options) = @_; require detect_devices; diff --git a/lib/network/connection/xdsl.pm b/lib/network/connection/xdsl.pm index f9c1697..5cbfd50 100644 --- a/lib/network/connection/xdsl.pm +++ b/lib/network/connection/xdsl.pm @@ -6,7 +6,7 @@ use strict; use common; sub get_type_name() { N("DSL") } -sub get_type_icon() { 'xdsl-24' } +sub _get_type_icon() { 'xdsl' } sub get_devices() { require detect_devices; -- cgit v1.2.1