After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 641211 - Add arbitrary-field interface for applications to store trivial per-person data
Add arbitrary-field interface for applications to store trivial per-person data
Status: RESOLVED FIXED
Product: folks
Classification: Platform
Component: libfolks
git master
Other Linux
: Normal enhancement
: Future
Assigned To: Rodrigo Moya
folks-maint
Depends on: 638279
Blocks:
 
 
Reported: 2011-02-02 02:00 UTC by Travis Reitter
Modified: 2015-01-20 17:44 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add ExtendedInfo interface and implementation in EDS backend (16.45 KB, patch)
2014-12-17 11:56 UTC, Philip Withnall
none Details | Review
core: Add an ExtendedInfo interface for storing arbitrary fields (11.78 KB, patch)
2015-01-20 15:18 UTC, Philip Withnall
committed Details | Review
eds: Implement ExtendedInfo interface (9.96 KB, patch)
2015-01-20 15:18 UTC, Philip Withnall
committed Details | Review

Description Travis Reitter 2011-02-02 02:00:16 UTC
+++ This bug was initially created as a clone of Bug #638279 +++

Folks clients could benefit from the ability to store trivial per-person data. Eg, Evolution's per-contact "wants HTML email" field.

This would make it easier for the data to be kept sync'd with Individuals and could mean the difference between needing maintaining their own "add-on" database or not.

Any client that wants to store non-trivial data should use their own database instead of this interface. This also points out a potential risk about adding this interface in the first place.

See bug #638279 for prior discussion.
Comment 1 Philip Withnall 2011-02-06 10:49:56 UTC
Do we have a use case for this (i.e. a program for which this functionality would already be useful)? Is this really something to get done for folks 0.3.5?
Comment 2 Philip Withnall 2011-02-14 23:13:50 UTC
Punting to 0.3.7.
Comment 3 Travis Reitter 2011-08-01 18:39:19 UTC
Punting bugs that won't be fixed by Folks 0.6.0.
Comment 4 Travis Reitter 2011-11-10 17:43:42 UTC
This should probably just be based upon exposing a raw vCard for a Persona/Individual. That would let us also expose arbitrary vCard attributes we received from sources but couldn't fit into our structured classes.

See bug#663715 comment#1
Comment 5 Rodrigo Moya 2013-06-18 15:18:32 UTC
Going to work on this, so taking this bug
Comment 6 Rodrigo Moya 2013-06-24 11:47:36 UTC
After some investigation on the previous discussions, I think we could do a couple things:

* Add ExtendedInfoDetails interface, but making clear this is for fields that are not in the vcard spec, to avoid the problem of one backend supporting a field via ExtendedInfo and then having to implement the new interface if that field is later on supported in its own interface. The API for this would be a simple key/value pair API, maybe supporting AbstractFieldDetails so that parameters can be included in the field's value if needed.
Also, maybe there should be API for retrieving a human readable description of the key, like X-MOZILLA-HTML (from eds) would give "Wants HTML email".

* (maybe) move BirthdayDetails to a PersonalDetails and add there anniversary, spouse, and merge role also? This would be to reduce the number of interfaces, if wanted

