OssoABookListStore

OssoABookListStore — A GtkTreeModel associating information with EContact objects.

Synopsis

                    OssoABookListStore;
int                 (*OssoABookListStoreCompareFunc)    (const OssoABookListStoreRow *row_a,
                                                         const OssoABookListStoreRow *row_b,
                                                         gpointer user_data);
                    OssoABookListStoreRow;

void                osso_abook_list_store_set_book_view (OssoABookListStore *store,
                                                         EBookView *book_view);
EBookView*          osso_abook_list_store_get_book_view (OssoABookListStore *store);
void                osso_abook_list_store_set_roster    (OssoABookListStore *store,
                                                         OssoABookRoster *roster);
OssoABookRoster*    osso_abook_list_store_get_roster    (OssoABookListStore *store);
void                osso_abook_list_store_set_sort_func (OssoABookListStore *store,
                                                         OssoABookListStoreCompareFunc callback,
                                                         gpointer user_data,
                                                         GDestroyNotify destroy_data);
void                osso_abook_list_store_set_group_sort_func
                                                        (OssoABookListStore *store,
                                                         OssoABookListStoreCompareFunc callback,
                                                         gpointer user_data,
                                                         GDestroyNotify destroy_data);
void                osso_abook_list_store_pre_allocate_rows
                                                        (OssoABookListStore *store,
                                                         int n_rows);
void                osso_abook_list_store_cancel_loading
                                                        (OssoABookListStore *store);
gboolean            osso_abook_list_store_is_loading    (OssoABookListStore *store);

OssoABookListStoreRow* osso_abook_list_store_find_caps  (OssoABookListStore *store,
                                                         OssoABookCaps *caps,
                                                         GtkTreeIter *iter);
OssoABookListStoreRow** osso_abook_list_store_find_contacts
                                                        (OssoABookListStore *store,
                                                         const char *uid);
OssoABookListStoreRow* osso_abook_list_store_find_presence
                                                        (OssoABookListStore *store,
                                                         OssoABookPresence *presence,
                                                         GtkTreeIter *iter);

void                osso_abook_list_store_contact_changed
                                                        (OssoABookListStore *store,
                                                         OssoABookContact *contact);

OssoABookListStoreRow* osso_abook_list_store_iter_get_row
                                                        (OssoABookListStore *store,
                                                         GtkTreeIter *iter);
gboolean            osso_abook_list_store_row_get_iter  (OssoABookListStore *store,
                                                         const OssoABookListStoreRow *row,
                                                         GtkTreeIter *iter);

void                osso_abook_list_store_merge_rows    (OssoABookListStore *store,
                                                         GList *rows);
void                osso_abook_list_store_remove_rows   (OssoABookListStore *store,
                                                         OssoABookListStoreRow **rows,
                                                         gssize n_rows);

enum                OssoABookListStoreColumn;
const GEnumValue*   osso_abook_list_store_column_from_name
                                                        (const char *name);
const GEnumValue*   osso_abook_list_store_column_from_nick
                                                        (const char *nick);
const char*         osso_abook_list_store_column_get_name
                                                        (OssoABookListStoreColumn value);
const char*         osso_abook_list_store_column_get_nick
                                                        (OssoABookListStoreColumn value);

Description

The OssoABookAccountModel is a model that lists the EContact objects exposed by an EBookView, and their associated OssoABookPresence and OssoABookCaps objects.

Details

OssoABookListStore

typedef struct {
} OssoABookListStore;

All the fields of this structure are private to the object's implementation and should never be accessed directly.


OssoABookListStoreCompareFunc ()

int                 (*OssoABookListStoreCompareFunc)    (const OssoABookListStoreRow *row_a,
                                                         const OssoABookListStoreRow *row_b,
                                                         gpointer user_data);

The type of a comparison function used to compare two OssoABookListStore rows. The function should return a negative integer if the first row comes before the second, 0 if they are equal, or a positive integer if the first row comes after the second.

row_a : a OssoABookListStoreRow
row_b : another row to compare with
user_data : user data to pass to comparison function
Returns : negative value if row_a < row_b; zero if row_a = row_b; positive value if row_a > row_b.

OssoABookListStoreRow

typedef struct {
        int                offset;
        OssoABookContact  *contact;
} OssoABookListStoreRow;

