# TrackerNotifier

TrackerNotifier is an object that receives notifications about changes to the Tracker database. A TrackerNotifier is created through tracker_sparql_connection_create_notifier, after the notifier is created, events can be listened for by connecting to the events signal.

# Known caveats

- The TRACKER_NOTIFIER_EVENT_DELETE events will be received after the resource has been deleted. At that time queries on those elements will not bring any metadata. Only the ID/URN obtained through the event remain meaningful.
- Notifications of files being moved across indexed folders will appear as TRACKER_NOTIFIER_EVENT_UPDATE events, containing the new location (if requested). The older location is no longer known to Tracker, this may make tracking of elements in specific folders hard using solely the TrackerNotifier/Tracker data available at event notification time.

## TrackerNotifier

    GObject
        ╰──TrackerNotifier

The <structname>TrackerNotifier</structname> object allows subscribing to changes in the stored data.

### Members

`parent_instance` (GObject) –
No description available

### Class structure

#### TrackerNotifierClass

### Tracker.NotifierClass

## Tracker.Notifier

    GObject.Object
        ╰──Tracker.Notifier

The <structname>TrackerNotifier</structname> object allows subscribing to changes in the stored data.

### Members

`parent_instance` (GObject.Object) –
No description available

## Tracker.Notifier

    GObject.Object
        ╰──Tracker.Notifier

The <structname>TrackerNotifier</structname> object allows subscribing to changes in the stored data.

### Members

`parent_instance` (GObject.Object) –
No description available

### Methods

#### tracker_notifier_signal_subscribe

    guint
    tracker_notifier_signal_subscribe (TrackerNotifier * notifier,
                                       GDBusConnection* connection,
                                       const gchar* service,
                                       const gchar* object_path,
                                       const gchar* graph)

Listens to notification events from a remote SPARQL endpoint as a DBus service (see TrackerEndpointDBus). If the object_path argument is NULL, the default "/org/freedesktop/Tracker3/Endpoint" path will be used. If graph is NULL, all graphs will be listened for.

The signal subscription can be removed with tracker_notifier_signal_unsubscribe.

Parameters:

`notifier` –

a TrackerNotifier

`connection` –

a GDBusConnection

`service` –

DBus service name to subscribe to events for

`object_path` ( [nullable]) –

DBus object path to subscribe to events for, or NULL

`graph` ( [nullable]) –

graph to listen events for, or NULL

Returns –

An ID for this subscription

Since : 3.0

#### Tracker.Notifier.prototype.signal_subscribe

    function Tracker.Notifier.prototype.signal_subscribe(connection: Gio.DBusConnection, service: String, object_path: String, graph: String): {
        // javascript wrapper for 'tracker_notifier_signal_subscribe'
    }

Listens to notification events from a remote SPARQL endpoint as a DBus service (see Tracker.EndpointDBus). If the object_path argument is NULL, the default "/org/freedesktop/Tracker3/Endpoint" path will be used. If graph is NULL, all graphs will be listened for.

The signal subscription can be removed with Tracker.Notifier.prototype.signal_unsubscribe.

Parameters:

`notifier` (Tracker.Notifier) –

a Tracker.Notifier

`connection` (Gio.DBusConnection) –

a GDBusConnection

`service` (String) –

DBus service name to subscribe to events for

`object_path` (String) –

DBus object path to subscribe to events for, or NULL

`graph` (String) –

graph to listen events for, or NULL

Returns (Number) –

An ID for this subscription

Since : 3.0

#### Tracker.Notifier.signal_subscribe

    def Tracker.Notifier.signal_subscribe (self, connection, service, object_path, graph):
        #python wrapper for 'tracker_notifier_signal_subscribe'

Listens to notification events from a remote SPARQL endpoint as a DBus service (see Tracker.EndpointDBus). If the object_path argument is NULL, the default "/org/freedesktop/Tracker3/Endpoint" path will be used. If graph is NULL, all graphs will be listened for.

The signal subscription can be removed with Tracker.Notifier.signal_unsubscribe.

Parameters:

`notifier` (Tracker.Notifier) –

a Tracker.Notifier

`connection` (Gio.DBusConnection) –

a GDBusConnection

`service` (str) –

DBus service name to subscribe to events for

`object_path` (str) –

DBus object path to subscribe to events for, or NULL

`graph` (str) –

graph to listen events for, or NULL

