Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Schampijer <simon@schampijer.de>2008-01-18 20:02:25 (GMT)
committer Simon Schampijer <simon@schampijer.de>2008-01-18 20:02:25 (GMT)
commitbf4c327bacbcadfab484a9c5455fd41c7fc38eb9 (patch)
treecf3a71459d0047a0ab3d1dc67eafc4b934d119f7
parent21e3447e7063cfa2f38e9844dcab8a354b3c86d9 (diff)
Using setEnabledWireless to handle radio settings #1406
-rwxr-xr-x[-rw-r--r--]shell/controlpanel/control.py38
1 files changed, 18 insertions, 20 deletions
diff --git a/shell/controlpanel/control.py b/shell/controlpanel/control.py
index c21d93a..a26132e 100644..100755
--- a/shell/controlpanel/control.py
+++ b/shell/controlpanel/control.py
@@ -307,33 +307,31 @@ def get_radio():
bus = dbus.SystemBus()
proxy = bus.get_object(NM_SERVICE_NAME, NM_SERVICE_PATH)
nm = dbus.Interface(proxy, NM_SERVICE_IFACE)
- state = nm.state()
- if state:
- if state == NM_ASLEEP:
- return _('off')
- else:
- return _('on')
- return _('State is unknown.')
-
+ state = nm.getWirelessEnabled()
+ if state == 0:
+ return _('off')
+ elif state == 1:
+ return _('on')
+ else:
+ return _('State is unknown.')
+
def print_radio():
print get_radio()
def set_radio(state):
"""Turn Radio 'on' or 'off'
state : 'on/off'
- """
-
- # TODO: NM 0.6.x does not return a reply yet
- # so we ignore it for the moment
-
- if state == 'on':
- dbus.SystemBus().call_async(NM_SERVICE_NAME, NM_SERVICE_PATH,
- NM_SERVICE_IFACE, 'wake', '', (),
- None, None)
+ """
+ if state == 'on':
+ bus = dbus.SystemBus()
+ proxy = bus.get_object(NM_SERVICE_NAME, NM_SERVICE_PATH)
+ nm = dbus.Interface(proxy, NM_SERVICE_IFACE)
+ nm.setWirelessEnabled(True)
elif state == 'off':
- dbus.SystemBus().call_async(NM_SERVICE_NAME, NM_SERVICE_PATH,
- NM_SERVICE_IFACE, 'sleep', '', (),
- None, None)
+ bus = dbus.SystemBus()
+ proxy = bus.get_object(NM_SERVICE_NAME, NM_SERVICE_PATH)
+ nm = dbus.Interface(proxy, NM_SERVICE_IFACE)
+ nm.setWirelessEnabled(False)
else:
print (_("Error in specified radio argument use on/off."))