One single row of a OssoABookListStore.

int offset; The position of this row
OssoABookContact *contact; The OssoABookContact associated with this row

osso_abook_list_store_set_book_view ()

void                osso_abook_list_store_set_book_view (OssoABookListStore *store,
                                                         EBookView *book_view);

Changes the EBookView associated with this OssoABookListStore.

Note

You are responsible for starting the book_view, but you should not start it before associating it with the list store, since the list store will not receive all contacts in that case.

store : A OssoABookListStore
book_view : The EBookView, or NULL

osso_abook_list_store_get_book_view ()

EBookView*          osso_abook_list_store_get_book_view (OssoABookListStore *store);

Retreives the EBookView associated with this list store.

store : A OssoABookListStore
Returns : The associated EBookView, or NULL when there is no view.

osso_abook_list_store_set_roster ()

void                osso_abook_list_store_set_roster    (OssoABookListStore *store,
                                                         OssoABookRoster *roster);

Changes the OssoABookRoster associated with this list store.

Note

You are responsible for starting the roster, but you should not start it before associating it with the list store, since the list store will not receive all contacts in that case.

store : A OssoABookListStore
roster : The OssoABookRoster, or NULL

osso_abook_list_store_get_roster ()

OssoABookRoster*    osso_abook_list_store_get_roster    (OssoABookListStore *store);

Retreives the OssoABookroster associated with this list store.

store : A OssoABookListStore
Returns : The associated OssoABookRoster, or NULL when there is no roster.

osso_abook_list_store_set_sort_func ()

void                osso_abook_list_store_set_sort_func (OssoABookListStore *store,
                                                         OssoABookListStoreCompareFunc callback,
                                                         gpointer user_data,
                                                         GDestroyNotify destroy_data);

Installs a custom sorting function for this list store. See osso_abook_list_store_set_name_order() and osso_abook_list_store_set_contact_order() for pre-defined sorting functions.

store : A OssoABookListStore
callback : The function for comparing rows, or NULL.
user_data : Data which shall be passed to callback.
destroy_data : A function for releasing user_data, or NULL.

osso_abook_list_store_set_group_sort_func ()

void                osso_abook_list_store_set_group_sort_func
                                                        (OssoABookListStore *store,
                                                         OssoABookListStoreCompareFunc callback,
                                                         gpointer user_data,
                                                         GDestroyNotify destroy_data);

Installs a function for applying sorting rules impossed by OssoABookGroups which are stacked on top of this list store.

store : A OssoABookListStore
callback : The function for comparing rows, or NULL.
user_data : Data which shall be passed to callback.
destroy_data : A function for releasing user_data, or NULL.

osso_abook_list_store_pre_allocate_rows ()

void                osso_abook_list_store_pre_allocate_rows
                                                        (OssoABookListStore *store,
                                                         int n_rows);

Allocates empty rows to ensure that the list store contains at least n_rows rows. Nothing happens when the list store already has this number of rows.

store : A OssoABookListStore
n_rows : The number of rows to allocate

osso_abook_list_store_cancel_loading ()

void                osso_abook_list_store_cancel_loading
                                                        (OssoABookListStore *store);

Instructs the list store to ignore any further contacts reported by its "book-view".

store : A OssoABookListStore

osso_abook_list_store_is_loading ()

gboolean            osso_abook_list_store_is_loading    (OssoABookListStore *store);

Checks if the list store is still receiving new contacts.

store : A OssoABookListStore
Returns : TRUE if the list store is still receiving contacts, and FALSE otherwise.

osso_abook_list_store_find_caps ()

OssoABookListStoreRow* osso_abook_list_store_find_caps  (OssoABookListStore *store,
                                                         OssoABookCaps *caps,
                                                         GtkTreeIter *iter);

store :
caps :
iter :
Returns :

osso_abook_list_store_find_contacts ()

OssoABookListStoreRow** osso_abook_list_store_find_contacts
                                                        (OssoABookListStore *store,
                                                         const char *uid);

Finds all OssoABookListStore rows associated with the EContact that is identified by uid.

store : A OssoABookListStore
uid : The UID of an EContact
Returns : A NULL terminated array of OssoABookListStoreRow pointers if an EContact identified by uid was included in model, NULL otherwise.

