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

2011-03-31 Thread Sascha Silbe
Excerpts from Simon Schampijer's message of Wed Mar 23 15:56:54 +0100 2011:

[src/jarabe/model/neighborhood.py]
 +params_needing_reconnect = account.UpdateParameters(
 +{'server': server,
 + 'account': account_id,
 + 'register': True},
 +dbus.Array([], 's'), dbus_interface=ACCOUNT)

The dictionary fits on a single line, increasing the amount of code that
fits on the screen and thus making it easier to grok the code when
viewing it on an XO.

 +params_needing_reconnect = account.UpdateParameters(
 +{'jid': account_id},
 +dbus.Array([], 's'), dbus_interface=ACCOUNT)

Similarly, all parameters fit on a single line.


Acked-by: Sascha Silbe si...@activitycentral.com


Thanks for the patch!

Sascha

-- 
http://sascha.silbe.org/
http://www.infra-silbe.de/


signature.asc
Description: PGP signature
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


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

2011-03-31 Thread Simon Schampijer

On 03/31/2011 08:27 AM, Sascha Silbe wrote:

Excerpts from Simon Schampijer's message of Wed Mar 23 15:56:54 +0100 2011:

[src/jarabe/model/neighborhood.py]

+params_needing_reconnect = account.UpdateParameters(
+{'server': server,
+ 'account': account_id,
+ 'register': True},
+dbus.Array([], 's'), dbus_interface=ACCOUNT)


The dictionary fits on a single line, increasing the amount of code that
fits on the screen and thus making it easier to grok the code when
viewing it on an XO.


+params_needing_reconnect = account.UpdateParameters(
+{'jid': account_id},
+dbus.Array([], 's'), dbus_interface=ACCOUNT)


Similarly, all parameters fit on a single line.


I did this to match the rest of the code of that file. I am ok with both 
ways, so I went away with moving it on one line.



Acked-by: Sascha Silbesi...@activitycentral.com


Thanks for the patch!

Sascha



Pushed to master and sucrose-0.92:
http://git.sugarlabs.org/sugar/mainline/commit/e385144b67404de98ddcd74b99e4745bbe0d7834

Thanks for the review,
   Simon
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


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

2011-03-29 Thread Simon Schampijer
Sascha, in the '--in-reply-to' conversation this might have been falling 
of the crack :) At least was not part of the great review replies I 
found in my inbox this morning.


Cheers,
   Simon


On 03/23/2011 10:56 AM, Simon Schampijer wrote:

When we update the nick name we need to update the information
saved by the telepathy account manager. This does fix the complete
update of the salut account information.

Signed-off-by: Simon Schampijersi...@laptop.org
---
  src/jarabe/model/neighborhood.py |   41 +-
  1 files changed, 27 insertions(+), 14 deletions(-)

diff --git a/src/jarabe/model/neighborhood.py b/src/jarabe/model/neighborhood.py
index f0b3923..91fedd3 100644
--- a/src/jarabe/model/neighborhood.py
+++ b/src/jarabe/model/neighborhood.py
@@ -798,12 +798,12 @@ class Neighborhood(gobject.GObject):
  server = client.get_string(
  '/desktop/sugar/collaboration/jabber_server')
  account_id = self._get_jabber_account_id()
-needs_reconnect = account.UpdateParameters({'server': server,
-'account': account_id,
-'register': True},
-dbus.Array([], 's'),
-dbus_interface=ACCOUNT)
-if needs_reconnect:
+params_needing_reconnect = account.UpdateParameters(
+{'server': server,
+ 'account': account_id,
+ 'register': True},
+dbus.Array([], 's'), dbus_interface=ACCOUNT)
+if params_needing_reconnect:
  account.Reconnect()

  self._update_jid()
@@ -812,10 +812,23 @@ 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()
+server_obj = bus.get_object(ACCOUNT_MANAGER_SERVICE,
+self._server_account.object_path)
+server_obj.Set(ACCOUNT, 'Nickname', nick,
+   dbus_interface=PROPERTIES_IFACE)
+
+link_local_obj = bus.get_object(ACCOUNT_MANAGER_SERVICE,
+self._link_local_account.object_path)
+link_local_obj.Set(ACCOUNT, 'Nickname', nick,
+   dbus_interface=PROPERTIES_IFACE)
+params_needing_reconnect = link_local_obj.UpdateParameters(
+{'nickname': nick,
+ 'published-name': self._limit_published_name(nick)},
+dbus.Array([], 's'), dbus_interface=ACCOUNT)
+if params_needing_reconnect:
+link_local_obj.Reconnect()

  self._update_jid()

@@ -825,10 +838,10 @@ class Neighborhood(gobject.GObject):
   self._link_local_account.object_path)

  account_id = self._get_jabber_account_id()
-needs_reconnect = account.UpdateParameters({'jid': account_id},
-   dbus.Array([], 's'),
-   dbus_interface=ACCOUNT)
-if needs_reconnect:
+params_needing_reconnect = account.UpdateParameters(
+{'jid': account_id},
+dbus.Array([], 's'), dbus_interface=ACCOUNT)
+if params_needing_reconnect:
  account.Reconnect()

  def __buddy_added_cb(self, account, contact_id, nick, handle):


___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


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

2011-03-24 Thread Sascha Silbe
Excerpts from Simon Schampijer's message of Wed Mar 23 15:56:54 +0100 2011:


What message is 300298237-10204-1-git-send-email-si...@schampijer.de?
It never arrived here. And why did both Gonzalo and you make your
(unrelated) patches a reply to it? This is really confusing.

Please use --in-reply-to only a) for updated patches or b) when
presenting a patch as a reply to a non-patch mail (e.g. a bug report).

Causing unrelated patches to be aggregated in a single thread makes it
much harder for me to keep track of and review them.

