![]() |
![]() |
![]() |
API Documentation for the Zeitgeist Client Library | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy |
ZeitgeistDataSourceZeitgeistDataSource — Abstracts data sources used by the ZeitgeistDataSourceRegistry extension |
#include <zeitgeist.h> ZeitgeistDataSource; struct ZeitgeistDataSourceClass; const gchar * zeitgeist_data_source_get_description (ZeitgeistDataSource *src
); GPtrArray * zeitgeist_data_source_get_event_templates (ZeitgeistDataSource *src
); const gchar * zeitgeist_data_source_get_name (ZeitgeistDataSource *src
); gint64 zeitgeist_data_source_get_timestamp (ZeitgeistDataSource *src
); const gchar * zeitgeist_data_source_get_unique_id (ZeitgeistDataSource *src
); gboolean zeitgeist_data_source_is_enabled (ZeitgeistDataSource *src
); gboolean zeitgeist_data_source_is_running (ZeitgeistDataSource *src
); ZeitgeistDataSource * zeitgeist_data_source_new (void
); ZeitgeistDataSource * zeitgeist_data_source_new_from_variant (GVariant *src
); ZeitgeistDataSource * zeitgeist_data_source_new_full (const gchar *id
,const gchar *name
,const gchar *desc
,GPtrArray *event_templates
); void zeitgeist_data_source_set_description (ZeitgeistDataSource *src
,const gchar *description
); void zeitgeist_data_source_set_enabled (ZeitgeistDataSource *src
,gboolean enabled
); void zeitgeist_data_source_set_event_templates (ZeitgeistDataSource *src
,GPtrArray *event_templates
); void zeitgeist_data_source_set_name (ZeitgeistDataSource *src
,const gchar *name
); void zeitgeist_data_source_set_running (ZeitgeistDataSource *src
,gboolean running
); void zeitgeist_data_source_set_timestamp (ZeitgeistDataSource *src
,gint64 timestamp
); void zeitgeist_data_source_set_unique_id (ZeitgeistDataSource *src
,const gchar *unique_id
); GVariant * zeitgeist_data_source_to_variant (ZeitgeistDataSource *src
); GVariant * zeitgeist_data_source_to_variant_full (ZeitgeistDataSource *src
); GPtrArray * zeitgeist_data_sources_from_variant (GVariant *sources
); GVariant * zeitgeist_data_sources_to_variant (GPtrArray *sources
);
ZeitgeistDataSource represents a data source used to insert events into Zeitgeist. The data sources are identified using the unique_id property, and when querying the data source registry you get other interesting information like timestamp of the last action of the data source, flag whether it is currently running etc.
struct ZeitgeistDataSourceClass { GInitiallyUnownedClass parent_class; };
const gchar * zeitgeist_data_source_get_description
(ZeitgeistDataSource *src
);
GPtrArray * zeitgeist_data_source_get_event_templates
(ZeitgeistDataSource *src
);
const gchar * zeitgeist_data_source_get_name (ZeitgeistDataSource *src
);
gint64 zeitgeist_data_source_get_timestamp (ZeitgeistDataSource *src
);
const gchar * zeitgeist_data_source_get_unique_id (ZeitgeistDataSource *src
);
gboolean zeitgeist_data_source_is_enabled (ZeitgeistDataSource *src
);
gboolean zeitgeist_data_source_is_running (ZeitgeistDataSource *src
);
ZeitgeistDataSource * zeitgeist_data_source_new (void
);
Create a new empty data source structure.
Returns : |
A new instance of ZeitgeistDataSource. The returned source will
have a floating reference which will be consumed if you pass the
data source to any of the methods provided by this library (like
registering the data source). If you do not do that then you
must free the data source yourself with g_object_unref() . |
ZeitgeistDataSource * zeitgeist_data_source_new_from_variant
(GVariant *src
);
Parse the data in a GVariant and build a ZeitgeistDataSource from it.
The reverse operation of this is zeitgeist_data_source_to_variant_full()
.
Returns : |
A newly allocated ZeitgeistDataSource filled with the metadata and
event templates described by src . The returned data source will
have a floating reference which will be consumed if you pass the
data source to any of the methods provided by this library. If you
do not do that then you must free the data source yourself with
g_object_unref()
|
ZeitgeistDataSource * zeitgeist_data_source_new_full (const gchar *id
,const gchar *name
,const gchar *desc
,GPtrArray *event_templates
);
Creates a new instance of DataSource with the given ID, name and description.
|
Unique ID for the data source. |
|
Name of the data source (may be translated). |
|
Data source description. |
|
A GPtrArray of ZeitgeistEvents. This parameter
is optional and purely informational to let data-source
management applications and other data-sources know what
sort of information the data source logs.
The data source will assume ownership of the events and
the pointer array.
If you want to keep a reference for yourself you must do a
g_ptr_array_ref() on event_templates as well as reffing
the events held by it before calling this method. |
Returns : |
New instance of ZeitgeistDataSource with floating reference,
if you do not pass the instance to method like
zeitgeist_data_source_registry_register_data_source() , then you
have to free the data source yourself using g_object_unref() . |
void zeitgeist_data_source_set_description (ZeitgeistDataSource *src
,const gchar *description
);
void zeitgeist_data_source_set_enabled (ZeitgeistDataSource *src
,gboolean enabled
);
void zeitgeist_data_source_set_event_templates (ZeitgeistDataSource *src
,GPtrArray *event_templates
);
Sets event templates which are logged by this ZeitgeistDataSource instance.
|
Instance of ZeitgeistDataSource. |
|
A GPtrArray which contains elements of type
ZeitgeistEvent.
The data source will assume ownership of the events and
the pointer array.
If you want to keep a reference for yourself you must do a
g_ptr_array_ref() on templates as well as reffing
the events held by it before calling this method. |
void zeitgeist_data_source_set_name (ZeitgeistDataSource *src
,const gchar *name
);
void zeitgeist_data_source_set_running (ZeitgeistDataSource *src
,gboolean running
);
void zeitgeist_data_source_set_timestamp (ZeitgeistDataSource *src
,gint64 timestamp
);
void zeitgeist_data_source_set_unique_id (ZeitgeistDataSource *src
,const gchar *unique_id
);
GVariant * zeitgeist_data_source_to_variant (ZeitgeistDataSource *src
);
Convert a ZeitgeistDataSource to a GVariant with signature ZEITGEIST_DATA_SOURCE_VARIANT_SIGNATURE.
Returns : |
A floating reference to a GVariant as described above. Unless the
floating reference is consumed somewhere you must free it with
g_variant_unref() . |
GVariant * zeitgeist_data_source_to_variant_full
(ZeitgeistDataSource *src
);
Convert a ZeitgeistDataSource to a GVariant with signature ZEITGEIST_DATA_SOURCE_WITH_INFO_VARIANT_SIGNATURE.
Returns : |
A floating reference to a GVariant as described above. Unless the
floating reference is consumed somewhere you must free it with
g_variant_unref() . |
GPtrArray * zeitgeist_data_sources_from_variant (GVariant *sources
);
|
A GVariant with signature as an array of
ZEITGEIST_DATA_SOURCE_WITH_INFO_VARIANT_SIGNATURE.
If sources is floating this method will consume
the floating reference. |
Returns : |
A reference to a GPtrArray of ZeitgeistDataSources.
All the events will be floating references, and the
GPtrArray's free_func will be set to g_object_unref() . |
GVariant * zeitgeist_data_sources_to_variant (GPtrArray *sources
);
Convert a set of ZeitgeistDataSource<-- -->s to a GVariant with signature as an array of ZEITGEIST_DATA_SOURCE_VARIANT_SIGNATURE.
Returns : |
A floating reference to a GVariant as described above. Unless the
floating reference is consumed somewhere you must free it with
g_variant_unref() . |