OssoABookFilterModel

OssoABookFilterModel — Filter certain contacts from a OssoABookListStore.

Synopsis

                    OssoABookFilterModel;
OssoABookFilterModel* osso_abook_filter_model_new       (OssoABookListStore *child_model);
void                osso_abook_filter_model_set_visible_func
                                                        (OssoABookFilterModel *model,
                                                         GtkTreeModelFilterVisibleFunc func,
                                                         gpointer data,
                                                         GDestroyNotify destroy);
void                osso_abook_filter_model_set_group   (OssoABookFilterModel *model,
                                                         OssoABookGroup *group);
OssoABookGroup*     osso_abook_filter_model_get_group   (OssoABookFilterModel *model);
void                osso_abook_filter_model_set_text    (OssoABookFilterModel *model,
                                                         const char *text);
void                osso_abook_filter_model_set_prefix  (OssoABookFilterModel *model,
                                                         const char *prefix);
const char*         osso_abook_filter_model_get_text    (OssoABookFilterModel *model);
gboolean            osso_abook_filter_model_get_prefix  (OssoABookFilterModel *model);
void                osso_abook_filter_model_freeze_refilter
                                                        (OssoABookFilterModel *model);
void                osso_abook_filter_model_thaw_refilter
                                                        (OssoABookFilterModel *model);
PangoAttrList*      osso_abook_filter_model_get_markup  (OssoABookFilterModel *model,
                                                         const char *text);
gboolean            osso_abook_filter_model_is_row_visible
                                                        (OssoABookFilterModel *model,
                                                         GtkTreeIter *iter);

Object Hierarchy

  GObject
   +----GtkTreeModelFilter
         +----OssoABookFilterModel

Implemented Interfaces

OssoABookFilterModel implements GtkTreeModel, GtkTreeSortable, GtkTreeDragDest, GtkTreeDragSource and OssoABookRowModel.

Properties

  "base-model"               OssoABookListStore*   : Read / Write / Construct Only
  "group"                    OssoABookGroup*       : Read / Write
  "prefix"                   gboolean              : Read / Write
  "text"                     gchar*                : Read / Write

Description

OssoABookFilterModel is an object that can filter contacts based on their presence in another OssoABookListStore

Details

OssoABookFilterModel

typedef struct _OssoABookFilterModel OssoABookFilterModel;

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


osso_abook_filter_model_new ()

OssoABookFilterModel* osso_abook_filter_model_new       (OssoABookListStore *child_model);

Creates a new OssoABookFilterModel object filtering the contents of child_model.

child_model : An OssoABookListStore whose contects are to be filtered
Returns : A new OssoABookFilterModel object.

osso_abook_filter_model_set_visible_func ()

void                osso_abook_filter_model_set_visible_func
                                                        (OssoABookFilterModel *model,
                                                         GtkTreeModelFilterVisibleFunc func,
                                                         gpointer data,
                                                         GDestroyNotify destroy);

Sets a custom function to determine whether items in the model are visibile or not

model : a OssoABookFilterModel
func : a function to determine visibility
data : additional data to pass to func
destroy : an optional function to call to free data when no longer needed

osso_abook_filter_model_set_group ()

void                osso_abook_filter_model_set_group   (OssoABookFilterModel *model,
                                                         OssoABookGroup *group);

Sets model to filter on group, only letting through EContact - OssoABookPresence combinations that satisfy group. (And the text set by osso_abook_filter_model_set_text(), if any)

model : An OssoABookFilterModel
group : The OssoABookGroup to be filtered on

osso_abook_filter_model_get_group ()

OssoABookGroup*     osso_abook_filter_model_get_group   (OssoABookFilterModel *model);

Retrieves the OssoABookGroup that is being filtered on.

model : An OssoABookFilterModel
Returns : The OssoABookGroup that is being filtered on.

osso_abook_filter_model_set_text ()

void                osso_abook_filter_model_set_text    (OssoABookFilterModel *model,
                                                         const char *text);

Sets model to filter on text, only letting through EContacts whose names contain text. (And the group set by osso_abook_filter_model_set_group(), if any)

text is split up into bits, using space as delimiter. The order in which the bits appear in the searched text is not of importance. Case and accents are ignored. This means that for example "Elvis Presley" matches "Presley Elvis", and that "Björk" matches "bjork".

model : An OssoABookFilterModel
text : The string to be filtered on

osso_abook_filter_model_set_prefix ()

void                osso_abook_filter_model_set_prefix  (OssoABookFilterModel *model,
                                                         const char *prefix);

works like osso_abook_filter_model_set_text with the difference that this version matches prefixes only

model : An OssoABookFilterModel
prefix : The string to be filtered on

osso_abook_filter_model_get_text ()

const char*         osso_abook_filter_model_get_text    (OssoABookFilterModel *model);

Retrieves the text that is being filtered on.

model : An OssoABookFilterModel
Returns : The text that is being filtered on. The string is owned by libosso-abook and should not be freed.

osso_abook_filter_model_get_prefix ()

gboolean            osso_abook_filter_model_get_prefix  (OssoABookFilterModel *model);

Determines wether the filter text applies to full-text or prefix only

model : An OssoABookFilterModel
Returns : TRUE for prefix only filtering, FALSE for full-text

osso_abook_filter_model_freeze_refilter ()

void                osso_abook_filter_model_freeze_refilter
                                                        (OssoABookFilterModel *model);

Freezes the filter. This means that any calls to osso_abook_filter_model_set_group() or osso_abook_filter_model_set_text() will not have any effect until osso_abook_filter_model_thaw_refilter() is called.

Use this function if you need to change the group and the text at the same time. The rows will then be refiltered only once.

model : An OssoABookFilterModel

osso_abook_filter_model_thaw_refilter ()

void                osso_abook_filter_model_thaw_refilter
                                                        (OssoABookFilterModel *model);

Thaws the filter. See osso_abook_filter_model_freeze_refilter() for details.

model : An OssoABookFilterModel

osso_abook_filter_model_get_markup ()

PangoAttrList*      osso_abook_filter_model_get_markup  (OssoABookFilterModel *model,
                                                         const char *text);

Generates a PangoAttrList containing markup information to highlight any found bits of the filter text in text.

model : An OssoABookFilterModel
text : The text to retrieve the markup for
Returns : A newly allocated PangoAttrList.

osso_abook_filter_model_is_row_visible ()

gboolean            osso_abook_filter_model_is_row_visible
                                                        (OssoABookFilterModel *model,
                                                         GtkTreeIter *iter);

Determines whether the row indicated by iter is visible, i.e. satisfies the filter requirements.

model : An OssoABookFilterModel
iter : A GtkTreeIter of the contained OssoABookListStore
Returns : TRUE if the row indicated by iter satisfies the filter requirements, FALSE otherwise.

Property Details

The "base-model" property

  "base-model"               OssoABookListStore*   : Read / Write / Construct Only

The contained OssoABookListStore.


The "group" property

  "group"                    OssoABookGroup*       : Read / Write

The group to be filtered on.


The "prefix" property

  "prefix"                   gboolean              : Read / Write

Wether or not only prefixes are matched.

Default value: FALSE


The "text" property

  "text"                     gchar*                : Read / Write

The text to be filtered on.

Default value: NULL