Bug 42546

Summary: Need TP_CONNECTION_FEATURE_CONTACT_LIST_PROPERTIES
Product: Telepathy Reporter: Guillaume Desmottes <guillaume.desmottes>
Component: tp-glibAssignee: Telepathy bugs list <telepathy-bugs>
Status: RESOLVED FIXED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
URL: http://cgit.collabora.com/git/user/cassidy/telepathy-glib/log/?h=contact-list-prop-42546
Whiteboard:
i915 platform: i915 features:
Attachments: contact-list-client: make test path clearer
test that contact list properties are set
Add TP_CONNECTION_FEATURE_CONTACT_LIST_PROPERTIES

Description Guillaume Desmottes 2011-11-03 03:04:30 UTC
If a simple app wants to just offers UI to add contacts, it needs to prepare TP_CONNECTION_FEATURE_CONTACT_LIST to grab the "can-change-contact-list" GObject property. This will also prepare all the contacts of the contact list which is a bit unfortunate.

This is also a problem when starting to port Empathy to the new API. I need this property but not the full contact list as Folks prepares it for me. And while Folks doesn't use the new API, that means I'll have to prepare everything a second time for no reason.
Comment 1 Guillaume Desmottes 2011-11-03 04:50:37 UTC
Created attachment 53100 [details] [review]
contact-list-client: make test path clearer
Comment 2 Guillaume Desmottes 2011-11-03 04:50:43 UTC
Created attachment 53102 [details] [review]
test that contact list properties are set
Comment 3 Guillaume Desmottes 2011-11-03 04:50:47 UTC
Created attachment 53103 [details] [review]
Add TP_CONNECTION_FEATURE_CONTACT_LIST_PROPERTIES

This feature is now a dependency on TP_CONNECTION_FEATURE_CONTACT_LIST so it
will be automatically prepared when preparing
TP_CONNECTION_FEATURE_CONTACT_LIST (so we don't break existing code)
Comment 4 Xavier Claessens 2011-11-04 02:32:31 UTC
Comment on attachment 53103 [details] [review]
Add TP_CONNECTION_FEATURE_CONTACT_LIST_PROPERTIES

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

::: telepathy-glib/connection-contact-list.c
@@ +423,4 @@
>        return;
>      }
>  
> +  /* Contacts will be prepared once the contact list has been fetched.

I would add that it refers to fetching contacts in CM from server,and not client from CM.

@@ +644,5 @@
>   * Expands to a call to a function that returns a #GQuark representing the
>   * "contact-list" feature.
>   *
> + * When this feature is prepared, the
> + * TP_CONNECTION_FEATURE_CONTACT_LIST_PROPERTIES has been prepared, so the

add a % before TP_CONNECTION_FEATURE_CONTACT_LIST_PROPERTIES

::: telepathy-glib/connection.c
@@ +1663,5 @@
>    need_contact_list[0] = TP_IFACE_QUARK_CONNECTION_INTERFACE_CONTACT_LIST;
>    need_contact_list[1] = TP_IFACE_QUARK_CONNECTION_INTERFACE_CONTACTS;
>    features[FEAT_CONTACT_LIST].interfaces_needed = need_contact_list;
> +  need_contact_list_props[0] = TP_CONNECTION_FEATURE_CONTACT_LIST_PROPERTIES;
> +  features[FEAT_CONTACT_LIST].depends_on = need_contact_list_props;

Seems we use names need_foo to set interfaces_needed, but here you use need_contact_list_props for depends_on. I would rename it to depends_contact_list, meaning the features contact_list depends on. no?
Comment 5 Guillaume Desmottes 2011-11-04 07:00:30 UTC
(In reply to comment #4)
> > +  /* Contacts will be prepared once the contact list has been fetched.
> 
> I would add that it refers to fetching contacts in CM from server,and not
> client from CM.

done.

> @@ +644,5 @@
> >   * Expands to a call to a function that returns a #GQuark representing the
> >   * "contact-list" feature.
> >   *
> > + * When this feature is prepared, the
> > + * TP_CONNECTION_FEATURE_CONTACT_LIST_PROPERTIES has been prepared, so the
> 
> add a % before TP_CONNECTION_FEATURE_CONTACT_LIST_PROPERTIES

done.

> ::: telepathy-glib/connection.c
> @@ +1663,5 @@
> >    need_contact_list[0] = TP_IFACE_QUARK_CONNECTION_INTERFACE_CONTACT_LIST;
> >    need_contact_list[1] = TP_IFACE_QUARK_CONNECTION_INTERFACE_CONTACTS;
> >    features[FEAT_CONTACT_LIST].interfaces_needed = need_contact_list;
> > +  need_contact_list_props[0] = TP_CONNECTION_FEATURE_CONTACT_LIST_PROPERTIES;
> > +  features[FEAT_CONTACT_LIST].depends_on = need_contact_list_props;
> 
> Seems we use names need_foo to set interfaces_needed, but here you use
> need_contact_list_props for depends_on. I would rename it to
> depends_contact_list, meaning the features contact_list depends on. no?

Good point; I renamed it.

Fixes are in http://cgit.collabora.com/git/user/cassidy/telepathy-glib/log/?h=contact-list-prop-42546
I'll squash them before merging if that's ok.
Comment 6 Xavier Claessens 2011-11-04 07:04:17 UTC
perfect, +1.
Comment 7 Guillaume Desmottes 2011-11-04 07:09:43 UTC
Merged to master; will be in 0.17.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.