GNOME Bugzilla – Bug 642493
Folks needs API for specifying a contact's organisation
Last modified: 2011-03-03 00:17:21 UTC
We should probably start with a trivial interface like namespace Folks { interface OrganisationOwner : { public string name { get; set; } } } and have Individual and each of the backends' Persona implementations implement it. We'll add more fields later if necessary (following the YAGNI principle).
Created attachment 182201 [details] [review] Add RoleOwner interface The RoleOwner interface allows each Individual to have various roles (coming from one or many personas) attached. Each Role is represented by the Role class that exposes the organisation's name (to which the role is associated) along with the name of the role.
Review of attachment 182201 [details] [review]: individual.vala =================== - Urlable + Urlable, + RoleOwner This should be in alphabetical order instead + var r2 = r.dup (); + roles.add ((owned) r2); We shouldn't need the dup() function. Since Role is an object, Vala will automatically ref and unref as needed (and we won't need to do expensive string copies). role-owner.vala =================== + * @since 0.3.7 Change the instances of these to @since 0.3.UNRELEASED, and we'll update them all at once just before release. + /** + * Compare if 2 roles are equal + */ + public static bool equal (Role a, Role b) + { + return a.role == b.role && + a.organisation_name == b.organisation_name; + } Use some () to make the grouping more obvious + /** + * The name of held. + */ Should be something like "Name of the position held". + public string role { get; set; } + This should probably be "title", just to be distinct from the name of the class. + public Role dup () + { + var ret = new Role (); + ret.role = this.role; + ret.organisation_name = this.organisation_name; + return ret; + } This is unnecessary and expensive, for the reasons explained above.
Created attachment 182207 [details] [review] list the implemented interfaces in alphabetical order for claritiy I am keeping this separately for clarity.
Created attachment 182208 [details] [review] Add RoleOwner interface
Review of attachment 182207 [details] [review]: Looks good
Review of attachment 182208 [details] [review]: Looks good
Created attachment 182241 [details] [review] Add RoleOwner interface Added a default constructor to the Role class.
Created attachment 182254 [details] [review] Add RoleOwner interface Added the uid field that might be handy for some cases.
Review of attachment 182254 [details] [review]: Looks good. Please merge.
I have no credentials for the canonical repo.
Created attachment 182274 [details] [review] Add RoleOwner interface Corrected small typo in a comment.
Created attachment 182275 [details] [review] Add RoleOwner interface
Thanks! Merged: commit 4c09f5839fd9f93400a7d03cd8a18e430395b7d8 Author: Travis Reitter <travis.reitter@collabora.co.uk> Date: Wed Mar 2 16:10:27 2011 -0800 Update NEWS for RoleOwner. NEWS | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) commit a292acae512f76932e2ae95cd143df89e3e27ecd Author: Raul Gutierrez Segales <raul.gutierrez.segales@collabora.co.uk> Date: Tue Mar 1 19:09:14 2011 +0000 Add RoleOwner interface for contacts that belong to an Organisation folks/Makefile.am | 1 + folks/individual.vala | 47 ++++++++++++++++++++ folks/role-owner.vala | 112 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 160 insertions(+), 0 deletions(-) commit e23104201cc9a4d49a5198ae7a2b12953cb1055f Author: Raul Gutierrez Segales <raul.gutierrez.segales@collabora.co.uk> Date: Tue Mar 1 19:49:45 2011 +0000 List the implemented interfaces in alphabetical order folks/individual.vala | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)