Callbacks¶
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Details¶
- EDataBook.BookBackendCustomOpFunc(book_backend, user_data, cancellable)¶
- Parameters:
book_backend (
EDataBook.BookBackend
) – anEDataBook.BookBackend
user_data (
object
orNone
) – a function user data, as provided toEDataBook.BookBackend.schedule_custom_operation
()cancellable (
Gio.Cancellable
orNone
) – an optionalGio.Cancellable
, as provided toEDataBook.BookBackend.schedule_custom_operation
()
A callback prototype being called in a dedicated thread, scheduled by
EDataBook.BookBackend.schedule_custom_operation
().New in version 3.26.
- EDataBook.BookBackendForeachViewFunc(backend, view, *user_data)¶
- Parameters:
backend (
EDataBook.BookBackend
) – anEDataBook.BookBackend
view (
EDataBook.DataBookView
) – anEDataBook.DataBookView
- Returns:
- Return type:
Callback function used by
EDataBook.BookBackend.foreach_view
().New in version 3.34.
- EDataBook.BookCacheSearchFunc(book_cache, uid, revision, object, extra, custom_flags, offline_state, *user_data)¶
- Parameters:
book_cache (
EDataBook.BookCache
) – anEDataBook.BookCache
uid (
str
) – a unique object identifierrevision (
str
) – the object revisionobject (
str
) – the object itselfextra (
str
) – extra data stored with the objectcustom_flags (
int
) – object’s custom flagsoffline_state (
EBackend.OfflineState
) – object’s offline state, one ofEBackend.OfflineState
user_data (
object
orNone
) – user data, as used inEDataBook.BookCache.search_with_callback
()
- Returns:
- Return type:
A callback called for each object row when using
EDataBook.BookCache.search_with_callback
() function.New in version 3.26.
- EDataBook.BookSqliteSelectFunc(ebsql, column_names, column_values, *user_data)¶
- Parameters:
ebsql (
EDataBook.BookSqlite
) – anEDataBook.BookSqlite
column_names ([
str
]) – column namescolumn_values ([
str
]) – column valuesuser_data (
object
orNone
) – user data, as used inEDataBook.BookSqlite.select
()
- Returns:
- Return type:
A callback called for each row of a SELECT statement executed with
EDataBook.BookSqlite.select
() function.New in version 3.48.
- EDataBook.DataBookCursorCompareContactFunc(cursor, contact)¶
- Parameters:
cursor (
EDataBook.DataBookCursor
) – anEDataBook.DataBookCursor
contact (
EBookContacts.Contact
) – theEBookContacts.Contact
to compare with cursor
- Returns:
A value that is less than, equal to, or greater than zero if contact is found, respectively, to be less than, to match, or be greater than the current value of cursor.
- matches_sexp:
return location to set whether contact matched cursor's search expression
- Return type:
Method type for
EDataBook.DataBookCursor.do_compare_contact
()Cursor implementations must implement this in order to compare a contact with the current cursor state.
This is called when the addressbook backends notify active cursors that the addressbook has been modified with
EDataBook.DataBookCursor.contact_added
() andEDataBook.DataBookCursor.contact_removed
().New in version 3.12.
- EDataBook.DataBookCursorGetPositionFunc(cursor, cancellable)¶
- Parameters:
cursor (
EDataBook.DataBookCursor
) – anEDataBook.DataBookCursor
cancellable (
Gio.Cancellable
orNone
) – AGio.Cancellable
- Returns:
True
on Success, otherwiseFalse
is returned if any error occurred and error is set to reflect the error which occurred.- total:
The total number of contacts matching cursor's query expression
- position:
The current position of cursor in its result list
- Return type:
Method type for
EDataBook.DataBookCursor.do_get_position
()Cursor implementations must implement this to count the total results matching cursor's query expression and to calculate the amount of contacts leading up to the current cursor state (cursor inclusive).
A cursor position is defined as an integer which is inclusive of the current contact to which it points (if the cursor points to an exact contact). A position of 0 indicates that the cursor is situated in a position that is before and after the entire result set. The cursor position should be 0 at creation time, and should start again from the symbolic 0 position whenever
EBookContacts.BookCursorOrigin.BEGIN
is specified in theEDataBook.DataBookCursor.do_step
() method (or whenever moving the cursor beyond the end of the result set).If the cursor is positioned beyond the end of the list, then the position should be the total amount of contacts available in the list (as returned through the total argument) plus one.
This method is called by
EDataBook.DataBookCursor.recalculate
() and in some other cases where cursor's current position and total must be recalculated from scratch.New in version 3.12.
- EDataBook.DataBookCursorLoadLocaleFunc(cursor)¶
- Parameters:
cursor (
EDataBook.DataBookCursor
) – anEDataBook.DataBookCursor
- Returns:
True
on Success, otherwiseFalse
is returned if any error occurred and error is set to reflect the error which occurred.- locale:
return location to store the newly loaded locale
- Return type:
Method type for
EDataBook.DataBookCursor.do_load_locale
()Fetches the locale setting from cursor's addressbook
If the locale setting has changed, the cursor must reload any internal locale specific data and ensure that comparisons of sort keys will function properly in the new locale.
Upon locale changes, the implementation need not worry about updating it’s current cursor state, the cursor state will be reset automatically for you.
New in version 3.12.
- EDataBook.DataBookCursorSetAlphabetIndexFunc(cursor, index, locale)¶
- Parameters:
cursor (
EDataBook.DataBookCursor
) – anEDataBook.DataBookCursor
index (
int
) – the alphabetic indexlocale (
str
) – the locale in which index is expected to be a valid alphabetic index
- Returns:
True
on Success, otherwiseFalse
is returned if any error occurred and error is set to reflect the error which occurred.- Return type:
Method type for
EDataBook.DataBookCursor.do_set_alphabetic_index
()Sets the cursor state to point to an
‘index into the active alphabet [cursor-alphabet]’. The implementing class must check that locale matches the current locale setting of the underlying database and report an
EDataServer.ClientError.OUT_OF_SYNC
error in the case that the locales do not match.New in version 3.12.
- EDataBook.DataBookCursorSetSexpFunc(cursor, sexp)¶
- Parameters:
cursor (
EDataBook.DataBookCursor
) – anEDataBook.DataBookCursor
sexp (
str
orNone
) – the search expression to set, orNone
for unfiltered results
- Returns:
True
on Success, otherwiseFalse
is returned if any error occurred and error is set to reflect the error which occurred.- Return type:
Method type for
EDataBook.DataBookCursor.do_set_sexp
()A cursor implementation must implement this in order to modify the search expression for cursor. After this is called, the position and total will be recalculated.
If the cursor implementation is unable to deal with the
EBookContacts.ContactFields
referred to in sexp, then anEDataServer.ClientError.INVALID_QUERY
error should be set to indicate this.New in version 3.12.
- EDataBook.DataBookCursorStepFunc(cursor, revision_guard, flags, origin, count, cancellable)¶
- Parameters:
cursor (
EDataBook.DataBookCursor
) – anEDataBook.DataBookCursor
revision_guard (
str
orNone
) – The expected current addressbook revision, orNone
flags (
EBookContacts.BookCursorStepFlags
) – TheEBookContacts.BookCursorStepFlags
for this steporigin (
EBookContacts.BookCursorOrigin
) – TheEBookContacts.BookCursorOrigin
from whence to stepcount (
int
) – a positive or negative amount of contacts to try and fetchcancellable (
Gio.Cancellable
orNone
) – AGio.Cancellable
- Returns:
The number of contacts traversed if successful, otherwise -1 is returned and error is set.
- results:
A return location to store the results, or
None
ifEBookContacts.BookCursorStepFlags.FETCH
is not specified in flags
- Return type:
Method type for
EDataBook.DataBookCursor.do_step
()As all cursor methods may be called either by the addressbook service or directly by a client in Direct Read Access mode, it is important that the operation be an atomic transaction with the underlying database.
The revision_guard, if specified, will be set to the
EDataServer.CLIENT_BACKEND_PROPERTY_REVISION
value at the time which the given client issued the call to move the cursor. If the revision_guard provided by the client does not match the stored addressbook revision, then anEDataServer.ClientError.OUT_OF_SYNC
error should be set to indicate that the revision was out of sync while attempting to move the cursor.If the addressbook backend supports direct read access, then the revision comparison and reading of the data store must be coupled into a single atomic operation (the data read back from the store must be the correct data for the given addressbook revision).
See
EDataBook.DataBookCursor.step
() for more details on the expected behaviour of this method.New in version 3.12.
- EDataBook.bSqlChangeCallback(change_type, uid, extra, vcard, *user_data)¶
- Parameters:
change_type (
EDataBook.bSqlChangeType
) – TheEDataBook.bSqlChangeType
which occurreduid (
str
) – A contact UIDextra (
str
) – The extra data associated to the contactvcard (
str
) – The vcard string for this UID
A function which may be called in response to a change in contact data.
This user callback is called inside a lock, you must not call the
EDataBook.BookSqlite
API from this callback.New in version 3.12.
- EDataBook.bSqlVCardCallback(uid, extra, *user_data)¶
- Parameters:
uid (
str
) – A contact UIDextra (
str
) – The extra data associated to the contactuser_data (
object
orNone
) – User data previously passed toEDataBook.BookSqlite.new
()
- Returns:
The appropriate vcard indicated by uid
- Return type:
If this callback is passed to
EDataBook.BookSqlite.new
(), then vcards are not stored in the SQLite and instead this callback is invoked to fetch the vcard.This callback will be called to fetch results for fully indexed and optimized queries, and it will also be called while performing fallback queries against
EBookContacts.ContactFields
which are not configured in theEBookContacts.SourceBackendSummarySetup
or default summary fields.This user callback is called inside a lock, you must not call the
EDataBook.BookSqlite
API from this callback.New in version 3.12.