[Sugar-devel] [PATCH sugar] Fully update the salut account information when the nick name changes #10749

Sascha Silbe sascha-ml-reply-to-2011-2 at silbe.org
Tue Mar 22 15:45:23 EDT 2011


Excerpts from Simon Schampijer's message of Wed Mar 16 18:57:17 +0100 2011:

> Signed-off-by: Simon Schampijer <simon at laptop.org>

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


[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.

> +        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].

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?

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?

Sascha

[1] http://docs.python.org/reference/lexical_analysis.html#implicit-line-joining
[2] http://telepathy.freedesktop.org/spec/Account.html#Method:UpdateParameters
[3] http://telepathy.freedesktop.org/spec/Connection_Manager.html#Simple-Type:Connection_Parameter_Name
-- 
http://sascha.silbe.org/
http://www.infra-silbe.de/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 500 bytes
Desc: not available
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20110322/c115c820/attachment.pgp>


More information about the Sugar-devel mailing list