## ZeitgeistDataSourceRegistry ZeitgeistDataSourceRegistry — Query the Zeitgeist Data Source Registry extension |

## Synopsis

    #include <zeitgeist.h>

                        ZeitgeistDataSourceRegistry;
    struct              ZeitgeistDataSourceRegistryClass;
    ZeitgeistDataSourceRegistry *  zeitgeist_data_source_registry_new
                                                            (void);
    void                zeitgeist_data_source_registry_get_data_sources
                                                            (ZeitgeistDataSourceRegistry *self,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    GPtrArray *         zeitgeist_data_source_registry_get_data_sources_finish
                                                            (ZeitgeistDataSourceRegistry *self,
                                                             GAsyncResult *res,
                                                             GError **error);
    void                zeitgeist_data_source_registry_register_data_source
                                                            (ZeitgeistDataSourceRegistry *self,
                                                             ZeitgeistDataSource *source,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            zeitgeist_data_source_registry_register_data_source_finish
                                                            (ZeitgeistDataSourceRegistry *self,
                                                             GAsyncResult *res,
                                                             GError **error);
    void                zeitgeist_data_source_registry_set_data_source_enabled
                                                            (ZeitgeistDataSourceRegistry *self,
                                                             const gchar *unique_id,
                                                             gboolean enabled,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            zeitgeist_data_source_registry_set_data_source_enabled_finish
                                                            (ZeitgeistDataSourceRegistry *self,
                                                             GAsyncResult *res,
                                                             GError **error);

## Object Hierarchy

      GObject
       +----ZeitgeistDataSourceRegistry

## Signals

      "source-disconnected"                            : Run First
      "source-enabled"                                 : Run First
      "source-registered"                              : Run First

## Description

The Zeitgeist engine maintains a publicly available list of recognized data-sources (components inserting information into Zeitgeist). ZeitgeistDataSourceRegistry is used to register new data sources, get information about them and gives the ability to enable or disable the data sources.

## Details

### ZeitgeistDataSourceRegistry

    typedef struct _ZeitgeistDataSourceRegistry ZeitgeistDataSourceRegistry;

### struct ZeitgeistDataSourceRegistryClass

    struct ZeitgeistDataSourceRegistryClass {
      GObjectClass parent_class;

      void (*source_registered)   (ZeitgeistDataSourceRegistry *registry,
                                   ZeitgeistDataSource *source);
      void (*source_disconnected) (ZeitgeistDataSourceRegistry *registry,
                                   ZeitgeistDataSource *source);
      void (*source_enabled)      (ZeitgeistDataSourceRegistry *registry,
                                   gchar *unique_id,
                                   gboolean enabled);
    };

### zeitgeist_data_source_registry_new ()

    ZeitgeistDataSourceRegistry *  zeitgeist_data_source_registry_new
                                                            (void);

Create a new data source registry instance.

DataSourceRegistry instances are not overly expensive for neither client or the Zeitgeist daemon so there's no need to go to lengths to keep singleton instances around.

Returns : | A reference to a newly allocated registry.

### zeitgeist_data_source_registry_get_data_sources ()

    void                zeitgeist_data_source_registry_get_data_sources
                                                            (ZeitgeistDataSourceRegistry *self,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

### zeitgeist_data_source_registry_get_data_sources_finish ()

    GPtrArray *         zeitgeist_data_source_registry_get_data_sources_finish
                                                            (ZeitgeistDataSourceRegistry *self,
                                                             GAsyncResult *res,
                                                             GError **error);

`self` : | Instance of ZeitgeistDataSourceRegistry.
`res` : | a GAsyncResult.
`error` : | a GError or NULL.
Returns : | Newly created GPtrArray containing ZeitgeistDataSource(s) registered in Zeitgeist. Free using `g_ptr_array_unref()` once you're done using it.

### zeitgeist_data_source_registry_register_data_source ()

    void                zeitgeist_data_source_registry_register_data_source
                                                            (ZeitgeistDataSourceRegistry *self,
                                                             ZeitgeistDataSource *source,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Registers new data source in the registry, the `source` parameter needs to have unique-id, name, description and optionally event_templates set, therefore it is useful to pass ZeitgeistDataSource instance created using `zeitgeist_data_source_new_full()`. The registry will assume its ownership.

`self` : | Instance of ZeitgeistDataSourceRegistry.
`source` : | Data source to register. If this is a floating reference it will be consumed
`cancellable` : | a GCancellable or NULL.
`callback` : | a GAsyncReadyCallback to call when the request is finished.
`user_data` : | the data to pass to callback function.

### zeitgeist_data_source_registry_register_data_source_finish ()

    gboolean            zeitgeist_data_source_registry_register_data_source_finish
                                                            (ZeitgeistDataSourceRegistry *self,
                                                             GAsyncResult *res,
                                                             GError **error);

`self` : | Instance of ZeitgeistDataSourceRegistry.
`res` : | Result of the asynchronous operation.
`error` : | a GError or NULL.
Returns : | If error is unset, returns whether this data source is enabled.

### zeitgeist_data_source_registry_set_data_source_enabled ()

    void                zeitgeist_data_source_registry_set_data_source_enabled
                                                            (ZeitgeistDataSourceRegistry *self,
                                                             const gchar *unique_id,
                                                             gboolean enabled,
                                                             GCancellable *cancellable,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

### zeitgeist_data_source_registry_set_data_source_enabled_finish ()

    gboolean            zeitgeist_data_source_registry_set_data_source_enabled_finish
                                                            (ZeitgeistDataSourceRegistry *self,
                                                             GAsyncResult *res,
                                                             GError **error);

## Signal Details

### The `"source-disconnected"` signal

    void                user_function                      (ZeitgeistDataSourceRegistry *zeitgeistdatasourceregistry,
                                                            ZeitgeistDataSource         *arg1,
                                                            gpointer                     user_data)                        : Run First

`zeitgeistdatasourceregistry` : | the object which received the signal.
`user_data` : | user data set when the signal handler was connected.

### The `"source-enabled"` signal

    void                user_function                      (ZeitgeistDataSourceRegistry *zeitgeistdatasourceregistry,
                                                            gchar                       *arg1,
                                                            gboolean                     arg2,
                                                            gpointer                     user_data)                        : Run First

`zeitgeistdatasourceregistry` : | the object which received the signal.
`user_data` : | user data set when the signal handler was connected.

### The `"source-registered"` signal

    void                user_function                      (ZeitgeistDataSourceRegistry *zeitgeistdatasourceregistry,
                                                            ZeitgeistDataSource         *arg1,
                                                            gpointer                     user_data)                        : Run First

`zeitgeistdatasourceregistry` : | the object which received the signal.
`user_data` : | user data set when the signal handler was connected.