Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <mpgritti@gmail.com>2008-10-22 12:06:04 (GMT)
committer Marco Pesenti Gritti <mpgritti@gmail.com>2008-10-22 12:06:04 (GMT)
commita15157462275eee51d785f20dee110f48eae4e72 (patch)
treef38c4b2ccaa97ca15eb0304ca7c419313da74586 /src
parent6e7a6e96c2ddec34034523b269d60ece136d3497 (diff)
More work on activation, sort of working.
Diffstat (limited to 'src')
-rw-r--r--src/jarabe/desktop/meshbox.py29
-rw-r--r--src/jarabe/model/network.py12
2 files changed, 29 insertions, 12 deletions
diff --git a/src/jarabe/desktop/meshbox.py b/src/jarabe/desktop/meshbox.py
index 7567cf9..e37dc57 100644
--- a/src/jarabe/desktop/meshbox.py
+++ b/src/jarabe/desktop/meshbox.py
@@ -33,6 +33,7 @@ from sugar.graphics import iconentry
from sugar.graphics.menuitem import MenuItem
from sugar.activity.activityhandle import ActivityHandle
from sugar.activity import activityfactory
+from sugar.util import unique_id
from jarabe.model import neighborhood
from jarabe.view.buddyicon import BuddyIcon
@@ -123,16 +124,16 @@ class AccessPointView(CanvasPulsingIcon):
return p
- def __device_state_changed_cb(self, state):
- self._device_state = state
+ def __device_state_changed_cb(self, old_state, new_state, reason):
+ self._device_state = new_state
self._update()
def __ap_properties_changed_cb(self, properties):
self._update_properties(properties)
def __wireless_properties_changed_cb(self, properties):
- if 'ActiveAccessPoint' in props:
- ap = props['ActiveAccessPoint']
+ if 'ActiveAccessPoint' in properties:
+ ap = properties['ActiveAccessPoint']
self._active = (ap == self._model.object_path)
self._update_state()
@@ -235,16 +236,26 @@ class AccessPointView(CanvasPulsingIcon):
pass
def _activate_cb(self, icon):
- info = { "connection": { "type": "802-11-wireless" } ,
- "802-11-wireless": { "ssid": self._name }
+ info = { 'connection': { 'id' : 'Auto ' + self._name,
+ 'uuid' : unique_id(),
+ 'type' : '802-11-wireless' } ,
+ '802-11-wireless' : { 'ssid': self._name }
}
conn = network.add_connection(info)
obj = self._bus.get_object(_NM_SERVICE, _NM_PATH)
netmgr = dbus.Interface(obj, _NM_IFACE)
- netmgr.ActivateConnection('org.freedesktop.NetworkManagerSettings',
- conn.path, self._device.object_path,
- self._model.object_path)
+ netmgr.ActivateConnection(network.SETTINGS_SERVICE, conn.path,
+ self._device.object_path,
+ self._model.object_path,
+ reply_handler=self.__activate_reply_cb,
+ error_handler=self.__activate_error_cb)
+
+ def __activate_reply_cb(self, connection):
+ logging.debug('Connection activated: %s', connection)
+
+ def __activate_error_cb(self, err):
+ logging.debug('Failed to activate connection: %s', err)
def set_filter(self, query):
self._greyed_out = self._name.lower().find(query) == -1
diff --git a/src/jarabe/model/network.py b/src/jarabe/model/network.py
index 77521cb..f5e1796 100644
--- a/src/jarabe/model/network.py
+++ b/src/jarabe/model/network.py
@@ -34,6 +34,8 @@ DEVICE_STATE_FAILED = 9
AP_FLAGS_802_11_NONE = 0
AP_FLAGS_802_11_PRIVACY = 1
+SETTINGS_SERVICE = 'org.freedesktop.NetworkManagerUserSettings'
+
NM_SETTINGS_PATH = '/org/freedesktop/NetworkManagerSettings'
NM_SETTINGS_IFACE = 'org.freedesktop.NetworkManagerSettings'
NM_CONNECTION_IFACE = 'org.freedesktop.NetworkManagerSettings.Connection'
@@ -45,7 +47,9 @@ class NMSettings(dbus.service.Object):
connections = []
def __init__(self):
- dbus.service.Object.__init__(self, dbus.SystemBus(), NM_SETTINGS_PATH)
+ bus = dbus.SystemBus()
+ bus_name = dbus.service.BusName(SETTINGS_SERVICE, bus=bus)
+ dbus.service.Object.__init__(self, bus_name, NM_SETTINGS_PATH)
connections = []
@dbus.service.method(dbus_interface=NM_SETTINGS_IFACE,
@@ -58,7 +62,7 @@ class NMSettings(dbus.service.Object):
pass
def add_connection(self, conn):
- self.connections.append(conn.path)
+ self.connections.append(conn)
self.NewConnection(conn.path)
class NMSettingsConnection(dbus.service.Object):
@@ -68,7 +72,9 @@ class NMSettingsConnection(dbus.service.Object):
self.path = NM_SETTINGS_PATH + '/' + str(self._counter)
self._counter += 1
- dbus.service.Object.__init__(self, dbus.SystemBus(), self.path)
+ bus = dbus.SystemBus()
+ bus_name = dbus.service.BusName(SETTINGS_SERVICE, bus=bus)
+ dbus.service.Object.__init__(self, bus_name, self.path)
self.secrets_request = dispatch.Signal()