From 0839c5478e3b4b8f22a23b702a5b6ac9fba6c520 Mon Sep 17 00:00:00 2001
From: Simon Schampijer <simon@schampijer.de>
Date: Thu, 5 Aug 2010 17:31:58 +0200
Subject: [PATCH 2/2] Removed another blocking call. And set the IP4Config mode
to link-local.
---
src/jarabe/desktop/meshbox.py | 21 +++++++++++++++------
src/jarabe/model/adhoc.py | 2 +-
2 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/src/jarabe/desktop/meshbox.py b/src/jarabe/desktop/meshbox.py
index 454c767..f70a86d 100644
a
|
b
|
class AdHocView(CanvasPulsingIcon): |
528 | 528 | netmgr = dbus.Interface(obj, _NM_IFACE) |
529 | 529 | |
530 | 530 | netmgr_props = dbus.Interface(netmgr, dbus.PROPERTIES_IFACE) |
531 | | active_connections_o = netmgr_props.Get(_NM_IFACE, 'ActiveConnections') |
| 531 | netmgr_props.Get(_NM_IFACE, 'ActiveConnections', \ |
| 532 | reply_handler=self.__get_active_connections_reply_cb, |
| 533 | error_handler=self.__get_active_connections_error_cb) |
532 | 534 | |
533 | | for conn_o in active_connections_o: |
534 | | obj = self._bus.get_object(_NM_IFACE, conn_o) |
| 535 | def __get_active_connections_reply_cb(self, active_connections_o): |
| 536 | for connection_o in active_connections_o: |
| 537 | obj = self._bus.get_object(_NM_IFACE, connection_o) |
535 | 538 | props = dbus.Interface(obj, dbus.PROPERTIES_IFACE) |
536 | 539 | state = props.Get(_NM_ACTIVE_CONN_IFACE, 'State') |
537 | 540 | if state == network.NM_ACTIVE_CONNECTION_STATE_ACTIVATED: |
538 | | ap_o = props.Get(_NM_ACTIVE_CONN_IFACE, 'SpecificObject') |
539 | | if ap_o != '/': |
540 | | netmgr.DeactivateConnection(conn_o) |
| 541 | access_point_o = props.Get(_NM_ACTIVE_CONN_IFACE, |
| 542 | 'SpecificObject') |
| 543 | if access_point_o != '/': |
| 544 | obj = self._bus.get_object(_NM_SERVICE, _NM_PATH) |
| 545 | netmgr = dbus.Interface(obj, _NM_IFACE) |
| 546 | netmgr.DeactivateConnection(connection_o) |
| 547 | |
| 548 | def __get_active_connections_error_cb(self, err): |
| 549 | logging.error('Error getting the active connections: %s', err) |
541 | 550 | |
542 | 551 | def __get_device_state_reply_cb(self, state): |
543 | 552 | self._device_state = state |
diff --git a/src/jarabe/model/adhoc.py b/src/jarabe/model/adhoc.py
index 783d474..828451e 100644
a
|
b
|
class AdHocManager(object): |
135 | 135 | settings.wireless.channel = channel |
136 | 136 | settings.wireless.mode = 'adhoc' |
137 | 137 | settings.ip4_config = IP4Config() |
138 | | settings.ip4_config.method = 'shared' |
| 138 | settings.ip4_config.method = 'link-local' |
139 | 139 | |
140 | 140 | connection = network.add_connection(name, settings) |
141 | 141 | |