## EDataBook

EDataBook

## Synopsis

    struct              EDataBook;
    #define             E_DATA_BOOK_ERROR
    GError *            e_data_book_create_error            (EDataBookStatus status,
                                                             const gchar *custom_msg);
    GError *            e_data_book_create_error_fmt        (EDataBookStatus status,
                                                             const gchar *custom_msg_fmt,
                                                             ...);
    const gchar *       e_data_book_status_to_string        (EDataBookStatus status);
    #define             e_return_data_book_error_if_fail    (expr,
                                                             _code)
    #define             e_return_data_book_error_val_if_fail(expr,
                                                             _code)
    EDataBook *         e_data_book_new                     (struct _EBookBackend *backend);
    struct _EBookBackend * e_data_book_get_backend          (EDataBook *book);
    guint               e_data_book_register_gdbus_object   (EDataBook *cal,
                                                             GDBusConnection *connection,
                                                             const gchar *object_path,
                                                             GError **error);
    void                e_data_book_respond_open            (EDataBook *book,
                                                             guint32 opid,
                                                             GError *error);
    void                e_data_book_respond_remove          (EDataBook *book,
                                                             guint32 opid,
                                                             GError *error);
    void                e_data_book_respond_refresh         (EDataBook *book,
                                                             guint32 opid,
                                                             GError *error);
    void                e_data_book_respond_get_backend_property
                                                            (EDataBook *book,
                                                             guint32 opid,
                                                             GError *error,
                                                             const gchar *prop_value);
    void                e_data_book_respond_set_backend_property
                                                            (EDataBook *book,
                                                             guint32 opid,
                                                             GError *error);
    void                e_data_book_respond_create_contacts (EDataBook *book,
                                                             guint32 opid,
                                                             GError *error,
                                                             const GSList *contacts);
    void                e_data_book_respond_remove_contacts (EDataBook *book,
                                                             guint32 opid,
                                                             GError *error,
                                                             const GSList *ids);
    void                e_data_book_respond_modify_contacts (EDataBook *book,
                                                             guint32 opid,
                                                             GError *error,
                                                             const GSList *contacts);
    void                e_data_book_respond_get_contact     (EDataBook *book,
                                                             guint32 opid,
                                                             GError *error,
                                                             const gchar *vcard);
    void                e_data_book_respond_get_contact_list
                                                            (EDataBook *book,
                                                             guint32 opid,
                                                             GError *error,
                                                             const GSList *cards);
    void                e_data_book_respond_get_contact_list_uids
                                                            (EDataBook *book,
                                                             guint32 opid,
                                                             GError *error,
                                                             const GSList *uids);
    void                e_data_book_report_error            (EDataBook *book,
                                                             const gchar *message);
    void                e_data_book_report_readonly         (EDataBook *book,
                                                             gboolean readonly);
    void                e_data_book_report_online           (EDataBook *book,
                                                             gboolean is_online);
    void                e_data_book_report_opened           (EDataBook *book,
                                                             const GError *error);
    void                e_data_book_report_backend_property_changed
                                                            (EDataBook *book,
                                                             const gchar *prop_name,
                                                             const gchar *prop_value);
    gchar *             e_data_book_string_slist_to_comma_string
                                                            (const GSList *strings);

## Object Hierarchy

      GObject
       +----EDataBook

## Properties

      "backend"                  EBookBackend*         : Read / Write / Construct Only

## Description

## Details

### struct EDataBook

    struct EDataBook;

### E_DATA_BOOK_ERROR

    #define E_DATA_BOOK_ERROR e_data_book_error_quark ()

Since 2.30

### e_data_book_create_error ()

    GError *            e_data_book_create_error            (EDataBookStatus status,
                                                             const gchar *custom_msg);

`status` : | EDataBookStatus code
`custom_msg` : | Custom message to use for the error. When NULL, then uses a default message based on the `status` code.
Returns : | NULL, when the `status` is E_DATA_BOOK_STATUS_SUCCESS, or a newly allocated GError, which should be freed with `g_error_free()` call.

Since 2.32

### e_data_book_create_error_fmt ()

    GError *            e_data_book_create_error_fmt        (EDataBookStatus status,
                                                             const gchar *custom_msg_fmt,
                                                             ...);

Similar as `e_data_book_create_error()`, only here, instead of custom_msg, is used a `printf()` format to create a custom_msg for the error.

Since 2.32

### e_data_book_status_to_string ()

    const gchar *       e_data_book_status_to_string        (EDataBookStatus status);

Since 2.32

### e_return_data_book_error_if_fail()

    #define             e_return_data_book_error_if_fail(expr, _code)

Since 2.32

