## ZeitgeistDataSource ZeitgeistDataSource — Abstracts data sources used by the ZeitgeistDataSourceRegistry extension |

## Synopsis

    #include <zeitgeist.h>

                        ZeitgeistDataSource;
    struct              ZeitgeistDataSourceClass;
    ZeitgeistDataSource *  zeitgeist_data_source_new        (void);
    ZeitgeistDataSource *  zeitgeist_data_source_new_full   (const gchar *id,
                                                             const gchar *name,
                                                             const gchar *desc,
                                                             GPtrArray *event_templates);
    ZeitgeistDataSource *  zeitgeist_data_source_new_from_variant
                                                            (GVariant *src);
    const gchar *       zeitgeist_data_source_get_unique_id (ZeitgeistDataSource *src);
    void                zeitgeist_data_source_set_unique_id (ZeitgeistDataSource *src,
                                                             const gchar *unique_id);
    const gchar *       zeitgeist_data_source_get_name      (ZeitgeistDataSource *src);
    void                zeitgeist_data_source_set_name      (ZeitgeistDataSource *src,
                                                             const gchar *name);
    const gchar *       zeitgeist_data_source_get_description
                                                            (ZeitgeistDataSource *src);
    void                zeitgeist_data_source_set_description
                                                            (ZeitgeistDataSource *src,
                                                             const gchar *description);
    GPtrArray *         zeitgeist_data_source_get_event_templates
                                                            (ZeitgeistDataSource *src);
    void                zeitgeist_data_source_set_event_templates
                                                            (ZeitgeistDataSource *src,
                                                             GPtrArray *event_templates);
    gboolean            zeitgeist_data_source_is_running    (ZeitgeistDataSource *src);
    void                zeitgeist_data_source_set_running   (ZeitgeistDataSource *src,
                                                             gboolean running);
    gint64              zeitgeist_data_source_get_timestamp (ZeitgeistDataSource *src);
    void                zeitgeist_data_source_set_timestamp (ZeitgeistDataSource *src,
                                                             gint64 timestamp);
    gboolean            zeitgeist_data_source_is_enabled    (ZeitgeistDataSource *src);
    void                zeitgeist_data_source_set_enabled   (ZeitgeistDataSource *src,
                                                             gboolean enabled);
    GVariant *          zeitgeist_data_source_to_variant    (ZeitgeistDataSource *src);
    GVariant *          zeitgeist_data_sources_to_variant   (GPtrArray *sources);
    GPtrArray *         zeitgeist_data_sources_from_variant (GVariant *sources);
    #define             ZEITGEIST_DATA_SOURCE_VARIANT_SIGNATURE
    #define             ZEITGEIST_DATA_SOURCE_VARIANT_TYPE

## Object Hierarchy

      GObject
       +----GInitiallyUnowned
             +----ZeitgeistDataSource

## Description

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.

## Details

### ZeitgeistDataSource

    typedef struct _ZeitgeistDataSource ZeitgeistDataSource;

### struct ZeitgeistDataSourceClass

    struct ZeitgeistDataSourceClass {
      GInitiallyUnownedClass parent_class;
    };

### zeitgeist_data_source_new ()

    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()`.

### zeitgeist_data_source_new_full ()

    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 `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()`.

### zeitgeist_data_source_new_from_variant ()

    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()`

### zeitgeist_data_source_get_unique_id ()

    const gchar *       zeitgeist_data_source_get_unique_id (ZeitgeistDataSource *src);

### zeitgeist_data_source_set_unique_id ()

    void                zeitgeist_data_source_set_unique_id (ZeitgeistDataSource *src,
                                                             const gchar *unique_id);

### zeitgeist_data_source_get_name ()

    const gchar *       zeitgeist_data_source_get_name      (ZeitgeistDataSource *src);

### zeitgeist_data_source_set_name ()

    void                zeitgeist_data_source_set_name      (ZeitgeistDataSource *src,
                                                             const gchar *name);

### zeitgeist_data_source_get_description ()

    const gchar *       zeitgeist_data_source_get_description
                                                            (ZeitgeistDataSource *src);

### zeitgeist_data_source_set_description ()

    void                zeitgeist_data_source_set_description
                                                            (ZeitgeistDataSource *src,
                                                             const gchar *description);

### zeitgeist_data_source_get_event_templates ()

    GPtrArray *         zeitgeist_data_source_get_event_templates
                                                            (ZeitgeistDataSource *src);

### zeitgeist_data_source_set_event_templates ()

    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 `g_ptr_array_ref()` on `templates` as well as reffing the events held by it before calling this method.

### zeitgeist_data_source_is_running ()

    gboolean            zeitgeist_data_source_is_running    (ZeitgeistDataSource *src);

### zeitgeist_data_source_set_running ()

    void                zeitgeist_data_source_set_running   (ZeitgeistDataSource *src,
                                                             gboolean running);

### zeitgeist_data_source_get_timestamp ()

    gint64              zeitgeist_data_source_get_timestamp (ZeitgeistDataSource *src);

### zeitgeist_data_source_set_timestamp ()

    void                zeitgeist_data_source_set_timestamp (ZeitgeistDataSource *src,
                                                             gint64 timestamp);

### zeitgeist_data_source_is_enabled ()

    gboolean            zeitgeist_data_source_is_enabled    (ZeitgeistDataSource *src);

### zeitgeist_data_source_set_enabled ()

    void                zeitgeist_data_source_set_enabled   (ZeitgeistDataSource *src,
                                                             gboolean enabled);

### zeitgeist_data_source_to_variant ()

    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()`.

### zeitgeist_data_sources_to_variant ()

    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()`.

### zeitgeist_data_sources_from_variant ()

    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 `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()`.

### ZEITGEIST_DATA_SOURCE_VARIANT_SIGNATURE

    #define ZEITGEIST_DATA_SOURCE_VARIANT_SIGNATURE "(sssa(asaasay))"

The GVariant signature for a serialized ZeitgeistDataSource

### ZEITGEIST_DATA_SOURCE_VARIANT_TYPE

    #define ZEITGEIST_DATA_SOURCE_VARIANT_TYPE G_VARIANT_TYPE(ZEITGEIST_DATA_SOURCE_VARIANT_SIGNATURE)

The GVariantType of ZEITGEIST_DATA_SOURCE_VARIANT_SIGNATURE