EBookBackend

EBookBackend — An abstract class for implementing addressbook backends

Functions

const gchar * e_book_backend_get_cache_dir ()
gchar * e_book_backend_dup_cache_dir ()
void e_book_backend_set_cache_dir ()
EDataBook * e_book_backend_ref_data_book ()
void e_book_backend_set_data_book ()
GProxyResolver * e_book_backend_ref_proxy_resolver ()
ESourceRegistry * e_book_backend_get_registry ()
gboolean e_book_backend_get_writable ()
void e_book_backend_set_writable ()
gboolean e_book_backend_is_opened ()
gboolean e_book_backend_is_readonly ()
gchar * e_book_backend_get_backend_property ()
gboolean e_book_backend_open_sync ()
void e_book_backend_open ()
gboolean e_book_backend_open_finish ()
gboolean e_book_backend_refresh_sync ()
void e_book_backend_refresh ()
gboolean e_book_backend_refresh_finish ()
gboolean e_book_backend_create_contacts_sync ()
void e_book_backend_create_contacts ()
gboolean e_book_backend_create_contacts_finish ()
gboolean e_book_backend_modify_contacts_sync ()
void e_book_backend_modify_contacts ()
gboolean e_book_backend_modify_contacts_finish ()
gboolean e_book_backend_remove_contacts_sync ()
void e_book_backend_remove_contacts ()
gboolean e_book_backend_remove_contacts_finish ()
EContact * e_book_backend_get_contact_sync ()
void e_book_backend_get_contact ()
EContact * e_book_backend_get_contact_finish ()
gboolean e_book_backend_get_contact_list_sync ()
void e_book_backend_get_contact_list ()
gboolean e_book_backend_get_contact_list_finish ()
gboolean e_book_backend_get_contact_list_uids_sync ()
void e_book_backend_get_contact_list_uids ()
gboolean e_book_backend_get_contact_list_uids_finish ()
void e_book_backend_start_view ()
void e_book_backend_stop_view ()
void e_book_backend_add_view ()
void e_book_backend_remove_view ()
GList * e_book_backend_list_views ()
void e_book_backend_notify_update ()
void e_book_backend_notify_remove ()
void e_book_backend_notify_complete ()
void e_book_backend_notify_error ()
void e_book_backend_notify_property_changed ()
EDataBookDirect * e_book_backend_get_direct_book ()
void e_book_backend_configure_direct ()
void e_book_backend_sync ()
gboolean e_book_backend_set_locale ()
gchar * e_book_backend_dup_locale ()
EDataBookCursor * e_book_backend_create_cursor ()
gboolean e_book_backend_delete_cursor ()
GSimpleAsyncResult * e_book_backend_prepare_for_completion ()

Properties

gchar * cache-dir Read / Write
GProxyResolver * proxy-resolver Read
ESourceRegistry * registry Read / Write / Construct Only
gboolean writable Read / Write

Signals

Types and Values

Object Hierarchy

    GObject
    ╰── EBackend
        ╰── EBookBackend

Includes

#include <libedata-book/libedata-book.h>

Description

This is the main server facing API for interfacing with addressbook backends, addressbook backends must implement methods on this class.

Functions

e_book_backend_get_cache_dir ()

const gchar *
e_book_backend_get_cache_dir (EBookBackend *backend);

Returns the cache directory path used by backend .

Parameters

backend

an EBookBackend

 

Returns

the cache directory path

Since: 2.32


e_book_backend_dup_cache_dir ()

gchar *
e_book_backend_dup_cache_dir (EBookBackend *backend);

Thread-safe variation of e_book_backend_get_cache_dir(). Use this function when accessing backend from multiple threads.

The returned string should be freed with g_free() when no longer needed.

Parameters

backend

an EBookBackend

 

Returns

a newly-allocated copy of “cache-dir”

Since: 3.10


e_book_backend_set_cache_dir ()

void
e_book_backend_set_cache_dir (EBookBackend *backend,
                              const gchar *cache_dir);