Returns (int) –

An ID for this subscription

Since : 3.0

#### tracker_notifier_signal_unsubscribe

    tracker_notifier_signal_unsubscribe (TrackerNotifier * notifier,
                                         guint handler_id)

Undoes a DBus signal subscription, the handler_id argument was previously obtained with a tracker_notifier_signal_subscribe call.

Parameters:

`notifier` –

a TrackerNotifier

`handler_id` –

a handler ID obtained with tracker_notifier_signal_subscribe

Since : 3.0

#### Tracker.Notifier.prototype.signal_unsubscribe

    function Tracker.Notifier.prototype.signal_unsubscribe(handler_id: Number): {
        // javascript wrapper for 'tracker_notifier_signal_unsubscribe'
    }

Undoes a DBus signal subscription, the handler_id argument was previously obtained with a Tracker.Notifier.prototype.signal_subscribe call.

Parameters:

`notifier` (Tracker.Notifier) –

a Tracker.Notifier

`handler_id` (Number) –

a handler ID obtained with Tracker.Notifier.prototype.signal_subscribe

Since : 3.0

#### Tracker.Notifier.signal_unsubscribe

    def Tracker.Notifier.signal_unsubscribe (self, handler_id):
        #python wrapper for 'tracker_notifier_signal_unsubscribe'

Undoes a DBus signal subscription, the handler_id argument was previously obtained with a Tracker.Notifier.signal_subscribe call.

Parameters:

`notifier` (Tracker.Notifier) –

a Tracker.Notifier

`handler_id` (int) –

a handler ID obtained with Tracker.Notifier.signal_subscribe

Since : 3.0

### Signals

#### events

    events_callback (TrackerNotifier * self,
                     gchar* service,
                     gchar* graph,
                     TrackerNotifierEvent * events,
                     gpointer user_data)

Notifies of changes in the Tracker database.

Parameters:

`self` –

The TrackerNotifier

`service` –

The SPARQL service that originated the events, NULL for the local store

`graph` –

The graph where the events happened on, NULL for the default anonymous graph

`events` ( [element-typeTrackerNotifierEvent]) –

A GPtrArray of TrackerNotifierEvent

`user_data` –
No description available

Flags:

#### events

    function events_callback(self: Tracker.Notifier, service: String, graph: String, events: [ Tracker.NotifierEvent ], user_data: Object): {
        // javascript callback for the 'events' signal
    }

Notifies of changes in the Tracker database.

Parameters:

`self` (Tracker.Notifier) –

The Tracker.Notifier

`service` (String) –

The SPARQL service that originated the events, NULL for the local store

`graph` (String) –

The graph where the events happened on, NULL for the default anonymous graph

`events` ([ Tracker.NotifierEvent ]) –

A GPtrArray of Tracker.NotifierEvent

`user_data` (Object) –
No description available

Flags:

#### events

    def events_callback (self, service, graph, events, *user_data):
        #python callback for the 'events' signal

Notifies of changes in the Tracker database.

Parameters:

`self` (Tracker.Notifier) –

The Tracker.Notifier

`service` (str) –

The SPARQL service that originated the events, NULL for the local store

`graph` (str) –

The graph where the events happened on, NULL for the default anonymous graph

`events` ([ Tracker.NotifierEvent ]) –

A GPtrArray of Tracker.NotifierEvent

`user_data` (variadic) –
No description available

Flags:

### Properties

#### connection

    “connection” TrackerSparqlConnection *

SPARQL connection to listen to.

Flags : Read / Write / Construct Only

#### connection

    “connection” Tracker.SparqlConnection

SPARQL connection to listen to.

Flags : Read / Write / Construct Only

#### connection

    “self.props.connection” Tracker.SparqlConnection

SPARQL connection to listen to.

Flags : Read / Write / Construct Only

## TrackerNotifierEvent

The <structname>TrackerNotifierEvent</structname> struct represents a change event in the stored data.

## Tracker.NotifierEvent

The <structname>TrackerNotifierEvent</structname> struct represents a change event in the stored data.

## Tracker.NotifierEvent

The <structname>TrackerNotifierEvent</structname> struct represents a change event in the stored data.

### Methods

#### tracker_notifier_event_get_event_type

    TrackerNotifierEventType
    tracker_notifier_event_get_event_type (TrackerNotifierEvent * event)

Returns the event type.

Parameters:

`event` –

