Method

DevhelpKeywordModelfilter

Declaration [src]

DhLink*
dh_keyword_model_filter (
  DhKeywordModel* model,
  const gchar* search_string,
  const gchar* current_book_id,
  DhProfile* profile
)

Description [src]

Searches in the DhBookList of profile the list of DhLinks that correspond to search_string, and fills the model with that list (erasing the previous content).

Attention, when calling this function the model needs to be disconnected from the GtkTreeView, because the GtkTreeModel signals are not emitted, to improve the performances (sending a lot of signals is slow) and have a simpler implementation. The previous row selection is anyway no longer relevant.

Note that there is a maximum number of matches (configured internally). When the maximum is reached the search is stopped, to avoid blocking the GUI (since this function runs synchronously) if the search_string contains for example only one character. (And it is anyway not very useful to show to the user tens of thousands search results).

Parameters

search_string const gchar*
 

A search query.

 The data is owned by the caller of the function.
 The string is a NUL terminated UTF-8 string.
current_book_id const gchar*
 

The ID of the book currently shown, or NULL.

 The argument can be NULL.
 The data is owned by the caller of the function.
 The string is a NUL terminated UTF-8 string.
profile DhProfile
 

A DhProfile, or NULL for the default profile.

 The argument can be NULL.
 The data is owned by the caller of the function.

Return value

Returns: DhLink
 

The DhLink that matches exactly search_string, or NULL if no such DhLink was found within the maximum number of matches.

 The data is owned by the instance.
 The return value can be NULL.