Bug 40393 - No change notification on Account.Interface.Addressing.URISchemes
Summary: No change notification on Account.Interface.Addressing.URISchemes
Status: RESOLVED FIXED
Alias: None
Product: Telepathy
Classification: Unclassified
Component: tp-spec (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Guillaume Desmottes
QA Contact: Telepathy bugs list
URL:
Whiteboard: r+ with trivial changes
Keywords: patch
Depends on:
Blocks:
 
Reported: 2011-08-26 06:28 UTC by Guillaume Desmottes
Modified: 2013-01-09 13:06 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
patch (1.11 KB, patch)
2013-01-07 14:23 UTC, Guillaume Desmottes
Details | Splinter Review
new spec patch (1.72 KB, patch)
2013-01-07 15:17 UTC, Guillaume Desmottes
Details | Splinter Review
MC patch (2.00 KB, patch)
2013-01-07 15:21 UTC, Guillaume Desmottes
Details | Splinter Review

Description Guillaume Desmottes 2011-08-26 06:28:56 UTC
We should use org.freedesktop.DBus.Properties.PropertiesChanged
Comment 1 Guillaume Desmottes 2011-08-26 06:29:57 UTC
Once this is fixed and implemented, TpAccount should be modified to be updated.
Comment 2 Guillaume Desmottes 2013-01-07 14:23:12 UTC
Created attachment 72625 [details] [review]
patch
Comment 3 Guillaume Desmottes 2013-01-07 14:58:01 UTC
Hum or should I use the Account.AccountPropertyChanged signal?

Anyway, this patch is wrong as I forgot the org.freedesktop.DBus.Property.EmitsChangedSignal annotation.
Comment 4 Guillaume Desmottes 2013-01-07 15:17:28 UTC
Created attachment 72627 [details] [review]
new spec patch
Comment 5 Guillaume Desmottes 2013-01-07 15:21:16 UTC
Created attachment 72628 [details] [review]
MC patch
Comment 6 Guillaume Desmottes 2013-01-07 16:30:35 UTC
And here is the tp-glib branch: http://cgit.collabora.com/git/user/cassidy/telepathy-glib/log/?h=uri-40393
Comment 7 Simon McVittie 2013-01-08 11:51:34 UTC
Comment on attachment 72627 [details] [review]
new spec patch

Review of attachment 72627 [details] [review]:
-----------------------------------------------------------------

::: spec/Account_Interface_Addressing.xml
@@ +19,3 @@
>    <interface name="org.freedesktop.Telepathy.Account.Interface.Addressing">
>      <tp:requires interface="org.freedesktop.Telepathy.Account"/>
>      <tp:added version="0.21.5">(as stable API)</tp:added>

<tp:changed> please.
Comment 8 Simon McVittie 2013-01-08 11:53:57 UTC
Comment on attachment 72628 [details] [review]
MC patch

Review of attachment 72628 [details] [review]:
-----------------------------------------------------------------

::: tests/twisted/account/addressing.py
@@ +53,5 @@
>      assertEquals (uri_schemes, ['email'])
>  
> +    e = q.expect('dbus-signal', signal='PropertiesChanged')
> +    assertEquals (e.args, [ cs.ACCOUNT_IFACE_ADDRESSING,
> +        { cs.ACCOUNT_IFACE_ADDRESSING + '.URISchemes' : ['email'] }, [] ])

This would be more illustrative if it added a second URI scheme, to demonstrate that when we add 'telnet' having already added 'email', the signal says ['email', 'telnet'].

Total nitpicking: the URI scheme is 'mailto' :-P
Comment 9 Simon McVittie 2013-01-08 11:57:38 UTC
> + g_object_get (test->account, "uri-schemes", &tmp, NULL);

Whitespace nitpicking: I'd prefer the "linked pairs" pattern:

    g_object_get (test->account,
        "uri-schemes", &tmp,
        NULL);

It would be nice if the doc-comment for the property said "notify::uri-schemes cannot be relied on if the Account Manager is Mission Control version 5.12 or older", or something.

This all looks basically good, just some minor nitpicking in each affected project.
Comment 10 Guillaume Desmottes 2013-01-08 12:41:36 UTC
(In reply to comment #7)
> Comment on attachment 72627 [details] [review] [review]
> new spec patch
> 
> Review of attachment 72627 [details] [review] [review]:
> -----------------------------------------------------------------
> 
> ::: spec/Account_Interface_Addressing.xml
> @@ +19,3 @@
> >    <interface name="org.freedesktop.Telepathy.Account.Interface.Addressing">
> >      <tp:requires interface="org.freedesktop.Telepathy.Account"/>
> >      <tp:added version="0.21.5">(as stable API)</tp:added>
> 
> <tp:changed> please.

Fixed in http://cgit.collabora.com/git/user/cassidy/telepathy-spec/log/?h=uri-40393
Comment 11 Guillaume Desmottes 2013-01-08 12:54:22 UTC
(In reply to comment #8)
> Comment on attachment 72628 [details] [review] [review]
> MC patch
> 
> Review of attachment 72628 [details] [review] [review]:
> -----------------------------------------------------------------
> 
> ::: tests/twisted/account/addressing.py
> @@ +53,5 @@
> >      assertEquals (uri_schemes, ['email'])
> >  
> > +    e = q.expect('dbus-signal', signal='PropertiesChanged')
> > +    assertEquals (e.args, [ cs.ACCOUNT_IFACE_ADDRESSING,
> > +        { cs.ACCOUNT_IFACE_ADDRESSING + '.URISchemes' : ['email'] }, [] ])
> 
> This would be more illustrative if it added a second URI scheme, to
> demonstrate that when we add 'telnet' having already added 'email', the
> signal says ['email', 'telnet'].
> 
> Total nitpicking: the URI scheme is 'mailto' :-P

Fixed in http://cgit.collabora.com/git/user/cassidy/telepathy-spec/log/?h=uri-40393
Comment 12 Guillaume Desmottes 2013-01-08 13:00:54 UTC
(In reply to comment #9)
> > + g_object_get (test->account, "uri-schemes", &tmp, NULL);
> 
> Whitespace nitpicking: I'd prefer the "linked pairs" pattern:
> 
>     g_object_get (test->account,
>         "uri-schemes", &tmp,
>         NULL);

fixed.

> It would be nice if the doc-comment for the property said
> "notify::uri-schemes cannot be relied on if the Account Manager is Mission
> Control version 5.12 or older", or something.

done.

http://cgit.collabora.com/git/user/cassidy/telepathy-glib/log/?h=uri-40393
Comment 13 Simon McVittie 2013-01-08 14:07:47 UTC
Spec, tp-glib changes look fine.

MC changes are really at http://cgit.collabora.com/git/user/cassidy/telepathy-mission-control/log/?h=uri-40393 and are fine except for this:

+ e = q.expect('dbus-signal', signal='PropertiesChanged')
+ assertEquals (e.args, [ cs.ACCOUNT_IFACE_ADDRESSING,
+ { cs.ACCOUNT_IFACE_ADDRESSING + '.URISchemes' : ['telnet', 'email'] }, [] ])

Unfortunately, this demonstrates a bug, which I didn't catch first time round :-( PropertiesChanged.args[1..] is meant to contain bare property names, so in this case it should be just 'URISchemes'. (It's not amazingly clear in the D-Bus Specification, but it's consistent with Get and GetAll, and GDBus matches this interpretation.)

Also, that quoted block will fail if the URISchemes happen to come out in the other order. I would suggest something like this:

q.expect('dbus-signal', signal='PropertiesChanged',
    predicate=(lambda e:
        e.args[0] == cs.ACCOUNT_IFACE_ADDRESSING and
        set(e.args[1]['URISchemes']) == set('telnet', 'email'))

(or the mailto equivalent, depending which order you do this in).
Comment 14 Guillaume Desmottes 2013-01-08 14:58:35 UTC
(In reply to comment #13)
> MC changes are really at
> http://cgit.collabora.com/git/user/cassidy/telepathy-mission-control/log/
> ?h=uri-40393 and are fine except for this:
> 
> + e = q.expect('dbus-signal', signal='PropertiesChanged')
> + assertEquals (e.args, [ cs.ACCOUNT_IFACE_ADDRESSING,
> + { cs.ACCOUNT_IFACE_ADDRESSING + '.URISchemes' : ['telnet', 'email'] }, []
> ])
> 
> Unfortunately, this demonstrates a bug, which I didn't catch first time
> round :-( PropertiesChanged.args[1..] is meant to contain bare property
> names, so in this case it should be just 'URISchemes'. (It's not amazingly
> clear in the D-Bus Specification, but it's consistent with Get and GetAll,
> and GDBus matches this interpretation.)

Ah ok, I read the spec and assumed it was the full-name. Fixed.

I updated tp-glib as well: http://cgit.collabora.com/git/user/cassidy/telepathy-glib/log/?h=uri-40393

> Also, that quoted block will fail if the URISchemes happen to come out in
> the other order. I would suggest something like this:
> 
> q.expect('dbus-signal', signal='PropertiesChanged',
>     predicate=(lambda e:
>         e.args[0] == cs.ACCOUNT_IFACE_ADDRESSING and
>         set(e.args[1]['URISchemes']) == set('telnet', 'email'))
> 
> (or the mailto equivalent, depending which order you do this in).

done.

http://cgit.collabora.com/git/user/cassidy/telepathy-mission-control/log/?h=uri-40393
updated
Comment 15 Simon McVittie 2013-01-09 12:58:29 UTC
Ship it.
Comment 16 Guillaume Desmottes 2013-01-09 13:06:17 UTC
Merged for:
- telepathy-spec 0.27.1
- telepathy-mission-control 5.15.0
- telepathy-glib 0.21.0


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.