A TrackerNotifierEvent

Returns –

The event type

#### Tracker.NotifierEvent.prototype.get_event_type

    function Tracker.NotifierEvent.prototype.get_event_type(): {
        // javascript wrapper for 'tracker_notifier_event_get_event_type'
    }

Returns the event type.

Parameters:

`event` (Tracker.NotifierEvent) –

A Tracker.NotifierEvent

Returns (Tracker.NotifierEventType) –

The event type

#### Tracker.NotifierEvent.get_event_type

    def Tracker.NotifierEvent.get_event_type (self):
        #python wrapper for 'tracker_notifier_event_get_event_type'

Returns the event type.

Parameters:

`event` (Tracker.NotifierEvent) –

A Tracker.NotifierEvent

Returns (Tracker.NotifierEventType) –

The event type

#### tracker_notifier_event_get_id

    gint64
    tracker_notifier_event_get_id (TrackerNotifierEvent * event)

Returns the tracker:id of the element being notified upon. This is a gint64 which is used as efficient internal identifier for the resource.

Parameters:

`event` –

A TrackerNotifierEvent

Returns –

the resource ID

#### Tracker.NotifierEvent.prototype.get_id

    function Tracker.NotifierEvent.prototype.get_id(): {
        // javascript wrapper for 'tracker_notifier_event_get_id'
    }

Returns the tracker:id of the element being notified upon. This is a gint64 which is used as efficient internal identifier for the resource.

Parameters:

`event` (Tracker.NotifierEvent) –

A Tracker.NotifierEvent

Returns (Number) –

the resource ID

#### Tracker.NotifierEvent.get_id

    def Tracker.NotifierEvent.get_id (self):
        #python wrapper for 'tracker_notifier_event_get_id'

Returns the tracker:id of the element being notified upon. This is a gint64 which is used as efficient internal identifier for the resource.

Parameters:

`event` (Tracker.NotifierEvent) –

A Tracker.NotifierEvent

Returns (int) –

the resource ID

#### tracker_notifier_event_get_urn

    const gchar*
    tracker_notifier_event_get_urn (TrackerNotifierEvent * event)

Returns the Uniform Resource Name of the element. This is Tracker's public identifier for the resource.

This URN is an unique string identifier for the resource being notified upon, typically of the form "urn:uuid:...".

Parameters:

`event` –

A TrackerNotifierEvent

Returns –

The element URN

#### Tracker.NotifierEvent.prototype.get_urn

    function Tracker.NotifierEvent.prototype.get_urn(): {
        // javascript wrapper for 'tracker_notifier_event_get_urn'
    }

Returns the Uniform Resource Name of the element. This is Tracker's public identifier for the resource.

This URN is an unique string identifier for the resource being notified upon, typically of the form "urn:uuid:...".

Parameters:

`event` (Tracker.NotifierEvent) –

A Tracker.NotifierEvent

Returns (String) –

The element URN

#### Tracker.NotifierEvent.get_urn

    def Tracker.NotifierEvent.get_urn (self):
        #python wrapper for 'tracker_notifier_event_get_urn'

Returns the Uniform Resource Name of the element. This is Tracker's public identifier for the resource.

This URN is an unique string identifier for the resource being notified upon, typically of the form "urn:uuid:...".

Parameters:

`event` (Tracker.NotifierEvent) –

A Tracker.NotifierEvent

Returns (str) –

The element URN

## Enumerations

### TrackerNotifierEventType

Notifier event types.

##### Members

`TRACKER_NOTIFIER_EVENT_CREATE` (0) –

An element was created.

`TRACKER_NOTIFIER_EVENT_DELETE` (1) –

An element was deleted.

`TRACKER_NOTIFIER_EVENT_UPDATE` (2) –

An element was updated.

### Tracker.NotifierEventType

Notifier event types.

##### Members

`Tracker.NotifierEventType.CREATE` (0) –

An element was created.

`Tracker.NotifierEventType.DELETE` (1) –

An element was deleted.

`Tracker.NotifierEventType.UPDATE` (2) –

An element was updated.

### Tracker.NotifierEventType

Notifier event types.

##### Members

`Tracker.NotifierEventType.CREATE` (0) –

An element was created.

`Tracker.NotifierEventType.DELETE` (1) –

An element was deleted.

`Tracker.NotifierEventType.UPDATE` (2) –

An element was updated.

The results of the search are