Osso Addressbook Reference Manual | ||||
---|---|---|---|---|
OssoABookListStoreOssoABookListStore — A GtkTreeModel associating information with EContact objects. |
#define OSSO_ABOOK_TYPE_LIST_STORE_ROW int (*OssoABookListStoreCompareFunc) (const OssoABookListStoreRow *row_a, const OssoABookListStoreRow *row_b, gpointer user_data); enum OssoABookListStoreColumn; OssoABookListStore; OssoABookListStoreRow; 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_book_view (OssoABookListStore *store, EBookView *book_view); EBookView* osso_abook_list_store_get_book_view (OssoABookListStore *store); void osso_abook_list_store_set_contact_order (OssoABookListStore *store, OssoABookContactOrder order); OssoABookContactOrder osso_abook_list_store_get_contact_order (OssoABookListStore *store); void osso_abook_list_store_set_name_order (OssoABookListStore *store, OssoABookNameOrder order); OssoABookNameOrder osso_abook_list_store_get_name_order (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_merge_rows (OssoABookListStore *store, GList *rows); void osso_abook_list_store_remove_rows (OssoABookListStore *store, OssoABookListStoreRow **rows, gssize n_rows); gboolean osso_abook_list_store_is_loading (OssoABookListStore *store); void osso_abook_list_store_cancel_loading (OssoABookListStore *store); 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); OssoABookListStoreRow** osso_abook_list_store_find_contacts (OssoABookListStore *store, const char *uid); void osso_abook_list_store_contact_changed (OssoABookListStore *store, OssoABookContact *contact); GType osso_abook_list_store_row_get_type (void); OssoABookListStoreRow* osso_abook_list_store_row_new (OssoABookContact *contact); OssoABookListStoreRow* osso_abook_list_store_row_copy (OssoABookListStoreRow *row); void osso_abook_list_store_row_free (OssoABookListStoreRow *row);
OssoABookListStore implements GtkTreeModel, GtkTreeSortable and OssoABookRowModel.
"book-view" EBookView* : Read / Write "contact-order" OssoABookContactOrder : Read / Write "loading" gboolean : Read "name-order" OssoABookNameOrder : Read / Write "pre-allocated-rows" guint : Read "roster" OssoABookRoster* : Read / Write "row-count" guint : Read
The OssoABookAccountModel is a model that lists the EContact objects exposed by an EBookView, and their associated OssoABookPresence and OssoABookCaps objects.
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 .
|
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 |
typedef struct _OssoABookListStore OssoABookListStore;
All the fields of this structure are private to the object's implementation and should never be accessed directly.
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 |
void osso_abook_list_store_set_roster (OssoABookListStore *store, OssoABookRoster *roster);
Changes the OssoABookRoster associated with this list store.
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.
All other properties should be setup before the roster is attached, as changing properties like "name-order" for an already filled model consumes a significant amount of time.
store : |
A OssoABookListStore |
roster : |
The OssoABookRoster, or NULL
|
OssoABookRoster* osso_abook_list_store_get_roster (OssoABookListStore *store);
Retrieves the OssoABookroster associated with this list store.
store : |
A OssoABookListStore |
Returns : | The associated OssoABookRoster, or NULL when there is no roster.
|
void osso_abook_list_store_set_book_view (OssoABookListStore *store, EBookView *book_view);
Changes the EBookView associated with this OssoABookListStore.
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
|
EBookView* osso_abook_list_store_get_book_view (OssoABookListStore *store);
Retrieves the EBookView associated with this list store.
store : |
A OssoABookListStore |
Returns : | The associated EBookView, or NULL when there is no view.
|
void osso_abook_list_store_set_contact_order (OssoABookListStore *store, OssoABookContactOrder order);
Changes the current sort mode of the list store. See
osso_abook_list_store_set_sort_func()
for installing
a custom sort order (OSSO_ABOOK_CONTACT_ORDER_CUSTOM).
store : |
A OssoABookListStore |
order : |
The new sort order |
OssoABookContactOrder osso_abook_list_store_get_contact_order (OssoABookListStore *store);
Queries the current sort mode of the list store.
store : |
A OssoABookListStore |
Returns : | The current OssoABookContactOrder of the list store. |
void osso_abook_list_store_set_name_order (OssoABookListStore *store, OssoABookNameOrder order);
Changes the current sort order of the list store. See
osso_abook_list_store_set_sort_func()
for installing
a custom sort order (OSSO_ABOOK_CONTACT_ORDER_CUSTOM).
store : |
A OssoABookListStore |
order : |
The new sort order |
OssoABookNameOrder osso_abook_list_store_get_name_order (OssoABookListStore *store);
Queries the current sort order of the list store.
store : |
A OssoABookListStore |
Returns : | The current OssoABookNameOrder of the list store. |
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 .
|
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 .
|
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 |
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 |
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
|
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.
|
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 |
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.
|
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.
|
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.
|
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 |
OssoABookListStoreRow* osso_abook_list_store_row_new (OssoABookContact *contact);
Creates a new OssoABookContactModel row.
contact : |
the EContact associated with this row |
Returns : | A newly allocated OssoABookListStoreRow instance. |
OssoABookListStoreRow* osso_abook_list_store_row_copy (OssoABookListStoreRow *row);
Clones an existing OssoABookContactModel row.
row : |
a OssoABookListStoreRow |
Returns : | A newly allocated OssoABookListStoreRow equal to row .
|
void osso_abook_list_store_row_free (OssoABookListStoreRow *row);
Releases a OssoABookContactModel row and any associated information.
row : |
a OssoABookListStoreRow |
"book-view"
property"book-view" EBookView* : Read / Write
The EBookView backing this list store.
"contact-order"
property"contact-order" OssoABookContactOrder : Read / Write
Contact sort order used by the model.
Default value: OSSO_ABOOK_CONTACT_ORDER_NAME
"loading"
property"loading" gboolean : Read
Indicator if the list-store still is loading contacts.
Default value: FALSE
"name-order"
property"name-order" OssoABookNameOrder : Read / Write
Name sort order used by the model.
Default value: OSSO_ABOOK_NAME_ORDER_FIRST
"pre-allocated-rows"
property"pre-allocated-rows" guint : Read
Current number of pre-allocated rows.
Default value: 0
"roster"
property"roster" OssoABookRoster* : Read / Write
The contact roster backing this list store.