Sets the cache directory path for use by backend .

Note that EBookBackend is initialized with a default cache directory path which should suffice for most cases. Backends should not override the default path without good reason.

Parameters

backend

an EBookBackend

 

cache_dir

a local cache directory path

 

Since: 2.32


e_book_backend_ref_data_book ()

EDataBook *
e_book_backend_ref_data_book (EBookBackend *backend);

Returns the EDataBook for backend . The EDataBook is essentially the glue between incoming D-Bus requests and backend 's native API.

An EDataBook should be set only once after backend is first created. If an EDataBook has not yet been set, the function returns NULL.

The returned EDataBook is referenced for thread-safety and must be unreferenced with g_object_unref() when finished with it.

Parameters

backend

an EBookBackend

 

Returns

an EDataBook, or NULL

Since: 3.10


e_book_backend_set_data_book ()

void
e_book_backend_set_data_book (EBookBackend *backend,
                              EDataBook *data_book);

Sets the EDataBook for backend . The EDataBook is essentially the glue between incoming D-Bus requests and backend 's native API.

An EDataBook should be set only once after backend is first created.

Parameters

backend

an EBookBackend

 

data_book

an EDataBook

 

Since: 3.10


e_book_backend_ref_proxy_resolver ()

GProxyResolver *
e_book_backend_ref_proxy_resolver (EBookBackend *backend);

Returns the GProxyResolver for backend (if applicable), as indicated by the “proxy-uid” of backend 's “source” or one of its ancestors.

The returned GProxyResolver is referenced for thread-safety and must be unreferenced with g_object_unref() when finished with it.

Parameters

backend

an EBookBackend

 

Returns

a GProxyResolver, or NULL

Since: 3.12


e_book_backend_get_registry ()

ESourceRegistry *
e_book_backend_get_registry (EBookBackend *backend);

Returns the data source registry to which “source” belongs.

Parameters

backend

an EBookBackend

 

Returns

an ESourceRegistry

Since: 3.6


e_book_backend_get_writable ()

gboolean
e_book_backend_get_writable (EBookBackend *backend);

Returns whether backend will accept changes to its data content.

Parameters

backend

an EBookBackend

 

Returns

whether backend is writable

Since: 3.8


e_book_backend_set_writable ()

void
e_book_backend_set_writable (EBookBackend *backend,
                             gboolean writable);

Sets whether backend will accept changes to its data content.

Parameters

backend

an EBookBackend

 

writable

whether backend is writable

 

Since: 3.8


e_book_backend_is_opened ()

gboolean
e_book_backend_is_opened (EBookBackend *backend);

Checks if backend 's storage has been opened (and authenticated, if necessary) and the backend itself is ready for accessing. This property is changed automatically within call of e_book_backend_notify_opened().

Parameters

backend

an EBookBackend

 

Returns

TRUE if fully opened, FALSE otherwise.

Since: 3.2


e_book_backend_is_readonly ()

gboolean
e_book_backend_is_readonly (EBookBackend *backend);

Checks if we can write to backend .

Parameters

backend

an EBookBackend

 

Returns

TRUE if read-only, FALSE if not.

Since: 3.2


e_book_backend_get_backend_property ()

gchar *
e_book_backend_get_backend_property (EBookBackend *backend,
                                     const gchar *prop_name);

Obtains the value of the backend property named prop_name . Freed the returned string with g_free() when finished with it.

Parameters

backend

an EBookBackend

 

prop_name

a backend property name

 

Returns

the value for prop_name

Since: 3.10


e_book_backend_open_sync ()

gboolean
e_book_backend_open_sync (EBookBackend *backend,
                          GCancellable *cancellable,
                          GError **error);

"Opens" the backend . Opening a backend is something of an outdated concept, but the operation is hanging around for a little while longer. This usually involves some custom initialization logic, and testing of remote authentication if applicable.

If an error occurs, the function will set error and return FALSE.

Parameters

backend

an EBookBackend

 

cancellable

optional GCancellable object, or NULL

 

