On 03/22/2011 03:45 PM, Sascha Silbe wrote:
Excerpts from Simon Schampijer's message of Wed Mar 16 18:57:17 +0100 2011:

Signed-off-by: Simon Schampijer<si...@laptop.org>

As usual I'm missing some kind of explanation on the background (why
UpdateParameters is needed etc.). :)

I did put a bit more info in the secondary patch description.

[src/jarabe/model/neighborhood.py]
@@ -812,10 +812,22 @@ class Neighborhood(gobject.GObject):
          logging.debug('__nick_changed_cb')

          nick = client.get_string('/desktop/sugar/user/nick')
-        for account in self._server_account, self._link_local_account:
-            bus = dbus.Bus()
-            obj = bus.get_object(ACCOUNT_MANAGER_SERVICE, account.object_path)
-            obj.Set(ACCOUNT, 'Nickname', nick, dbus_interface=PROPERTIES_IFACE)
+
+        bus = dbus.Bus()
+        account = bus.get_object(ACCOUNT_MANAGER_SERVICE,
+                                 self._server_account.object_path)
+        account.Set(ACCOUNT, 'Nickname', nick, dbus_interface=PROPERTIES_IFACE)
+
+        account = bus.get_object(ACCOUNT_MANAGER_SERVICE,
+                                 self._link_local_account.object_path)
+        account.Set(ACCOUNT, 'Nickname', nick, dbus_interface=PROPERTIES_IFACE)

I guess you unrolled the loop so you can call UpdateParameters on just
the Salut account? If so, please name the two variables differently.

Done.

+        needs_reconnect = account.UpdateParameters( \
+            {'nickname': nick,
+             'published-name': self._limit_published_name(nick)},
+            dbus.Array([], 's'),
+            dbus_interface=ACCOUNT)
+        if needs_reconnect:
+            account.Reconnect()

The backslash isn't necessary [1].

Done.

The return value of UpdateParameters seems to be a list [2] rather than
a boolean. How about renaming it to something like
params_needing_reconnect?

Done. Renamed the name and renamed as well the other occasions.

I see neither nickname nor published-name in the list of well-known
connection parameters [3]. Are they specific to Salut? Is there any
documentation explaining what they are and how they're used?

No, not that I am aware of - the only way I found out was by reading the code, the account information (~/.mission-control) and testing.

Regards,
   Simon
_______________________________________________
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel

Reply via email to