ZeitgeistMonitor

## ZeitgeistMonitor ZeitgeistMonitor — Listens for updates to the Zeitgeist event log |

## Synopsis

    #include <zeitgeist.h>

                        ZeitgeistMonitor;
    struct              ZeitgeistMonitorClass;
    ZeitgeistMonitor *  zeitgeist_monitor_new               (ZeitgeistTimeRange *time_range,
                                                             GPtrArray *event_templates);
    ZeitgeistTimeRange * zeitgeist_monitor_get_time_range   (ZeitgeistMonitor *self);
    GPtrArray *         zeitgeist_monitor_get_templates     (ZeitgeistMonitor *self);
    const gchar *       zeitgeist_monitor_get_path          (ZeitgeistMonitor *self);

## Object Hierarchy

      GObject
       +----ZeitgeistMonitor

## Properties

      "event-templates"          GPtrArray*            : Read / Write / Construct Only
      "time-range"               ZeitgeistTimeRange*   : Read / Write / Construct Only

## Signals

      "events-deleted"                                 : Run Last
      "events-inserted"                                : Run Last

## Description

A ZeitgeistMonitor listens for updates to the Zeitgeist event log matching a given set of templates and with timestamps in some predefined time range.

A monitor must be installed into the running Zeitgeist daemon by calling `zeitgeist_log_install_monitor()`. The monitor will not emit any of the ::events-added or ::events-deleted signals before this.

## Details

### ZeitgeistMonitor

    typedef struct _ZeitgeistMonitor ZeitgeistMonitor;

### struct ZeitgeistMonitorClass

    struct ZeitgeistMonitorClass {
      GObjectClass parent_class;

      /*< signals >*/
      void (*events_inserted)  (ZeitgeistMonitor   *self,
                                ZeitgeistTimeRange *time_range,
                                GPtrArray          *events);

      void (*events_deleted)  (ZeitgeistMonitor   *self,
                               ZeitgeistTimeRange *time_range,
                               GArray             *event_ids);
    };

### zeitgeist_monitor_new ()

    ZeitgeistMonitor *  zeitgeist_monitor_new               (ZeitgeistTimeRange *time_range,
                                                             GPtrArray *event_templates);

Create a new monitor. Before you can receive signals from the monitor you need to install it in the running Zeitgeist daemon by calling `zeitgeist_log_install_monitor()`.

`time_range` : | The monitor will only listen for events with timestamps within this time range. Note that it is legal for applications to insert events that are "in the past".
`event_templates` : | A GPtrArray of ZeitgeistEvents. Only listen for events that match any of these templates. The monitor 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 : | A reference to a newly allocated monitor.

### zeitgeist_monitor_get_time_range ()

    ZeitgeistTimeRange * zeitgeist_monitor_get_time_range   (ZeitgeistMonitor *self);

### zeitgeist_monitor_get_templates ()

    GPtrArray *         zeitgeist_monitor_get_templates     (ZeitgeistMonitor *self);

### zeitgeist_monitor_get_path ()

    const gchar *       zeitgeist_monitor_get_path          (ZeitgeistMonitor *self);

## Property Details

### The `"event-templates"` property

      "event-templates"          GPtrArray*            : Read / Write / Construct Only

Events must match at least one these templates in order to trigger the monitor

### The `"time-range"` property

      "time-range"               ZeitgeistTimeRange*   : Read / Write / Construct Only

Events must have timestamps within this timerange in order to trigger the monitor.

## Signal Details

### The `"events-deleted"` signal

    void                user_function                      (ZeitgeistMonitor   *time_range,
                                                            ZeitgeistTimeRange *event_ids,
                                                            GArray             *arg2,
                                                            gpointer            user_data)       : Run Last

Emitted when events with timestamps within the time range of this monitor has been deleted from the log. Note that the deleted events may not match the event templates for the monitor.

`time_range` : | A ZeitgeistTimeRange that specifies the minimum and maximum timestamps of the deleted events
`event_ids` : | A GArray of guint32s holding the ids of the deleted events
`user_data` : | user data set when the signal handler was connected.

### The `"events-inserted"` signal

    void                user_function                      (ZeitgeistMonitor   *time_range,
                                                            ZeitgeistTimeRange *events,
                                                            ZeitgeistResultSet *arg2,
                                                            gpointer            user_data)       : Run Last

Emitted when events matching the event templates and with timestamps within the time range of the monitor has been inserted into the log.

`time_range` : | A ZeitgeistTimeRange that specifies the minimum and maximum of the timestamps in `events`
`events` : | A ZeitgeistResultSet holding the ZeitgeistEvents that have been inserted into the log
`user_data` : | user data set when the signal handler was connected.