Anything I have missed?
Comment 7 Philip Withnall 2013-06-26 11:59:29 UTC
(In reply to comment #6)
> * Add ExtendedInfoDetails interface, but making clear this is for fields that
> are not in the vcard spec, to avoid the problem of one backend supporting a
> field via ExtendedInfo and then having to implement the new interface if that
> field is later on supported in its own interface. The API for this would be a
> simple key/value pair API, maybe supporting AbstractFieldDetails so that
> parameters can be included in the field's value if needed.

Sounds good.

> Also, maybe there should be API for retrieving a human readable description of
> the key, like X-MOZILLA-HTML (from eds) would give "Wants HTML email".

I’m not sure about this. If an application is displaying/modifying a particular key, I think it will need some inbuilt knowledge about the key’s meaning. Relying on folks to provide that just means we’d have to keep adding more complexity (e.g. some way of rendering the correct widget for displaying/editing the key; some way of knowing when to enable editing for it; etc.)

> * (maybe) move BirthdayDetails to a PersonalDetails and add there anniversary,
> spouse, and merge role also? This would be to reduce the number of interfaces,
> if wanted

Moving the existing API would be a pain. How about creating a new FamilyDetails, and putting anniversary and spouse there? Roles are to do with positions of responsibility at work, not the family, so wouldn’t fit in either.
Comment 8 Travis Reitter 2013-07-01 17:45:10 UTC
(In reply to comment #6)

> * (maybe) move BirthdayDetails to a PersonalDetails and add there anniversary,
> spouse, and merge role also? This would be to reduce the number of interfaces,
> if wanted

Like Philip said, first and foremost, I want to bundle together any API changes for Folks 0.90.x, where we will stabilize before freezing for 1.0.

But beyond that, do you have specific uses in mind for anniversary and spouse? I know they're defined vCard fields but they've always seemed very "tick the feature box" to me because I can't think of any compelling use cases that require those fields. The only anniversaries (not counting birthdays) anyone really cares about is their wedding anniversary and maybe those of close relatives. In that case, they probably have them memorized, added to their calendar, or otherwise don't need them in their contacts store.

Relationships between people can be interesting but that's better left to specialized apps focused on, eg, geneology, or huge-network-scale applications like Facebook, where the relationships will be maintained by the people involved. I wouldn't want to spend any time manually adding relationships to the contacts in my address book. Again, the ones I care about I have memorized.

If we have a true arbitrary-field interface, applications can still add their own "x-anniversaryapp-anniverary" field if they really want
Comment 9 Rodrigo Moya 2013-07-08 12:10:11 UTC
(In reply to comment #8)
> (In reply to comment #6)
> 
> > * (maybe) move BirthdayDetails to a PersonalDetails and add there anniversary,
> > spouse, and merge role also? This would be to reduce the number of interfaces,
> > if wanted
> 
> Like Philip said, first and foremost, I want to bundle together any API changes
> for Folks 0.90.x, where we will stabilize before freezing for 1.0.
> 
> But beyond that, do you have specific uses in mind for anniversary and spouse?
> I know they're defined vCard fields but they've always seemed very "tick the
> feature box" to me because I can't think of any compelling use cases that
> require those fields. The only anniversaries (not counting birthdays) anyone
> really cares about is their wedding anniversary and maybe those of close
> relatives. In that case, they probably have them memorized, added to their
> calendar, or otherwise don't need them in their contacts store.
> 
> Relationships between people can be interesting but that's better left to
> specialized apps focused on, eg, geneology, or huge-network-scale applications
> like Facebook, where the relationships will be maintained by the people
> involved. I wouldn't want to spend any time manually adding relationships to
> the contacts in my address book. Again, the ones I care about I have memorized.
> 
> If we have a true arbitrary-field interface, applications can still add their
> own "x-anniversaryapp-anniverary" field if they really want

yes, was just adding this to the "plan" as I read in the previous discussions the will to limit the number of interfaces. But tbh, anniversary and spouse are, IMO, quite useless fiels, just that they are in both VCARD and EDS, so I thought we could want to support them. But as you said, this can easily be added, if any app wants to, via the arbitrary-field interface.

And about that, here's a branch for a 1st review:

https://git.gnome.org/browse/folks/log/?h=wip/arbitrary-field-interface

still not working for me. I am writing a test suite but can't make it work, so I guess I am missing something, so would appreciate a quick review to see if I have missed anything.
Comment 10 Philip Withnall 2013-07-09 15:06:57 UTC
(In reply to comment #8)
> But beyond that, do you have specific uses in mind for anniversary and spouse?
> I know they're defined vCard fields but they've always seemed very "tick the
> feature box" to me because I can't think of any compelling use cases that
> require those fields.

I personally find the anniversary field quite useful, since I can never memorise dates, but I still want Evo to automatically create a calendar event for everyone’s anniversary. Spouse is useless though.

> Relationships between people can be interesting but that's better left to
> specialized apps focused on, eg, geneology, or huge-network-scale applications
> like Facebook

Agreed.

(In reply to comment #9)
> And about that, here's a branch for a 1st review:
> 
> https://git.gnome.org/browse/folks/log/?h=wip/arbitrary-field-interface

What doesn’t work about it? I’ve had a quick browse through, but it would be a lot easier to review if you attached the patches here.

Some quick comments:

> + * @since 0.9.4
Please use “@since UNRELEASED” so the branches don’t need changing if this misses a minor release. We replace ‘UNRELEASED’ as part of the release process.

There’s some messed up whitespace around the ExtendedFieldDetails constructor. Folks does not use tabs.

There doesn’t seem to be any API (or documentation of API) for removing a named ExtendedFieldDetails in the ExtendedInfo interface. Similarly, there’s no way to tell whether a named ExtendedFieldDetails exists. get_extended_field() should be documented to return null in that case, and its return value should be nullable (‘ExtendedFieldDetails?’).

> + if ("extended_info" in p.writeable_properties)
That should be “extended-info” with a hyphen. The canonical way to refer to name GObject properties is to use hyphens, not underscores.
Comment 11 Rodrigo Moya 2013-09-25 10:17:43 UTC
Just pushed the last changes to https://git.gnome.org/browse/folks/log/?h=wip/arbitrary-field-interface . It now works, just missing the test case, which I'll submit soon.
Comment 12 Philip Withnall 2013-09-28 23:39:41 UTC
(In reply to comment #11)
> just missing the test case, which I'll submit soon.

When you do, please produce a git-formatted patch and attach it here for review. Thanks!
Comment 13 Philip Withnall 2014-12-17 11:56:42 UTC
Created attachment 292895 [details] [review]
Add ExtendedInfo interface and implementation in EDS backend

Implement ExtendedInfo in Individual

Add ExtendedInfo interface EDS test
Comment 14 Philip Withnall 2014-12-17 11:57:48 UTC
(In reply to comment #13)
> Created an attachment (id=292895) [details] [review]
> Add ExtendedInfo interface and implementation in EDS backend
> 
> Implement ExtendedInfo in Individual
> 
> Add ExtendedInfo interface EDS test

This is a slightly updated version of the patch incorporating a few internal changes. It still needs to be checked wrt the review comments above.

I’ve updated the wip/arbitrary-field-details branch.
Comment 15 Philip Withnall 2015-01-20 15:18:46 UTC
Created attachment 295000 [details] [review]
core: Add an ExtendedInfo interface for storing arbitrary fields

This adds a new interface which allows clients to store arbitrary fields
in backends. No backends currently implement it, but that will change.

See the documentation for reasoning about when it’s appropriate to use
this interface.

New API:
 • ExtendedInfo interface
 • ExtendedFieldDetails class
 • Individual now implements ExtendedInfo
Comment 16 Philip Withnall 2015-01-20 15:18:51 UTC
Created attachment 295001 [details] [review]
eds: Implement ExtendedInfo interface

Store extended info fields as arbitrary vCard properties.
Comment 17 Philip Withnall 2015-01-20 15:19:27 UTC
Comment on attachment 292895 [details] [review]
Add ExtendedInfo interface and implementation in EDS backend

Updated patches which address all the review issues, pass unit tests, and I think are ready to commit.
Comment 18 Jeremy Whiting 2015-01-20 17:10:35 UTC
Looks fine to me.
Comment 19 Philip Withnall 2015-01-20 17:44:47 UTC
Great, thanks, merged!

Attachment 295000 [details] pushed as 31018a7 - core: Add an ExtendedInfo interface for storing arbitrary fields
Attachment 295001 [details] pushed as 699bf9a - eds: Implement ExtendedInfo interface