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 767914 - Offer a simple mechanism to introspect the available providers and services
Offer a simple mechanism to introspect the available providers and services
Status: RESOLVED FIXED
Product: gnome-online-accounts
Classification: Core
Component: general
unspecified
Other All
: Normal enhancement
: ---
Assigned To: GNOME Online Accounts maintainer(s)
GNOME Online Accounts maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2016-06-21 15:38 UTC by Debarshi Ray
Modified: 2016-07-14 17:13 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
List services offered by each provider in machine & human readable form (1.39 KB, patch)
2016-07-08 13:47 UTC, Debarshi Ray
committed Details | Review
Tool to introspect available GoaProviders and their services (3.60 KB, text/x-csrc)
2016-07-11 14:55 UTC, Debarshi Ray
  Details
Tool to introspect available GoaProviders and their services (3.56 KB, text/x-csrc)
2016-07-12 13:42 UTC, Debarshi Ray
  Details
examples: Introspect the providers (6.21 KB, patch)
2016-07-14 17:13 UTC, Debarshi Ray
committed Details | Review

Description Debarshi Ray 2016-06-21 15:38:58 UTC
Configuration and deployment tools like Fleet Commander [1] want to have an user interface to pre-configure accounts. This user interface will likely be different from gnome-control-center because it will only create a skeleton representing certain aspects of an account but leave out details like the identity and presentation-identity.

It will be convenient if the various keys used by the providers are consolidated in an easy to parse (for both humans and machines) format. The Fleet Commander UI can read this file and create the account skeletons accordingly. Currently, one has to read the C code of each provider to gather this information, which involves human intervention.

libgoabackend.so can embed this file as a GResource, while Fleet Commander can keep a copy and update it periodically. I don't expect the keys to change too frequently, so this shouldn't be too bad in practice.

I am currently thinking of something like this:
[google]
MailEnabled=true
CalendarEnabled=true
ContactsEnabled=true
ChatEnabled=true
DocumentsEnabled=true
PhotosEnabled=true
PrintersEnabled=true

This is (a) easy for humans to update, (b) easily parsable with only GKeyFile and (c) matches the accounts.conf syntax.

Other options are JSON and XML since we already link against json-glib and libxml2.

[1] https://github.com/fleet-commander
Comment 1 Oliver Gutierrez 2016-06-21 15:52:56 UTC
For fleet-commander the easiest way to get the data would be JSON. Almost all our files are JSON based.
Comment 2 Debarshi Ray 2016-07-08 13:47:33 UTC
Created attachment 331082 [details] [review]
List services offered by each provider in machine & human readable form

This is a key file where each group represents a provider and contains all the Enabled keys (ie. switches) supported by it.

There are some complexities, though. The chat accounts are a bit special in the sense that there is only one 'telepathy' factory to deal with all the protocols (Jabber, SIP, etc.). The 'telepathy' factory creates GoaProviders at run-time based on the Telepathy backends available - Jabber is represented as 'telepathy/jabber', SIP as 'telepathy/sip', etc.. Given that the telepathy / libpurple bridge (ie. telepathy-haze) can expose dozens of unexpected protocols via libpurple plugins, it is impossible to exhaustively cover all of them.

One option is to list only the most relevant chat protocols. Or we can ignore them altogether since GNOME is slowly moving away from Telepathy and instant messaging these days.
Comment 3 Debarshi Ray 2016-07-08 14:10:07 UTC
Here is another idea ...

Instead of describing all the GoaProviders in a static key file and then making the gnome-online-accounts code use it, how about writing a small utility which will generate the key file based on the GoaProviders (and Telepathy backends) installed on the system?

Being able to introspect the GoaProviders at run-time and generate a description seems like a generally useful thing to do.

Tools like fleet-commander can even choose to generate this description during their build. Or they can generate it beforehand, have it committed to Git and manually update from time to time. The first option wouldn't be possible without introspection.
Comment 4 Debarshi Ray 2016-07-11 14:55:50 UTC
Created attachment 331230 [details]
Tool to introspect available GoaProviders and their services
Comment 5 Debarshi Ray 2016-07-12 13:42:29 UTC
Created attachment 331327 [details]
Tool to introspect available GoaProviders and their services

Improve the workaround for bug 674885
Comment 6 Debarshi Ray 2016-07-14 17:13:23 UTC
Created attachment 331524 [details] [review]
examples: Introspect the providers

Pushed to master.