Tracker.Notifier

g GObject.Object GObject.Object Tracker.Notifier Tracker.Notifier GObject.Object->Tracker.Notifier

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

signal_subscribe (connection, service, object_path, graph)

signal_unsubscribe (handler_id)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

connection

Tracker.SparqlConnection

r/w/co

SPARQL connection

Signals

Inherited:

GObject.Object (1)

Name

Short Description

events

Notifies of changes in the Tracker database.

Fields

Inherited:

GObject.Object (1)

Name

Type

Access

Description

parent_instance

GObject.Object

r

Class Details

class Tracker.Notifier(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Tracker.NotifierClass

TrackerNotifier allows receiving notification on changes in the data stored by a [class`Tracker`.SparqlConnection].

This object may be created through [method`Tracker`.SparqlConnection.create_notifier], events can then be listened for by connecting to the [signal`Tracker`.Notifier::events] signal.

Not every change is notified, only RDF resources with a class that has the nrl:notify property defined by the ontology will be notified upon changes.

Database changes are communicated through [struct`Tracker`.NotifierEvent] events on individual graph/resource pairs. The event type obtained through [method`Tracker`.NotifierEvent.get_event_type] will determine the type of event. Insertion of new resources is notified through Tracker.NotifierEventType.CREATE events, deletion of resources is notified through Tracker.NotifierEventType.DELETE events, and changes on any property of the resource is notified through Tracker.NotifierEventType.UPDATE events.

The events happen in reaction to database changes, after a TrackerNotifier received an event of type Tracker.NotifierEventType.DELETE, the resource will not exist anymore and only the information in the [struct`Tracker`.NotifierEvent] will remain.

Similarly, when receiving an event of type Tracker.NotifierEventType.UPDATE, the resource will have already changed, so the data previous to the update is no longer available.

The [signal`Tracker`.Notifier::events] signal is emitted in the thread-default main context of the thread where the TrackerNotifier instance was created.

signal_subscribe(connection, service, object_path, graph)
Parameters:
  • connection (Gio.DBusConnection) – A [class`Gio`.DBusConnection]

  • service (str or None) – DBus service name to subscribe to events for, or None

  • object_path (str or None) – DBus object path to subscribe to events for, or None

  • graph (str or None) – Graph to listen events for, or None

Returns:

An ID for this subscription

Return type:

int

Listens to notification events from a remote DBus SPARQL endpoint.

If connection refers to a message bus (system/session), service must refer to a D-Bus name (either unique or well-known). If connection is a non-message bus (e.g. a peer-to-peer D-Bus connection) the service argument may be None.

If the object_path argument is None, the default /org/freedesktop/Tracker3/Endpoint path will be used. If graph is None, all graphs will be listened for.

The signal subscription can be removed with [method`Tracker`.Notifier.signal_unsubscribe].

Note that this call is not necessary to receive notifications on a connection obtained through [ctor`Tracker`.SparqlConnection.bus_new], only to listen to update notifications from additional DBus endpoints.

signal_unsubscribe(handler_id)
Parameters:

handler_id (int) – A signal subscription handler ID

Undoes a signal subscription done through [method`Tracker`.Notifier.signal_subscribe].

The handler_id argument was previously obtained during signal subscription creation.

Signal Details

Tracker.Notifier.signals.events(notifier, service, graph, events)
Signal Name:

events

Flags:

Parameters:
  • notifier (Tracker.Notifier) – The object which received the signal

  • service (str) – The SPARQL service that originated the events, None for the local store

  • graph (str) – The graph where the events happened on, None for the default anonymous graph

  • events ([Tracker.NotifierEvent]) – A [type`GLib`.PtrArray] of [struct`Tracker`.NotifierEvent]

Notifies of changes in the Tracker database.

Property Details

Tracker.Notifier.props.connection
Name:

connection

Type:

Tracker.SparqlConnection

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

SPARQL connection to listen to.