Evolution API Reference: libebook, the Addressbook Library | ||||
---|---|---|---|---|
EBookEBook — An address book containing EContacts |
EBook; EBook* e_book_new (ESource *source, GError **error); EBook* e_book_new_default_addressbook (GError **error); EBook* e_book_new_from_uri (const char *uri, GError **error); EBook* e_book_new_system_addressbook (GError **error); gboolean e_book_set_default_addressbook (EBook *book, GError **error); gboolean e_book_set_default_source (ESource *source, GError **error); gboolean e_book_remove (EBook *book, GError **error); gboolean e_book_open (EBook *book, gboolean only_if_exists, GError **error); gboolean e_book_get_supported_fields (EBook *book, GList **fields, GError **error); gboolean e_book_get_supported_auth_methods (EBook *book, GList **auth_methods, GError **error); gboolean e_book_get_required_fields (EBook *book, GList **fields, GError **error); ESource* e_book_get_source (EBook *book); gboolean e_book_is_online (EBook *book); gboolean e_book_is_opened (EBook *book); gboolean e_book_authenticate_user (EBook *book, const char *user, const char *passwd, const char *auth_method, GError **error); gboolean e_book_get_contact (EBook *book, const char *id, EContact **contact, GError **error); gboolean e_book_remove_contact (EBook *book, const char *id, GError **error); gboolean e_book_remove_contacts (EBook *book, GList *ids, GError **error); gboolean e_book_remove_all_contacts (EBook *book, GError **error); gboolean e_book_add_contact (EBook *book, EContact *contact, GError **error); gboolean e_book_add_contacts (EBook *book, GList *contacts, GError **error); gboolean e_book_commit_contact (EBook *book, EContact *contact, GError **error); gboolean e_book_commit_contacts (EBook *book, GList *contacts, GError **error); gboolean e_book_get_book_view (EBook *book, EBookQuery *query, GList *requested_fields, int max_results, EBookView **book_view, GError **error); gboolean e_book_get_contacts (EBook *book, EBookQuery *query, GList **contacts, GError **error); gboolean e_book_get_changes (EBook *book, char *changeid, GList **changes, GError **error); void e_book_free_change_list (GList *change_list); const char* e_book_get_uri (EBook *book); const char* e_book_get_static_capabilities (EBook *book, GError **error); gboolean e_book_check_static_capability (EBook *book, const char *cap); gboolean e_book_is_writable (EBook *book); gboolean e_book_cancel (EBook *book, GError **error); gboolean e_book_get_self (EContact **contact, EBook **book, GError **error); gboolean e_book_set_self (EBook *book, EContact *contact, GError **error); gboolean e_book_is_self (EContact *contact); gboolean e_book_get_addressbooks (ESourceList **addressbook_sources, GError **error); void (*EBookCallback) (EBook *book, EBookStatus status, gpointer closure); void (*EBookIdCallback) (EBook *book, EBookStatus status, const char *id, gpointer closure); void (*EBookContactCallback) (EBook *book, EBookStatus status, EContact *contact, gpointer closure); void (*EBookListCallback) (EBook *book, EBookStatus status, GList *list, gpointer closure); void (*EBookBookViewCallback) (EBook *book, EBookStatus status, EBookView *book_view, gpointer closure); void (*EBookEListCallback) (EBook *book, EBookStatus status, EList *list, gpointer closure); guint e_book_async_open (EBook *book, gboolean only_if_exists, EBookCallback open_response, gpointer closure); guint e_book_async_remove (EBook *book, EBookCallback cb, gpointer closure); guint e_book_async_get_required_fields (EBook *book, EBookEListCallback cb, gpointer closure); guint e_book_async_get_supported_fields (EBook *book, EBookEListCallback cb, gpointer closure); guint e_book_async_get_supported_auth_methods (EBook *book, EBookEListCallback cb, gpointer closure); guint e_book_async_authenticate_user (EBook *book, const char *user, const char *passwd, const char *auth_method, EBookCallback cb, gpointer closure); guint e_book_async_get_contact (EBook *book, const char *id, EBookContactCallback cb, gpointer closure); guint e_book_async_get_contacts (EBook *book, EBookQuery *query, EBookListCallback cb, gpointer closure); guint e_book_async_get_changes (EBook *book, char *changeid, EBookListCallback cb, gpointer closure); guint e_book_async_remove_contact (EBook *book, EContact *contact, EBookCallback cb, gpointer closure); guint e_book_async_remove_contact_by_id (EBook *book, const char *id, EBookCallback cb, gpointer closure); guint e_book_async_remove_contacts (EBook *book, GList *ids, EBookCallback cb, gpointer closure); guint e_book_async_remove_all_contacts (EBook *book, EBookCallback cb, gpointer closure); guint e_book_async_add_contact (EBook *book, EContact *contact, EBookIdCallback cb, gpointer closure); guint e_book_async_add_contacts (EBook *book, GList *contacts, EBookCallback cb, gpointer closure); guint e_book_async_commit_contact (EBook *book, EContact *contact, EBookCallback cb, gpointer closure); guint e_book_async_commit_contacts (EBook *book, GList *contacts, EBookCallback cb, gpointer closure); guint e_book_async_get_book_view (EBook *book, EBookQuery *query, GList *requested_fields, int max_results, EBookBookViewCallback cb, gpointer closure);
"auth-required" : Run Last "backend-died" : Run Last "connection-status" : Run Last "writable-status" : Run Last
EBook is the GObject-level representation of an address book backing store. It contains any number of EContacts and provides functions to add, remove, and modify contacts.
EBook also provides a means to get an EBookView filtered by an EBookQuery
-- e_book_async_get_book_view()
(or e_book_get_book_view()
, if blocking is
acceptable).
typedef struct _EBook EBook;
All the fields of this structure are private to the object's implementation and should never be accessed directly.
EBook* e_book_new (ESource *source, GError **error);
Creates a new EBook corresponding to the given source. There are
only two operations that are valid on this book at this point:
e_book_open()
, and e_book_remove()
.
source : |
An ESource pointer |
error : |
A GError pointer |
Returns : | a new but unopened EBook. |
EBook* e_book_new_default_addressbook (GError **error);
Creates a new EBook corresponding to the user's default addressbook. See the documentation for e_book_new for further information.
error : |
A GError pointer |
Returns : | a new but unopened EBook. |
EBook* e_book_new_from_uri (const char *uri, GError **error);
Creates a new EBook corresponding to the given uri. See the documentation for e_book_new for further information.
uri : |
the URI to load |
error : |
A GError pointer |
Returns : | a new but unopened EBook. |
EBook* e_book_new_system_addressbook (GError **error);
Creates a new EBook corresponding to the user's system addressbook. See the documentation for e_book_new for further information.
error : |
A GError pointer |
Returns : | a new but unopened EBook. |
gboolean e_book_set_default_addressbook (EBook *book, GError **error);
sets the ESource of the EBook as the "default" addressbook. This is the source that will be loaded in the e_book_get_default_addressbook call.
book : |
An EBook pointer |
error : |
A GError pointer |
Returns : | TRUE if the setting was stored in libebook's ESourceList, otherwise FALSE .
|
gboolean e_book_set_default_source (ESource *source, GError **error);
sets source
as the "default" addressbook. This is the source that
will be loaded in the e_book_get_default_addressbook call.
source : |
An ESource pointer |
error : |
A GError pointer |
Returns : | TRUE if the setting was stored in libebook's ESourceList, otherwise FALSE .
|
gboolean e_book_remove (EBook *book, GError **error);
Removes the backing data for this EBook. For example, with the file backend this deletes the database file. You cannot get it back!
book : |
an EBook |
error : |
a GError to set on failure |
Returns : | TRUE on success, FALSE on failure.
|
gboolean e_book_open (EBook *book, gboolean only_if_exists, GError **error);
Opens the addressbook, making it ready for queries and other operations.
book : |
an EBook |
only_if_exists : |
if TRUE , fail if this book doesn't already exist, otherwise create it first
|
error : |
a GError to set on failure |
Returns : | TRUE if the book was successfully opened, FALSE otherwise.
|
gboolean e_book_get_supported_fields (EBook *book, GList **fields, GError **error);
Gets a list of fields that can be stored for contacts
in this book
. Other fields may be discarded. The list
will contain pointers to allocated strings, and both the
GList and the strings must be freed by the caller.
book : |
an EBook |
fields : |
a GList of fields to set on success |
error : |
a GError to set on failure |
Returns : | TRUE if successful, FALSE otherwise
|
gboolean e_book_get_supported_auth_methods (EBook *book, GList **auth_methods, GError **error);
Queries book
for the list of authentication methods it supports.
The list will contain pointers to allocated strings, and both the
GList and the strings must be freed by the caller.
book : |
an EBook |
auth_methods : |
a GList of auth methods to set on success |
error : |
a GError to set on failure |
Returns : | TRUE if successful, FALSE otherwise
|
gboolean e_book_get_required_fields (EBook *book, GList **fields, GError **error);
Gets a list of fields that are required to be filled in for
all contacts in this book
. The list will contain pointers
to allocated strings, and both the GList and the strings
must be freed by the caller.
book : |
an EBook |
fields : |
a GList of fields to set on success |
error : |
a GError to set on failure |
Returns : | TRUE if successful, FALSE otherwise.
|
ESource* e_book_get_source (EBook *book);
Get the ESource that this book has loaded.
book : |
an EBook |
Returns : | The source. |
gboolean e_book_is_online (EBook *book);
Check if this book is connected.
book : |
an EBook |
Returns : | TRUE if this book is connected, otherwise FALSE .
|
gboolean e_book_is_opened (EBook *book);
Check if this book has been opened.
book : |
and EBook |
Returns : | TRUE if this book has been opened, otherwise FALSE .
|
gboolean e_book_authenticate_user (EBook *book, const char *user, const char *passwd, const char *auth_method, GError **error);
Authenticates user
with passwd
, using the auth method
auth_method
. auth_method
must be one of the authentication
methods returned using e_book_get_supported_auth_methods.
book : |
an EBook |
user : |
a string |
passwd : |
a string |
auth_method : |
a string |
error : |
a GError to set on failure |
Returns : | TRUE if successful, FALSE otherwise
|
gboolean e_book_get_contact (EBook *book, const char *id, EContact **contact, GError **error);
Fills in contact
with the contents of the vcard in book
corresponding to id
.
gboolean e_book_remove_contact (EBook *book, const char *id, GError **error);
Removes the contact with id id
from book
.
book : |
an EBook |
id : |
a string |
error : |
a GError to set on failure |
Returns : | TRUE if successful, FALSE otherwise
|
gboolean e_book_remove_contacts (EBook *book, GList *ids, GError **error);
Removes the contacts with ids from the list ids
from book
. This is
always more efficient than calling e_book_remove_contact_by_id if you
have more than one id to remove, as some backends can implement it
as a batch request.
book : |
an EBook |
ids : |
an GList of const char *id's |
error : |
a GError to set on failure |
Returns : | TRUE if successful, FALSE otherwise
|
gboolean e_book_remove_all_contacts (EBook *book, GError **error);
Removes all contacts from book
. This is always more efficient than calling
e_book_remove_contacts()
, as some backends can implement it as a batch
request.
book : |
an EBook |
error : |
a GError to set on failure |
Returns : | TRUE if successful, FALSE otherwise
|
gboolean e_book_add_contact (EBook *book, EContact *contact, GError **error);
Adds contact
to book
.
gboolean e_book_add_contacts (EBook *book, GList *contacts, GError **error);
Adds contacts
to book
. This is always more efficient than calling
e_book_add_contact if you have more than one contacts
to add, as some
backends can implement it as a batch request.
book : |
an EBook |
contacts : |
an GList of EContacts |
error : |
a GError to set on failure |
Returns : | TRUE if successful, FALSE otherwise
|
gboolean e_book_commit_contact (EBook *book, EContact *contact, GError **error);
Applies the changes made to contact
to the stored version in
book
.
gboolean e_book_commit_contacts (EBook *book, GList *contacts, GError **error);
Applies the changes made to contacts
to the stored versions in book
.
gboolean e_book_get_book_view (EBook *book, EBookQuery *query, GList *requested_fields, int max_results, EBookView **book_view, GError **error);
Query book
with query
, creating a EBookView in book_view
with the fields
specified by requested_fields
and limited at max_results
records. On an
error, error
is set and FALSE
returned.
book : |
an EBook |
query : |
an EBookQuery |
requested_fields : |
a GList containing the names of fields to return, or NULL for all |
max_results : |
the maximum number of contacts to show (or 0 for all) |
book_view : |
A EBookView pointer, will be set to the view |
error : |
a GError to set on failure |
Returns : | TRUE if successful, FALSE otherwise
|
gboolean e_book_get_contacts (EBook *book, EBookQuery *query, GList **contacts, GError **error);
Query book
with query
, setting contacts
to the list of contacts which
matched. On failed, error
will be set and FALSE
returned.
book : |
an EBook |
query : |
an EBookQuery |
contacts : |
a GList pointer, will be set to the list of contacts |
error : |
a GError to set on failure |
Returns : | TRUE on success, FALSE otherwise
|
gboolean e_book_get_changes (EBook *book, char *changeid, GList **changes, GError **error);
Get the set of changes since the previous call to e_book_get_changes for a given change ID.
book : |
an EBook |
changeid : |
the change ID |
changes : |
return location for a GList of EBookChange items |
error : |
a GError to set on failure. |
Returns : | TRUE on success, FALSE otherwise |
void e_book_free_change_list (GList *change_list);
Free the contents of change_list, and the list itself.
change_list : |
a GList of EBookChange items |
const char* e_book_get_uri (EBook *book);
Get the URI that this book has loaded. This string should not be freed.
book : |
an EBook |
Returns : | The URI. |
const char* e_book_get_static_capabilities (EBook *book, GError **error);
Get the list of capabilities which the backend for this address book supports. This string should not be freed.
book : |
an EBook |
error : |
an GError to set on failure |
Returns : | The capabilities list |
gboolean e_book_check_static_capability (EBook *book, const char *cap);
Check to see if the backend for this address book supports the capability
cap
.
book : |
an EBook |
cap : |
A capability string |
Returns : | TRUE if the backend supports cap , FALSE otherwise.
|
gboolean e_book_is_writable (EBook *book);
Check if this book is writable.
book : |
an EBook |
Returns : | TRUE if this book is writable, otherwise FALSE .
|
gboolean e_book_cancel (EBook *book, GError **error);
Used to cancel an already running operation on book
. This
function makes a synchronous CORBA to the backend telling it to
cancel the operation. If the operation wasn't cancellable (either
transiently or permanently) or had already comopleted on the server
side, this function will return E_BOOK_STATUS_COULD_NOT_CANCEL, and
the operation will continue uncancelled. If the operation could be
cancelled, this function will return E_BOOK_ERROR_OK, and the
blocked e_book function corresponding to current operation will
return with a status of E_BOOK_STATUS_CANCELLED.
book : |
an EBook |
error : |
a GError to set on failure |
Returns : | TRUE on success, FALSE otherwise
|
gboolean e_book_get_self (EContact **contact, EBook **book, GError **error);
Get the EContact referring to the user of the address book
and set it in contact
and book
.
gboolean e_book_set_self (EBook *book, EContact *contact, GError **error);
Specify that contact
residing in book
is the EContact that
refers to the user of the address book.
gboolean e_book_is_self (EContact *contact);
Check if contact
is the user of the address book.
contact : |
an EContact |
Returns : | TRUE if contact is the user, FALSE otherwise.
|
gboolean e_book_get_addressbooks (ESourceList **addressbook_sources, GError **error);
Populate *addressbook_sources with the list of all sources which have been added to Evolution.
addressbook_sources : |
A pointer to a ESourceList* to set |
error : |
A pointer to a GError* to set on error |
Returns : | TRUE if addressbook_sources was set, otherwise FALSE .
|
void (*EBookCallback) (EBook *book, EBookStatus status, gpointer closure);
Specifies the type of function passed to many asynchronous EBook functions and used as a callback.
book : |
an EBook |
status : |
an EBookStatus |
closure : |
the user-provided data |
void (*EBookIdCallback) (EBook *book, EBookStatus status, const char *id, gpointer closure);
Specifies the type of function passed to e_book_async_add_contact()
and used as a callback.
book : |
an EBook |
status : |
an EBookStatus |
id : |
the UID of the relevant contact |
closure : |
the user-provided data |
void (*EBookContactCallback) (EBook *book, EBookStatus status, EContact *contact, gpointer closure);
Specifies the type of function passed to e_book_async_get_contact()
and used as a callback.
book : |
an EBook |
status : |
an EBookStatus |
contact : |
the relevant EContact |
closure : |
the user-provided data |
void (*EBookListCallback) (EBook *book, EBookStatus status, GList *list, gpointer closure);
Specifies the type of function passed to e_book_async_get_changes()
and
e_book_async_get_contacts()
and used as a callback.
book : |
an EBook |
status : |
an EBookStatus |
list : |
a GList of EContacts |
closure : |
the user-provided data |
void (*EBookBookViewCallback) (EBook *book, EBookStatus status, EBookView *book_view, gpointer closure);
Specifies the type of function passed to e_book_async_get_book_view()
and
used as a callback.
book : |
an EBook |
status : |
an EBookStatus |
book_view : |
the relevant EBookView |
closure : |
the user-provided data |
void (*EBookEListCallback) (EBook *book, EBookStatus status, EList *list, gpointer closure);
Specifies the type of function passed to a few asynchronous EBook functions and used as a callback.
book : |
an EBook |
status : |
an EBookStatus |
list : |
an EList of vCard field names |
closure : |
the user-provided data |
guint e_book_async_open (EBook *book, gboolean only_if_exists, EBookCallback open_response, gpointer closure);
Opens the addressbook, making it ready for queries and other operations. This function does not block.
book : |
an EBook |
only_if_exists : |
if TRUE , fail if this book doesn't already exist, otherwise create it first
|
open_response : |
a function to call when the operation finishes |
closure : |
data to pass to callback function |
Returns : | FALSE if successful, TRUE otherwise.
|
guint e_book_async_remove (EBook *book, EBookCallback cb, gpointer closure);
Remove the backing data for this EBook. For example, with the file backend this deletes the database file. You cannot get it back!
book : |
an EBook |
cb : |
a function to call when the operation finishes |
closure : |
data to pass to callback function |
Returns : | FALSE if successful, TRUE otherwise.
|
guint e_book_async_get_required_fields (EBook *book, EBookEListCallback cb, gpointer closure);
Gets a list of fields that are required to be filled in for
all contacts in this book
. This function does not block.
book : |
an EBook |
cb : |
function to call when the operation finishes |
closure : |
data to pass to callback function |
Returns : | TRUE if the operation was started, FALSE otherwise.
|
guint e_book_async_get_supported_fields (EBook *book, EBookEListCallback cb, gpointer closure);
Gets a list of fields that can be stored for contacts
in this book
. Other fields may be discarded. This
function does not block.
book : |
an EBook |
cb : |
function to call when the operation finishes |
closure : |
data to pass to callback function |
Returns : | TRUE if successful, FALSE otherwise.
|
guint e_book_async_get_supported_auth_methods (EBook *book, EBookEListCallback cb, gpointer closure);
Queries book
for the list of authentication methods it supports.
This function does not block.
book : |
an EBook |
cb : |
function to call when the operation finishes |
closure : |
data to pass to callback function |
Returns : | TRUE if successful, FALSE otherwise.
|
guint e_book_async_authenticate_user (EBook *book, const char *user, const char *passwd, const char *auth_method, EBookCallback cb, gpointer closure);
Authenticate user
with passwd
, using the auth method
auth_method
. auth_method
must be one of the authentication
methods returned using e_book_get_supported_auth_methods.
This function does not block.
book : |
an EBook |
user : |
user name |
passwd : |
password |
auth_method : |
string indicating authentication method |
cb : |
function to call when the operation finishes |
closure : |
data to pass to callback function |
Returns : | FALSE if successful, TRUE otherwise.
|
guint e_book_async_get_contact (EBook *book, const char *id, EBookContactCallback cb, gpointer closure);
Retrieves a contact specified by id
from book
.
book : |
an EBook |
id : |
a unique string ID specifying the contact |
cb : |
function to call when operation finishes |
closure : |
data to pass to callback function |
Returns : | FALSE if successful, TRUE otherwise
|
guint e_book_async_get_contacts (EBook *book, EBookQuery *query, EBookListCallback cb, gpointer closure);
Query book
with query
.
book : |
an EBook |
query : |
an EBookQuery |
cb : |
a function to call when the operation finishes |
closure : |
data to pass to callback function |
Returns : | FALSE on success, TRUE otherwise
|
guint e_book_async_get_changes (EBook *book, char *changeid, EBookListCallback cb, gpointer closure);
Get the set of changes since the previous call to e_book_async_get_changes for a given change ID.
book : |
an EBook |
changeid : |
the change ID |
cb : |
function to call when operation finishes |
closure : |
data to pass to callback function |
Returns : | TRUE on success, FALSE otherwise |
guint e_book_async_remove_contact (EBook *book, EContact *contact, EBookCallback cb, gpointer closure);
Removes contact
from book
.
guint e_book_async_remove_contact_by_id (EBook *book, const char *id, EBookCallback cb, gpointer closure);
Removes the contact with id id
from book
.
book : |
an EBook |
id : |
a unique ID string specifying the contact |
cb : |
a function to call when the operation finishes |
closure : |
data to pass to callback function |
Returns : | TRUE if successful, FALSE otherwise
|
guint e_book_async_remove_contacts (EBook *book, GList *ids, EBookCallback cb, gpointer closure);
Removes the contacts with ids from the list ids
from book
. This is
always more efficient than calling e_book_remove_contact()
if you
have more than one id to remove, as some backends can implement it
as a batch request.
book : |
an EBook |
ids : |
a GList of const char *id's |
cb : |
a function to call when the operation finishes |
closure : |
data to pass to callback function |
Returns : | TRUE if successful, FALSE otherwise
|
guint e_book_async_remove_all_contacts (EBook *book, EBookCallback cb, gpointer closure);
Removes all contacts from book
. This is always more efficient than calling
e_book_remove_contact()
, as some backends can implement it as a batch request.
book : |
an EBook |
cb : |
a function to call when the operation finishes |
closure : |
data to pass to callback function |
Returns : | TRUE if successful, FALSE otherwise
|
guint e_book_async_add_contact (EBook *book, EContact *contact, EBookIdCallback cb, gpointer closure);
Adds contact
to book
without blocking.
guint e_book_async_add_contacts (EBook *book, GList *contacts, EBookCallback cb, gpointer closure);
Adds contacts
to book
without blocking. This is always more
efficient than calling e_book_add_contact if you have more than
one contacts
to add, as some backends can implement it as a
batch request.
book : |
an EBook |
contacts : |
a GList of EContacts |
cb : |
function to call when the operation finishes |
closure : |
data to pass to callback function |
Returns : | TRUE if the operation was started, FALSE otherwise.
|
guint e_book_async_commit_contact (EBook *book, EContact *contact, EBookCallback cb, gpointer closure);
Applies the changes made to contact
to the stored version in
book
without blocking.
guint e_book_async_commit_contacts (EBook *book, GList *contacts, EBookCallback cb, gpointer closure);
Applies the changes made to contacts
to the stored versions in
book
without blocking.
guint e_book_async_get_book_view (EBook *book, EBookQuery *query, GList *requested_fields, int max_results, EBookBookViewCallback cb, gpointer closure);
Query book
with query
, creating a EBookView with the fields
specified by requested_fields
and limited at max_results
records.
book : |
an EBook |
query : |
an EBookQuery |
requested_fields : |
a GList containing the names of fields to return, or NULL for all |
max_results : |
the maximum number of contacts to show (or 0 for all) |
cb : |
a function to call when the operation finishes |
closure : |
data to pass to callback function |
Returns : | FALSE if successful, TRUE otherwise
|
"auth-required"
signalvoid user_function (EBook *book, gpointer user_data) : Run Last
This signal is emitted when the back-end for the book requires authentication to connect to the database.
book : |
an EBook |
user_data : |
user data set when the signal handler was connected. |
"backend-died"
signalvoid user_function (EBook *book, gpointer user_data) : Run Last
This signal is emitted when the back-end for the book disappeared for some reason (eg, it crashed).
book : |
an EBook |
user_data : |
user data set when the signal handler was connected. |
"connection-status"
signalvoid user_function (EBook *book, gboolean connected, gpointer user_data) : Run Last
This signal is emitted when the back-end for the book's connection changes status.
book : |
an EBook |
connected : |
TRUE if now connected
|
user_data : |
user data set when the signal handler was connected. |
"writable-status"
signalvoid user_function (EBook *book, gboolean writable, gpointer user_data) : Run Last
This signal is emitted when the back-end for the book becomes writable or unwritable.
book : |
an EBook |
writable : |
TRUE if now writable
|
user_data : |
user data set when the signal handler was connected. |