EDataBook.DataBookCursor¶
Methods¶
- Inherited:
- Structs:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
|
|
|
|
|
|
|
|
|
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/co |
The backend which created this cursor |
||
r |
The current position of this cursor |
||
r |
The total results for this cursor |
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
Class Details¶
- class EDataBook.DataBookCursor(**kwargs)¶
- Bases:
- Abstract:
Yes
- Structure:
An opaque handle for an addressbook cursor
New in version 3.12.
- contact_added(contact)¶
- Parameters:
contact (
EBookContacts.Contact
) – theEBookContacts.Contact
which was added to the addressbook
Should be called by addressbook backends whenever a contact is added.
New in version 3.12.
- contact_removed(contact)¶
- Parameters:
contact (
EBookContacts.Contact
) – theEBookContacts.Contact
which was removed from the addressbook
Should be called by addressbook backends whenever a contact is removed.
New in version 3.12.
- get_backend()¶
- Returns:
The
EDataBook.BookBackend
owning self.- Return type:
Gets the backend which created and owns self.
New in version 3.12.
- get_position()¶
- Returns:
the current position of self
- Return type:
Fetch the current position of self in its result list.
New in version 3.12.
- get_total()¶
- Returns:
the total contacts for self
- Return type:
Fetch the total number of contacts which match self's query expression.
New in version 3.12.
- load_locale(cancellable)¶
- Parameters:
cancellable (
Gio.Cancellable
orNone
) – AGio.Cancellable
- Raises:
- Returns:
True
on success, otherwiseFalse
is returned and error is set.- locale:
return location for the locale
- Return type:
Load the current locale setting from the cursor’s underlying database.
Addressbook backends implementing cursors should call this function on all active cursor when the locale setting changes.
This will implicitly reset self's state and position.
New in version 3.12.
- recalculate(cancellable)¶
- Parameters:
cancellable (
Gio.Cancellable
orNone
) – AGio.Cancellable
- Raises:
- Returns:
True
on success, otherwiseFalse
is returned and error is set.- Return type:
Recalculates the cursor’s total and position, this is meant for cursor created in Direct Read Access mode to synchronously recalculate the position and total values when the addressbook revision has changed.
New in version 3.12.
- register_gdbus_object(connection, object_path)¶
- Parameters:
connection (
Gio.DBusConnection
) – theGio.DBusConnection
to register withobject_path (
str
) – the object path to place the direct access configuration data
- Raises:
- Returns:
True
on success, otherwiseFalse
is returned and error is set.- Return type:
Places self on the connection at object_path
New in version 3.12.
- set_alphabetic_index(index, locale, cancellable)¶
- Parameters:
index (
int
) – the alphabetic indexlocale (
str
) – the locale in which index is expected to be a valid alphabetic indexcancellable (
Gio.Cancellable
orNone
) – AGio.Cancellable
- Raises:
- Returns:
True
on success, otherwiseFalse
is returned and error is set.- Return type:
Sets the self position to an
‘Alphabetic Index [cursor-alphabet]’ into the alphabet active in the locale of the addressbook.
After setting the target to an alphabetic index, for example the index for letter ‘E’, then further calls to
EDataBook.DataBookCursor.step
() will return results starting with the letter ‘E’ (or results starting with the last result in ‘D’, if moving in a negative direction).The passed index must be a valid index in locale, if by some chance the addressbook backend has changed into a new locale after this call has been issued, an
EDataServer.ClientError.OUT_OF_SYNC
error will be issued indicating that there was a locale mismatch.New in version 3.12.
- set_sexp(sexp, cancellable)¶
- Parameters:
cancellable (
Gio.Cancellable
orNone
) – AGio.Cancellable
- Raises:
- Returns:
True
on success, otherwiseFalse
is returned and error is set.- Return type:
Sets the search expression for the cursor
New in version 3.12.
- step(revision_guard, flags, origin, count, cancellable)¶
- Parameters:
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
- Raises:
- 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:
Steps self through its sorted query by a maximum of count contacts starting from origin.
If count is negative, then the cursor will move through the list in reverse.
If self reaches the beginning or end of the query results, then the returned list might not contain the amount of desired contacts, or might return no results if the cursor currently points to the last contact. Reaching the end of the list is not considered an error condition. Attempts to step beyond the end of the list after having reached the end of the list will however trigger an
EDataServer.ClientError.QUERY_REFUSED
error.If
EBookContacts.BookCursorStepFlags.FETCH
is specified in flags, a pointer to aNone
GLib.SList
pointer should be provided for the results parameter.The result list will be stored to results and should be freed with g_slist_free() and all elements freed with
GLib.free
().If a revision_guard is specified, the cursor implementation will issue an
EDataServer.ClientError.OUT_OF_SYNC
error if the revision_guard does not match the current addressbook revision.An explanation of how stepping is expected to behave can be found in the ‘user facing reference documentation [cursor-iteration]’.
New in version 3.12.
- do_compare_contact(contact) virtual¶
- Parameters:
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:
The
EDataBook.DataBookCursorCompareContactFunc
delegate to compare anEBookContacts.Contact
with the cursor position
- do_get_position(cancellable) virtual¶
- Parameters:
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:
The
EDataBook.DataBookCursorGetPositionFunc
delegate to calculate the current total and position values
- do_load_locale() virtual¶
- 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:
The
EDataBook.DataBookCursorLoadLocaleFunc
delegate used to reload the locale setting
- do_set_alphabetic_index(index, locale) virtual¶
- Parameters:
- Returns:
True
on Success, otherwiseFalse
is returned if any error occurred and error is set to reflect the error which occurred.- Return type:
The
EDataBook.DataBookCursorSetAlphabetIndexFunc
delegate to set the alphabetic position
- do_set_sexp(sexp) virtual¶
- Parameters:
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:
The
EDataBook.DataBookCursorSetSexpFunc
delegate to set the search expression
- do_step(revision_guard, flags, origin, count, cancellable) virtual¶
- Parameters:
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:
Steps cursor through its sorted query by a maximum of count contacts starting from origin.
If count is negative, then the cursor will move through the list in reverse.
If cursor reaches the beginning or end of the query results, then the returned list might not contain the amount of desired contacts, or might return no results if the cursor currently points to the last contact. Reaching the end of the list is not considered an error condition. Attempts to step beyond the end of the list after having reached the end of the list will however trigger an
EDataServer.ClientError.QUERY_REFUSED
error.If
EBookContacts.BookCursorStepFlags.FETCH
is specified in flags, a pointer to aNone
GLib.SList
pointer should be provided for the results parameter.The result list will be stored to results and should be freed with g_slist_free() and all elements freed with
GLib.free
().If a revision_guard is specified, the cursor implementation will issue an
EDataServer.ClientError.OUT_OF_SYNC
error if the revision_guard does not match the current addressbook revision.An explanation of how stepping is expected to behave can be found in the ‘user facing reference documentation [cursor-iteration]’.
New in version 3.12.
Property Details¶
- EDataBook.DataBookCursor.props.backend¶
- Name:
backend
- Type:
- Default Value:
- Flags:
The backend which created this cursor
- EDataBook.DataBookCursor.props.position¶
-
The current position of this cursor