[Sugar-devel] [PATCH sugar] Don't break if we may not own NetworkManagerUserSettings

Sascha Silbe sascha-pgp at silbe.org
Wed Jul 14 09:11:15 EDT 2010


User settings will be removed from NetworkManager in the future. Also the user
might not have privileges to handle user settings - e.g. because of logging in
remotely (LTSP-style setups).

Signed-off-by: Sascha Silbe <sascha-pgp at silbe.org>

---
 src/jarabe/model/network.py |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/jarabe/model/network.py b/src/jarabe/model/network.py
index 3a949da..623abca 100644
--- a/src/jarabe/model/network.py
+++ b/src/jarabe/model/network.py
@@ -566,11 +566,19 @@ def get_settings():
             _nm_settings = NMSettings()
         except dbus.DBusException:
             logging.exception('Cannot create the UserSettings service.')
-        load_connections()
+            _nm_settings = 'unavailable'
+        else:
+     	   load_connections()
+    if _nm_settings == 'unavailable':
+        return None
     return _nm_settings
 
 def find_connection_by_ssid(ssid):
-    connections = get_settings().connections
+    settings = get_settings()
+    if settings is None:
+        return None
+
+    connections = settings.connections
 
     for conn_index in connections:
         connection = connections[conn_index]
@@ -700,7 +708,11 @@ def load_connections():
     load_gsm_connection()
 
 def find_gsm_connection():
-    connections = get_settings().connections
+    settings = get_settings()
+    if settings is None:
+        return None
+
+    connections = settings.connections
 
     for connection in connections.values():
         if connection.get_settings().connection.type == NM_CONNECTION_TYPE_GSM:
-- 
tg: (8aa387d..) t/fix-no-nm-user-settings (depends on: upstream/master)


More information about the Sugar-devel mailing list