Skip to content

WIP: RFC: Additional application actions

Michael Gratton requested to merge wip/mjog/extended-actions into main

This is a RFC for adding two more application actions to Contacts, so that Geary can properly integrate with EDS as an addressbook for 3.34.

I'd like Geary to leave effectively all contact management to Contacts, however we still need a means to a) create new contacts based on a known name and email address, and b) display existing an existing Folks individual in Contacts for a specific email address. See geary#135 (closed) for the approach being taken. To that end, this WIP adds two GApplication actions to Contacts, show-contact and create-contact.

The first is trivial, basically a DBus-activatable version of the existing -i command line arg. However, by calling this via DBus rather than spawning a new process, we can get this working under Flatpak as well as for regular installations.

The second create-contact action is a bit more work, and needs a bit more polish still (hence the WIP). It's basically the same as the existing new-contact action, however this takes an array of (string,string) tuples, effectively forming a multi-map. The keys are values returned by Folks.PersonaStore.detail_key(), the values are strings that will be used to prefill the GTK text entries in the ContactEditor. When another process invokes this action, the editor will be shown with entries prefilled with any supplied data. People can then review, edit and when happy hit the create button.

This approach is used instead of creating a new individual directly in Folks and updating it, since it not only gives people that chance review and edit in Contacts beforehand, but also reinforces the use of Contacts as the address book, leverages all of the existing code and UI in Contacts for doing this, also works when running under Flatpak, and like Flatpak portals provides an implicit way of asking people for permission to update their addressbook, rather than just doing it.

So with that spiel out of the way, I'm pretty happy with the code changes in general, for create-contact though some more work is needed in contacts-contact-editor.vala. I've only implemented prefilling the display name and email address since that's all Geary needs, and testing it out with Geary there's a bunch of warnings when doing the prefilling. My approach was a bit of a hack, any suggestions for a better way of implementing it would be gratefully accepted. :)

Thoughts?

Merge request reports