| Tracker Miner Library Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | ||||
#include <libtracker-miner/tracker-miner.h> #define TRACKER_MINER_WEB_ERROR_DOMAIN #define TRACKER_MINER_WEB_ERROR #define TRACKER_MINER_WEB_DBUS_INTERFACE typedef TrackerMinerWebPrivate; typedef TrackerMinerWeb; TrackerMinerWebClass; GQuark tracker_miner_web_error_quark (void); enum TrackerMinerWebError; void tracker_miner_web_associate (TrackerMinerWeb *miner,GHashTable *association_data,GError **error); void tracker_miner_web_authenticate (TrackerMinerWeb *miner,GError **error); void tracker_miner_web_dissociate (TrackerMinerWeb *miner,GError **error); GHashTable * tracker_miner_web_get_association_data (TrackerMinerWeb *miner,GError **error);
TrackerMinerWeb is an abstract base class for miners retrieving data from web services. It's a very thin layer above TrackerMiner, only adding virtual methods needed to handle association with the remote service.
#define TRACKER_MINER_WEB_DBUS_INTERFACE "org.freedesktop.Tracker1.MinerWeb"
typedef struct {
TrackerMinerClass parent_class;
/* vmethods */
void (* authenticate) (TrackerMinerWeb *miner,
GError **error);
GHashTable* (* get_association_data) (TrackerMinerWeb *miner,
GError **error);
void (* associate) (TrackerMinerWeb *miner,
const GHashTable *association_data,
GError **error);
void (* dissociate) (TrackerMinerWeb *miner,
GError **error);
} TrackerMinerWebClass;
For the authenticate function, a username/password can be used and
this should return an empty GHashTable. If the authentication is
based on a token, the following keys must be
returned in the GHashTable:
url: the url to point the user to.
Additionally, the miner may define the following keys:
post_message: a message to display after the user completes the association process.
post_url: a url to point the user to after they have completed the association.
If both post_message and post_url are defined, the message will be displayed before the url is opened.
For the associate function, in the case of a username/password
based authentication, the following keys must be defined:
username: the username.
password: the password.
In the case of a token based authentication, the GHashTable can be
ignored since it will be empty.
For the dissociate function, miners must
forget any user credentials stored.
TrackerMinerClass |
parent object class |
| called when a miner must authenticate against a remote service | |
| called when one requests the miner's associated data | |
| called when the miner is asked to associate a remote service | |
| called when the miner is asked to revoke an association with a remote service |
Since 0.8.
GQuark tracker_miner_web_error_quark (void);
Returns : |
the GQuark used to identify miner web errors in GError structures. |
typedef enum {
TRACKER_MINER_WEB_ERROR_WRONG_CREDENTIALS,
TRACKER_MINER_WEB_ERROR_TOKEN_EXPIRED,
TRACKER_MINER_WEB_ERROR_NO_CREDENTIALS,
TRACKER_MINER_WEB_ERROR_KEYRING,
TRACKER_MINER_WEB_ERROR_SERVICE,
TRACKER_MINER_WEB_ERROR_TRACKER
} TrackerMinerWebError;
The following errors are possible during any of the performed actions with a remote service.
| The credentials were refused by the remote service | |
| The remote service token has expired | |
| There are currenty no credentials stored for this service | |
The credential storage failed to
retrieve the relevant information. See TrackerPasswordProvider
|
|
| Could not contact the remote service | |
| Could not contact the Tracker service |
Since 0.8
void tracker_miner_web_associate (TrackerMinerWeb *miner,GHashTable *association_data,GError **error);
Asks miner to associate with a remote service using
association_data. To know what data to put into association_data,
see TrackerMinerWebClass for more
information.
On failure error will be set.
|
a TrackerMinerWeb |
|
a GHashTable with the data to use for
associating with a remote service.
|
|
return location for errors |
void tracker_miner_web_authenticate (TrackerMinerWeb *miner,GError **error);
Asks miner to authenticate with a remote service. On failure
error will be set.
|
a TrackerMinerWeb |
|
return location for errors |
void tracker_miner_web_dissociate (TrackerMinerWeb *miner,GError **error);
Asks miner to dissociate from a remote service. At this point, the
miner should stop storing any credentials or sensitive information
which could be used to authenticate with the remote service.
On failure error will be set.
|
a TrackerMinerWeb |
|
return location for errors |
GHashTable * tracker_miner_web_get_association_data (TrackerMinerWeb *miner,GError **error);
Asks miner to retrieve association_data for. The data returned in
the GHashTable depends on the miner implementation and the type
of authentication. See TrackerMinerWebClass
for more information.
|
a TrackerMinerWeb |
|
return location for errors |
Returns : |
a GHashTable with the data. On failure error will be set
and NULL will be returned.
|