Top | ![]() |
![]() |
![]() |
![]() |
ZeitgeistDataSourceZeitgeistDataSource — Abstracts data sources used by the ZeitgeistDataSourceRegistry extension |
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.
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.
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()
.
event |
A GVariant with signature defined in
ZEITGEIST_DATA_SOURCE_WITH_INFO_VARIANT_SIGNATURE.
If |
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.
id |
Unique ID for the data source. |
|
name |
Name of the data source (may be translated). |
|
desc |
Data source description. |
|
event_templates |
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
|
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.
src |
Instance of ZeitgeistDataSource. |
|
event_templates |
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
|
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.
GVariant *
zeitgeist_data_source_to_variant_full (ZeitgeistDataSource *src
);
Convert a ZeitgeistDataSource to a GVariant with signature ZEITGEIST_DATA_SOURCE_WITH_INFO_VARIANT_SIGNATURE.
GPtrArray *
zeitgeist_data_sources_from_variant (GVariant *sources
);
sources |
A GVariant with signature as an array of
ZEITGEIST_DATA_SOURCE_WITH_INFO_VARIANT_SIGNATURE.
If |
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.
events |
A GPtrArray of ZeitgeistDataSources. If the sources has
floating references they will be consumed. Furthermore the
reference on the GPtrArray itself will also be stolen and its
|