osso_abook_list_store_find_presence ()

OssoABookListStoreRow* osso_abook_list_store_find_presence
                                                        (OssoABookListStore *store,
                                                         OssoABookPresence *presence,
                                                         GtkTreeIter *iter);

store :
presence :
iter :
Returns :

osso_abook_list_store_contact_changed ()

void                osso_abook_list_store_contact_changed
                                                        (OssoABookListStore *store,
                                                         OssoABookContact *contact);

Emits the "row-changed" signal for the row(s) associated with contact.

store : A OssoABookListStore
contact : The OssoABookContact which changed

osso_abook_list_store_iter_get_row ()

OssoABookListStoreRow* osso_abook_list_store_iter_get_row
                                                        (OssoABookListStore *store,
                                                         GtkTreeIter *iter);

Looks up the OssoABookListStoreRow described by iter.

store : A OssoABookListStore
iter : The GtkTreeIter
Returns : The requested OssoABookListStoreRow, or NULL when iter is invalid.

osso_abook_list_store_row_get_iter ()

gboolean            osso_abook_list_store_row_get_iter  (OssoABookListStore *store,
                                                         const OssoABookListStoreRow *row,
                                                         GtkTreeIter *iter);

Looks up the GtkTreeIter describing row.

store : A OssoABookListStore
row : The OssoABookListStoreRow
iter : The location for storing the GtkTreeIter
Returns : TRUE when the row exists, and FALSE for invalid rows.

osso_abook_list_store_merge_rows ()

void                osso_abook_list_store_merge_rows    (OssoABookListStore *store,
                                                         GList *rows);

Adds new rows to the list store. The rows do not have to be in any particular order. All the neccessary signals are emited during the merge, and the list store remains valid during the entire merge.

store : A OssoABookListStore
rows : The list of OssoABookListStoreRow s to add

osso_abook_list_store_remove_rows ()

void                osso_abook_list_store_remove_rows   (OssoABookListStore *store,
                                                         OssoABookListStoreRow **rows,
                                                         gssize n_rows);

Removes rows from the list store. The number of rows is described in n_rows. The rows array must be terminated by NULL when n_rows is less than zero. All the neccessary signals are emited during the operation, and the list store remains valid during the procedure.

store : A OssoABookListStore
rows : The OssoABookListStoreRow s to remove
n_rows : Number of rows, or -1

enum OssoABookListStoreColumn

typedef enum {
        OSSO_ABOOK_LIST_STORE_COLUMN_CONTACT,
        OSSO_ABOOK_LIST_STORE_COLUMN_LAST,
} OssoABookListStoreColumn;

The columns in a OssoABookListStore.

OSSO_ABOOK_LIST_STORE_COLUMN_CONTACT The contact column, containing an OssoABookContact instance
OSSO_ABOOK_LIST_STORE_COLUMN_LAST The first column id available for child classes

osso_abook_list_store_column_from_name ()

const GEnumValue*   osso_abook_list_store_column_from_name
                                                        (const char *name);

Looks up the description of the OssoABookListStoreColumn member with that full name.

name : the full name of a OssoABookListStoreColumn member
Returns : A GEnumValue when name is valid, NULL otherwise.

osso_abook_list_store_column_from_nick ()

const GEnumValue*   osso_abook_list_store_column_from_nick
                                                        (const char *nick);

Looks up the description of the OssoABookListStoreColumn member with that nick name.

nick : the nick name of a OssoABookListStoreColumn member
Returns : A GEnumValue when nick is valid, NULL otherwise.

osso_abook_list_store_column_get_name ()

const char*         osso_abook_list_store_column_get_name
                                                        (OssoABookListStoreColumn value);

Retreives the full name of a OssoABookListStoreColumn member.

value : the a OssoABookListStoreColumn member
Returns : The full name for value, or NULL if there is no such member.

osso_abook_list_store_column_get_nick ()

const char*         osso_abook_list_store_column_get_nick
                                                        (OssoABookListStoreColumn value);

Retreives the nick name of a OssoABookListStoreColumn member.

value : the a OssoABookListStoreColumn member
Returns : The nick name for value, or NULL if there is no such member.

See Also

OssoABookTreeView