Skip to content
Browse files

networksetup+: Simplify media check

* Lets just rely on IsWireless and friends
  in BNetworkInterface as we are checking
  the same thing twice.
  • Loading branch information...
1 parent 2ddbb1e commit ab372d6fd32fa36704275b58892438dc4590ab0a @kallisti5 kallisti5 committed Jan 20, 2013
Showing with 6 additions and 18 deletions.
  1. +6 −18 src/tests/kits/net/preflet/InterfacesAddOn/InterfacesListView.cpp
View
24 src/tests/kits/net/preflet/InterfacesAddOn/InterfacesListView.cpp
@@ -209,25 +209,13 @@ InterfaceListItem::_Init()
const char* mediaTypeName = NULL;
- int media = fInterface.Media();
+ BNetworkDevice device(Name());
+ if (device.IsWireless())
+ mediaTypeName = "wifi";
+ else if (device.IsEthernet())
+ mediaTypeName = "ether";
- printf("%s media = 0x%x\n", Name(), media);
- switch (IFM_TYPE(media)) {
- case IFM_ETHER:
- mediaTypeName = "ether";
- break;
- case IFM_IEEE80211:
- mediaTypeName = "wifi";
- break;
- default: {
- BNetworkDevice device(Name());
- if (device.IsWireless())
- mediaTypeName = "wifi";
- else if (device.IsEthernet())
- mediaTypeName = "ether";
- break;
- }
- }
+ printf("%s is a %s device\n", Name(), mediaTypeName);
_PopulateBitmaps(mediaTypeName);
// Load the interface icons

0 comments on commit ab372d6

Please sign in to comment.
Something went wrong with that request. Please try again.