error

return location for a GError, or NULL

 

Returns

TRUE on success, FALSE on failure

Since: 3.10


e_book_backend_open ()

void
e_book_backend_open (EBookBackend *backend,
                     GCancellable *cancellable,
                     GAsyncReadyCallback callback,
                     gpointer user_data);

Asynchronously "opens" the backend . Opening a backend is something of an outdated concept, but the operation is hanging around for a little while longer. This usually involves some custom initialization logic, and testing of remote authentication if applicable.

When the operation is finished, callback will be called. You can then call e_book_backend_open_finish() to get the result of the operation.

Parameters

backend

an EBookBackend

 

cancellable

optional GCancellable object, or NULL

 

callback

a GAsyncReadyCallback to call when the request is satisfied

 

user_data

data to pass to the callback function

 

Since: 3.10


e_book_backend_open_finish ()

gboolean
e_book_backend_open_finish (EBookBackend *backend,
                            GAsyncResult *result,
                            GError **error);

Finishes the operation started with e_book_backend_open().

If an error occurred, the function will set error and return FALSE.

Parameters

backend

an EBookBackend

 

result

a GAsyncResult

 

error

return location for a GError, or NULL

 

Returns

TRUE on success, FALSE on failure

Since: 3.10


e_book_backend_refresh_sync ()

gboolean
e_book_backend_refresh_sync (EBookBackend *backend,
                             GCancellable *cancellable,
                             GError **error);

Initiates a refresh for backend , if the backend supports refreshing. The actual refresh operation completes on its own time. This function merely initiates the operation.

If an error occurs while initiating the refresh, the function will set error and return FALSE. If the backend does not support refreshing, the function will set an E_CLIENT_ERROR_NOT_SUPPORTED error and return FALSE.

Parameters

backend

an EBookBackend

 

cancellable

optional GCancellable object, or NULL

 

error

return location for a GError, or NULL

 

Returns

TRUE on success, FALSE on failure

Since: 3.10


e_book_backend_refresh ()

void
e_book_backend_refresh (EBookBackend *backend,
                        GCancellable *cancellable,
                        GAsyncReadyCallback callback,
                        gpointer user_data);

Asynchronously initiates a refresh for backend , if the backend supports refreshing. The actual refresh operation completes on its own time. This function, along with e_book_backend_refresh_finish(), merely initiates the operation.

Once the refresh is initiated, callback will be called. You can then call e_book_backend_refresh_finish() to get the result of the initiation.

Parameters

backend

an EBookBackend

 

cancellable

optional GCancellable object, or NULL

 

callback

a GAsyncReadyCallback to call when the request is satisfied

 

user_data

data to pass to the callback function

 

Since: 3.10


e_book_backend_refresh_finish ()

gboolean
e_book_backend_refresh_finish (EBookBackend *backend,
                               GAsyncResult *result,
                               GError **error);

Finishes the refresh initiation started with e_book_backend_refresh().

If an error occurred while initiating the refresh, the function will set error and return FALSE. If the backend does not support refreshing, the function will set an E_CLIENT_ERROR_NOT_SUPPORTED error and return FALSE.

Parameters

backend

an EBookBackend

 

result

a GAsyncResult

 

error

return location for a GError, or NULL

 

Returns

TRUE on success, FALSE on failure

Since: 3.10


e_book_backend_create_contacts_sync ()

gboolean
e_book_backend_create_contacts_sync (EBookBackend *backend,
                                     const gchar * const *vcards,
                                     GQueue *out_contacts,
                                     GCancellable *cancellable,
                                     GError **error);

Creates one or more new contacts from vcards , and deposits an EContact instance for each newly-created contact in out_contacts .

The returned EContact instances are referenced for thread-safety and must be unreferenced with g_object_unref() when finished with them.

If an error occurs, the function will set error and return FALSE.

Parameters

backend

an EBookBackend

 

vcards

a NULL-terminated array of vCard strings

 

out_contacts

a GQueue in which to deposit results

 

cancellable

