HudQuery

HudQuery — a stateful query against a HudSource

Synopsis

                    HudQuery;
void                hud_query_close                     (HudQuery *query);
guint               hud_query_get_n_results             (HudQuery *query);
GVariant *          hud_query_get_query_key             (HudQuery *query);
HudResult *         hud_query_get_result_by_index       (HudQuery *query,
                                                         guint i);
HudQuery *          hud_query_lookup                    (GVariant *query_key);
HudQuery *          hud_query_new                       (HudSource *source,
                                                         const gchar *search_string,
                                                         gint num_results);

Object Hierarchy

  GObject
   +----HudQuery

Signals

  "changed"                                        : Run Last

Description

HudQuery is a stateful query for a particular search string against a given HudSource.

The query monitors its source for the "change" signal and re-submits the query when changes are reported. The query has its own change signal that is fired when this happens.

The query maintains a list of results from the search which are sorted by relevance and accessible by index. Contrast this with the stateless nature of HudSource.

Details

HudQuery

typedef struct _HudQuery HudQuery;

This is an opaque structure type.


hud_query_close ()

void                hud_query_close                     (HudQuery *query);

Closes a HudQuery.

This drops the query from the internal list of queries. Future use of hud_query_lookup() to find this query will fail.

You must still release your own reference on query, if you have one. This only drops the internal reference.

query :

a HudQuery

hud_query_get_n_results ()

guint               hud_query_get_n_results             (HudQuery *query);

Gets the number of results in query.

query :

a HudQuery

Returns :

the number of results

hud_query_get_query_key ()

GVariant *          hud_query_get_query_key             (HudQuery *query);

Returns the query key for HudQuery.

Each HudQuery has a unique identifying key that is assigned when the query is created.

FIXME: This is a lie.

query :

a HudQuery

Returns :

the query key for query. [transfer none]

hud_query_get_result_by_index ()

HudResult *         hud_query_get_result_by_index       (HudQuery *query,
                                                         guint i);

Gets the ith result from query.

i must be less than the number of results in the query. See hud_query_get_n_results().

query :

a HudQuery

i :

the index of the result

Returns :

the HudResult at position i. [transfer none]

hud_query_lookup ()

HudQuery *          hud_query_lookup                    (GVariant *query_key);

Finds the query that has the given query_key.

query_key :

a query key

Returns :

the query, or NULL if no such query exists. [transfer none]

hud_query_new ()

HudQuery *          hud_query_new                       (HudSource *source,
                                                         const gchar *search_string,
                                                         gint num_results);

Creates a HudQuery.

A HudQuery is a stateful search for search_string against a source.

Each HudQuery is assigned a "query key" when it is created. This can be used to lookup the hud query later using hud_query_lookup(). Because of this, an internal reference is held on the query and the query won't be completely freed until you call hud_query_close() on it in addition to releasing your ref.

source :

the HudSource against which to search

search_string :

the string to search for

num_results :

the maximum number of results to report

Returns :

the new HudQuery

Signal Details

The "changed" signal

void                user_function                      (HudQuery *query,
                                                        gpointer  user_data)      : Run Last

Indicates that the results of query have changed.

query :

a HudQuery

user_data :

user data set when the signal handler was connected.