### e_return_data_book_error_val_if_fail()

    #define             e_return_data_book_error_val_if_fail(expr, _code)

Same as `e_return_data_book_error_if_fail()`, only returns FALSE on a failure

Since 3.2

### e_data_book_new ()

    EDataBook *         e_data_book_new                     (struct _EBookBackend *backend);

### e_data_book_get_backend ()

    struct _EBookBackend * e_data_book_get_backend          (EDataBook *book);

### e_data_book_register_gdbus_object ()

    guint               e_data_book_register_gdbus_object   (EDataBook *cal,
                                                             GDBusConnection *connection,
                                                             const gchar *object_path,
                                                             GError **error);

Registers GDBus object of this EDataBook.

Since 2.32

### e_data_book_respond_open ()

    void                e_data_book_respond_open            (EDataBook *book,
                                                             guint32 opid,
                                                             GError *error);

### e_data_book_respond_remove ()

    void                e_data_book_respond_remove          (EDataBook *book,
                                                             guint32 opid,
                                                             GError *error);

### e_data_book_respond_refresh ()

    void                e_data_book_respond_refresh         (EDataBook *book,
                                                             guint32 opid,
                                                             GError *error);

Notifies listeners of the completion of the refresh method call.

`book` : | An addressbook client interface.
`error` : | Operation error, if any, automatically freed if passed it.

Since 3.2

### e_data_book_respond_get_backend_property ()

    void                e_data_book_respond_get_backend_property
                                                            (EDataBook *book,
                                                             guint32 opid,
                                                             GError *error,
                                                             const gchar *prop_value);

FIXME: Document me.

Since 3.2

### e_data_book_respond_set_backend_property ()

    void                e_data_book_respond_set_backend_property
                                                            (EDataBook *book,
                                                             guint32 opid,
                                                             GError *error);

FIXME: Document me.

Since 3.2

### e_data_book_respond_create_contacts ()

    void                e_data_book_respond_create_contacts (EDataBook *book,
                                                             guint32 opid,
                                                             GError *error,
                                                             const GSList *contacts);

FIXME: Document me!

Since 3.4

### e_data_book_respond_remove_contacts ()

    void                e_data_book_respond_remove_contacts (EDataBook *book,
                                                             guint32 opid,
                                                             GError *error,
                                                             const GSList *ids);

### e_data_book_respond_modify_contacts ()

    void                e_data_book_respond_modify_contacts (EDataBook *book,
                                                             guint32 opid,
                                                             GError *error,
                                                             const GSList *contacts);

FIXME: Document me!

Since 3.4

### e_data_book_respond_get_contact ()

    void                e_data_book_respond_get_contact     (EDataBook *book,
                                                             guint32 opid,
                                                             GError *error,
                                                             const gchar *vcard);

### e_data_book_respond_get_contact_list ()

    void                e_data_book_respond_get_contact_list
                                                            (EDataBook *book,
                                                             guint32 opid,
                                                             GError *error,
                                                             const GSList *cards);

### e_data_book_respond_get_contact_list_uids ()

    void                e_data_book_respond_get_contact_list_uids
                                                            (EDataBook *book,
                                                             guint32 opid,
                                                             GError *error,
                                                             const GSList *uids);

FIXME: Document me.

Since 3.2

### e_data_book_report_error ()

    void                e_data_book_report_error            (EDataBook *book,
                                                             const gchar *message);

FIXME: Document me.

Since 3.2

### e_data_book_report_readonly ()

    void                e_data_book_report_readonly         (EDataBook *book,
                                                             gboolean readonly);

FIXME: Document me.

Since 3.2

### e_data_book_report_online ()

    void                e_data_book_report_online           (EDataBook *book,
                                                             gboolean is_online);

FIXME: Document me.

Since 3.2

### e_data_book_report_opened ()

    void                e_data_book_report_opened           (EDataBook *book,
                                                             const GError *error);

Reports to associated client that opening phase of the book is finished. error being NULL means successfully, otherwise reports an error which happened during opening phase. By opening phase is meant a process including successfull authentication to the server/storage.

Since 3.2

### e_data_book_report_backend_property_changed ()

    void                e_data_book_report_backend_property_changed
                                                            (EDataBook *book,
                                                             const gchar *prop_name,
                                                             const gchar *prop_value);

FIXME: Document me.

Since 3.2

### e_data_book_string_slist_to_comma_string ()

    gchar *             e_data_book_string_slist_to_comma_string
                                                            (const GSList *strings);

Takes a list of strings and converts it to a comma-separated string of values; free returned pointer with `g_free()`

Since 3.2

## Property Details

### The `"backend"` property

      "backend"                  EBookBackend*         : Read / Write / Construct Only

The backend driving this connection.