This site has been retired. For up to date information, see handbook.gnome.org or gitlab.gnome.org.


[Home] [TitleIndex] [WordIndex

Configuration of DataProvider

<!> This page is only a draft and is still work in progress

All passive DataProvider can be configured either via DBus or by changing its configuration in a configfile.

Options

Per default each DataProvider has a configurable option called enabled, which is per default set to True.

Config-File

The config file for dataproviders is placed in

    ~/.config/zeitgeist/dataproviders.conf

Each DataProvider can have its own section here. To globally disable the firefox dataprovider just change/add the [firefox_history] like:

    [firefox_history]
    enabled = False

Configuration over DBus

Each DataProvider can have its own Configuration service. All configuration services are using the SessionBus with

    'org.gnome.zeitgeist.datahub'

as bus name.

The bus path is different for each DataProvider, it is like

    '/org/gnome/zeitgeist/datahub/dataprovider/$NAME'

where $NAME is the name of the DataProvider.

To find out which dataprovider are configurable over DBus send request the GetDataProviders method of the service root:

    dbus-send --print-reply --dest=org.gnome.zeitgeist.datahub \
        /org/gnome/zeitgeist/datahub \
        org.gnome.zeitgeist.DataHub.GetDataProviders

This returns a list of all valid values for $NAME.

The first thing which has to be done by a client in order to change the configuration of a DataProvider is to request a ConfigToken. To request such token send a random integer to to the RequestSetupRun method of a DataProvider's Configuration service:

    dbus-send --print-reply --dest=org.gnome.zeitgeist.datahub \
        /org/gnome/zeitgeist/datahub/dataprovider/firefox_history \
        org.gnome.zeitgeist.DataHub.RequestSetupRun \
        int32:123456

The Configuration service returns True if this token can be used for further configurations or returns False if this client is not allowed to change the configuration. One possible reason is that already another client is configuring the DataProvider.

To get a list of all options for a DataProvider run:

    dbus-send --print-reply --dest=org.gnome.zeitgeist.datahub \
        /org/gnome/zeitgeist/datahub/dataprovider/firefox_history \
        org.gnome.zeitgeist.DataHub.GetOptions \
        int32:123456

This returns a list of tuples, where the first element of each tuple is the name of the option and the second is True is this option is required, otherwise it's False.

To actually change an option, send to the set_configuration method something like:

    dbus-send --print-reply --dest=org.gnome.zeitgeist.datahub \
        /org/gnome/zeitgeist/datahub/dataprovider/firefox_history \
        org.gnome.zeitgeist.DataHub.SetConfiguration \
        int32:123456 \
        string:"enabled" string:"1"

The first argument is always the accepted token of the first step. Followed by the name of the option to change and the new value. All values have to be send as string. The configuration service is smart enough to convert this string to the correct type.

More complex Configuration (not implemented yet)

The launchpad DataProvider in zeitgeist_launchpad.py is already using a more complex way of configuration. In order to authenticate with launchpad a user needs credentials. This credentials are stored in the gnome-keyring. When no credentials are found in the keyring, the user has to create such credentials by:

    dbus-send --print-reply --dest=org.gnome.zeitgeist.datahub \
        /org/gnome/zeitgeist/datahub/dataprovider/launchpad \
        org.gnome.zeitgeist.DataHub.RequestSetupRun \
        int32:123456
        
    dbus-send --print-reply --dest=org.gnome.zeitgeist.datahub \
        /org/gnome/zeitgeist/datahub/dataprovider/launchpad \
        org.gnome.zeitgeist.DataHub.SetConfiguration \
        int32:123456 \
        string:"login" string:"yourlogin@email.com"
        
    dbus-send --print-reply --dest=org.gnome.zeitgeist.datahub \
        /org/gnome/zeitgeist/datahub/dataprovider/launchpad \
        org.gnome.zeitgeist.DataHub.SetConfiguration \
        int32:123456 \
        string:"password" string:"yoursecretpassword"

This will request the credentials, store them in the keyring and create a Launchpad object to access launchpad.net via the API. If all this succedes the DataProvider will start to collect the data. password and login are secret options, so they will never be stored to the config file. launchpad's configuration has also optional options like service (staging or edge) or access_level.


2024-10-23 11:37