optional GCancellable object, or NULL

 

error

return location for a GError, or NULL

 

Returns

TRUE on success, FALSE on failure

Since: 3.10


e_book_backend_create_contacts ()

void
e_book_backend_create_contacts (EBookBackend *backend,
                                const gchar * const *vcards,
                                GCancellable *cancellable,
                                GAsyncReadyCallback callback,
                                gpointer user_data);

Asynchronously creates one or more new contacts from vcards .

When the operation is finished, callback will be called. You can then call e_book_backend_create_contacts_finish() to get the result of the operation.

Parameters

backend

an EBookBackend

 

vcards

a NULL-terminated array of vCard strings

 

cancellable

optional GCancellable object, or NULL

 

callback

a GAsyncReadyCallback to call when the request is satisfied

 

user_data

data to pass to the callback function

 

Since: 3.10


e_book_backend_create_contacts_finish ()

gboolean
e_book_backend_create_contacts_finish (EBookBackend *backend,
                                       GAsyncResult *result,
                                       GQueue *out_contacts,
                                       GError **error);

Finishes the operation started with e_book_backend_create_contacts().

An EContact instance for each newly-created contact is deposited in out_contacts . The returned EContact instances are referenced for thread-safety and must be unreferenced with g_object_unref() when finished with them.

If an error occurred, the function will set error and return FALSE.

Parameters

backend

an EBookBackend

 

result

a GAsyncResult

 

out_contacts

a GQueue in which to deposit results

 

error

return location for a GError, or NULL

 

Returns

TRUE on success, FALSE on failure

Since: 3.10


e_book_backend_modify_contacts_sync ()

gboolean
e_book_backend_modify_contacts_sync (EBookBackend *backend,
                                     const gchar * const *vcards,
                                     GCancellable *cancellable,
                                     GError **error);

Modifies one or more contacts according to vcards .

If an error occurs, the function will set error and return FALSE.

Parameters

backend

an EBookBackend

 

vcards

a NULL-terminated array of vCard strings

 

cancellable

optional GCancellable object, or NULL

 

error

return location for a GError, or NULL

 

Returns

TRUE on success, FALSE on failure

Since: 3.10


e_book_backend_modify_contacts ()

void
e_book_backend_modify_contacts (EBookBackend *backend,
                                const gchar * const *vcards,
                                GCancellable *cancellable,
                                GAsyncReadyCallback callback,
                                gpointer user_data);

Asynchronously modifies one or more contacts according to vcards .

When the operation is finished, callback will be called. You can then call e_book_backend_modify_contacts_finish() to get the result of the operation.

Parameters

backend

an EBookBackend

 

vcards

a NULL-terminated array of vCard strings

 

cancellable

optional GCancellable object, or NULL

 

callback

a GAsyncReadyCallback to call when the request is satisfied

 

user_data

data to pass to the callback function

 

Since: 3.10


e_book_backend_modify_contacts_finish ()

gboolean
e_book_backend_modify_contacts_finish (EBookBackend *backend,
                                       GAsyncResult *result,
                                       GError **error);

Finishes the operation started with e_book_backend_modify_contacts().

If an error occurred, the function will set error and return FALSE.

Parameters

backend

an EBookBackend

 

result

a GAsyncResult

 

error

return location for a GError, or NULL

 

Returns

TRUE on success, FALSE on failure

Since: 3.10


e_book_backend_remove_contacts_sync ()

gboolean
e_book_backend_remove_contacts_sync (EBookBackend *backend,
                                     const gchar * const *uids,
                                     GCancellable *cancellable,
                                     GError **error);

Removes one or more contacts according to uids .

If an error occurs, the function will set error and return FALSE.

Parameters

backend

an EBookBackend

 

uids

a NULL-terminated array of contact ID strings

 

cancellable

optional GCancellable object, or NULL

 

error

return location for a GError, or NULL

 

Returns

TRUE on success, FALSE on failure

Since: 3.10


e_book_backend_remove_contacts ()

void
e_book_backend_remo