Sascha

-- 
http://sascha.silbe.org/
http://www.infra-silbe.de/


signature.asc
Description: PGP signature
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


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

2011-03-24 Thread Simon Schampijer

On 03/24/2011 08:18 AM, Sascha Silbe wrote:

Excerpts from Simon Schampijer's message of Wed Mar 23 15:56:54 +0100 2011:


What message is300298237-10204-1-git-send-email-si...@schampijer.de?
It never arrived here. And why did both Gonzalo and you make your
(unrelated) patches a reply to it? This is really confusing.


http://lists.sugarlabs.org/archive/sugar-devel/2011-March/030439.html 
This is the message, so that looks right to me.


I think Gonzalo's mail was a mistake copying from an example. No 
worries, we understood the general idea :)


Regards,
   Simon


___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


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

2011-03-24 Thread Sascha Silbe
Excerpts from Simon Schampijer's message of Thu Mar 24 15:01:44 +0100 2011:

 http://lists.sugarlabs.org/archive/sugar-devel/2011-March/030439.html 
 This is the message, so that looks right to me.

Ah, looks like a copy  paste error:
Message-ID: 1300298237-10204-1-git-send-email-si...@schampijer.de
In-Reply-To: 300298237-10204-1-git-send-email-si...@schampijer.de

 I think Gonzalo's mail was a mistake copying from an example. No 
 worries, we understood the general idea :)

Don't worry. What got me confused is that you both used the _same_
incorrect Message-ID. 

Sascha

-- 
http://sascha.silbe.org/
http://www.infra-silbe.de/


signature.asc
Description: PGP signature
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


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

2011-03-23 Thread Simon Schampijer
When we update the nick name we need to update the information
saved by the telepathy account manager. This does fix the complete
update of the salut account information.

Signed-off-by: Simon Schampijer si...@laptop.org
---
 src/jarabe/model/neighborhood.py |   41 +-
 1 files changed, 27 insertions(+), 14 deletions(-)

diff --git a/src/jarabe/model/neighborhood.py b/src/jarabe/model/neighborhood.py
index f0b3923..91fedd3 100644
--- a/src/jarabe/model/neighborhood.py
+++ b/src/jarabe/model/neighborhood.py
@@ -798,12 +798,12 @@ class Neighborhood(gobject.GObject):
 server = client.get_string(
 '/desktop/sugar/collaboration/jabber_server')
 account_id = self._get_jabber_account_id()
-needs_reconnect = account.UpdateParameters({'server': server,
-'account': account_id,
-'register': True},
-dbus.Array([], 's'),
-dbus_interface=ACCOUNT)
-if needs_reconnect:
+params_needing_reconnect = account.UpdateParameters(
+{'server': server,
+ 'account': account_id,
+ 'register': True},
+dbus.Array([], 's'), dbus_interface=ACCOUNT)
+if params_needing_reconnect:
 account.Reconnect()
 
 self._update_jid()
@@ -812,10 +812,23 @@ 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()
+server_obj = bus.get_object(ACCOUNT_MANAGER_SERVICE,
+self._server_account.object_path)
+server_obj.Set(ACCOUNT, 'Nickname', nick,
+   dbus_interface=PROPERTIES_IFACE)
+
+link_local_obj = bus.get_object(ACCOUNT_MANAGER_SERVICE,
+self._link_local_account.object_path)
+link_local_obj.Set(ACCOUNT, 'Nickname', nick,
+   dbus_interface=PROPERTIES_IFACE)
+params_needing_reconnect = link_local_obj.UpdateParameters(
+{'nickname': nick,
+ 'published-name': self._limit_published_name(nick)},
+dbus.Array([], 's'), dbus_interface=ACCOUNT)
+if params_needing_reconnect:
+link_local_obj.Reconnect()
 
 self._update_jid()
 
@@ -825,10 +838,10 @@ class Neighborhood(gobject.GObject):
  self._link_local_account.object_path)
 
 account_id = self._get_jabber_account_id()
-needs_reconnect = account.UpdateParameters({'jid': account_id},
-   dbus.Array([], 's'),
-   dbus_interface=ACCOUNT)
-if needs_reconnect:
+params_needing_reconnect = account.UpdateParameters(
+{'jid': account_id},
+dbus.Array([], 's'), dbus_interface=ACCOUNT)
+if params_needing_reconnect:
 account.Reconnect()
 
 def __buddy_added_cb(self, account, contact_id, nick, handle):
-- 
1.7.4

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


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

2011-03-23 Thread Simon Schampijer

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 Schampijersi...@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


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

2011-03-22 Thread Sascha Silbe
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.). :)


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


signature.asc
Description: PGP signature
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


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

2011-03-16 Thread Simon Schampijer
Signed-off-by: Simon Schampijer si...@laptop.org
---
 src/jarabe/model/neighborhood.py |   22 +-
 1 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/src/jarabe/model/neighborhood.py b/src/jarabe/model/neighborhood.py
index aef03b8..1394f44 100644
--- a/src/jarabe/model/neighborhood.py
+++ b/src/jarabe/model/neighborhood.py
@@ -695,7 +695,7 @@ class Neighborhood(gobject.GObject):
 if account == self._server_account:
 self._link_local_account.enable()
 
-def _limit_published_name(nick):
+def _limit_published_name(self, nick):
  Limit the nick name to be only 8 characters maximum
 
 The avahi service name has a 64 character limit. It consists of
@@ -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)
+needs_reconnect = account.UpdateParameters( \
+{'nickname': nick,
+ 'published-name': self._limit_published_name(nick)},
+dbus.Array([], 's'),
+dbus_interface=ACCOUNT)
+if needs_reconnect:
+account.Reconnect()
 
 self._update_jid()
 
-- 
1.7.4

___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel