## EBookIndicesUpdater EBookIndicesUpdater — Handle EBookIndices updates |

## Functions

gboolean | e_book_indices_updater_take_indices ()
const EBookIndices * | e_book_indices_updater_get_indices ()
void | e_book_indices_set_ascending_sort ()
gboolean | e_book_indices_get_ascending_sort ()
gboolean | e_book_indices_updater_add ()
gboolean | e_book_indices_updater_remove ()

## Types and Values

struct | EBookIndicesUpdater

## Object Hierarchy

        GObject
        ╰── EBookIndicesUpdater
            ├── EDataBookViewWatcherCache
            ├── EDataBookViewWatcherMemory
            ╰── EDataBookViewWatcherSqlite

## Includes

    #include <libebook-contacts/libebook-contacts.h>

## Description

This is an abstract class to handle EBooKindices updates. It's suitable as a base class for objects handling manual query views (see `E_BOOK_CLIENT_VIEW_FLAGS_MANUAL_QUERY`).

The users of this class should call `e_book_indices_updater_take_indices()` first, thus the EBookIndices knows the indices. The indices are subsequently updated by `e_book_indices_updater_add()`, `e_book_indices_updater_modify()` and `e_book_indices_updater_remove()` functions, where each returns whether the indices changed.

Current indices can be obtained by `e_book_indices_updater_get_indices()`.

Note the class is not thread safe. It's a responsibility of the caller to ensure thread safety.

## Functions

### e_book_indices_updater_take_indices ()

    gboolean
    e_book_indices_updater_take_indices (EBookIndicesUpdater *self,
                                         EBookIndices *indices);

Sets the initial indices to be updated by the `self` . If `NULL`, then unsets them. The function always discards data previously gathered about the involved contacts, regardless whether the indices changed or not.

The function assumes ownership of the `indices` .

#### Parameters

self | an EBookIndicesUpdater |
indices | an EBookIndices, or `NULL`. | [nullable][transfer full]

#### Returns

whether the indices changed

Since: 3.50

### e_book_indices_updater_get_indices ()

    const EBookIndices *
    e_book_indices_updater_get_indices (EBookIndicesUpdater *self);

Sets the initial indices to be updated by the `self` . If `NULL`, then unsets them.

#### Parameters

self | an EBookIndicesUpdater |

#### Returns

current indices, or `NULL`, when none had been set yet.

[nullable]

Since: 3.50

### e_book_indices_set_ascending_sort ()

    void
    e_book_indices_set_ascending_sort (EBookIndicesUpdater *self,
                                       gboolean ascending_sort);

Sets whether the contacts are sorted in an ascending order; if not, then they are sorted in the descending order. That influences what indexes the indices have set.

#### Parameters

self | an EBookIndicesUpdater |
ascending_sort | the value to set |

Since: 3.50

### e_book_indices_get_ascending_sort ()

    gboolean
    e_book_indices_get_ascending_sort (EBookIndicesUpdater *self);

Returns whether the `self` considers contacts stored in the ascending order.

#### Parameters

self | an EBookIndicesUpdater |

#### Returns

`TRUE`, when considers contacts sorted in ascending order, `FALSE` when in the descending order.

Since: 3.50

### e_book_indices_updater_add ()

    gboolean
    e_book_indices_updater_add (EBookIndicesUpdater *self,
                                const gchar *uid,
                                guint indices_index);

Notifies the `self` that a new contact with UID `uid` had been added to the set and it occupies the `indices_index` index in the indices. In case the `uid` had been added previously its index is modified instead.

This function can be used only after initial call to `e_book_indices_updater_take_indices()`.

#### Parameters

self | an EBookIndicesUpdater |
uid | a UID of a contact |
indices_index | index to the indices array the contact belongs to |

#### Returns

whether the indices changed

Since: 3.50

### e_book_indices_updater_remove ()

    gboolean
    e_book_indices_updater_remove (EBookIndicesUpdater *self,
                                   const gchar *uid);

Notifies the `self` that an existing contact with UID `uid` had been removed from the set. Calling the function with `uid` unknown to the `self` does nothing and returns `FALSE`.

This function can be used only after initial call to `e_book_indices_updater_take_indices()`.

#### Parameters

self | an EBookIndicesUpdater |
uid | a UID of a removed contact |

#### Returns

whether the indices changed

Since: 3.50

## Types and Values

### struct EBookIndicesUpdater

    struct EBookIndicesUpdater;

An abstract object to handle EBookIndices changes.

Since: 3.50