HudClientQuery

HudClientQuery — Query the HUD service for entries

Stability Level

Unstable, unless otherwise indicated

Functions

Properties

HudClientConnection * connection Read / Write / Construct Only
gchar * query Read / Write / Construct

Signals

void models-changed Run Last
void toolbar-updated Run Last
void voice-query-failed Run Last
void voice-query-finished Run Last
void voice-query-heard-something Run Last
void voice-query-listening Run Last
void voice-query-loading Run Last

Types and Values

Object Hierarchy

    GObject
    ╰── HudClientQuery

Includes

#include <libhud-client/query.h>

Description

A query is an open query to the HUD service which provides Dee models for the results. The query can update without changing the search string (the application changes the entires) or can be udated by calling hud_client_query_set_query().

When the usage of the Query is complete it should be unreferenced as that will communicate to the applications that the HUD is closed and they should not update their items.

Functions

hud_client_query_new ()

HudClientQuery *
hud_client_query_new (const gchar *query);

Startes a query with the HUD using a specific string. This will block until the query is created.

Parameters

query

String to build the initial set of results from

 

Returns

A new HudClientQuery object.

[transfer full]


hud_client_query_new_for_connection ()

HudClientQuery *
hud_client_query_new_for_connection (const gchar *query,
                                     HudClientConnection *connection);

Very similar to hud_client_query_new() except that it uses a custom connection. This is mostly for testing, though it is available if you need it.

Parameters

query

String to build the initial set of results from

 

connection

A custom HudClientConnection to a non-default HUD service

 

Returns

A new HudClientQuery object.

[transfer full]


hud_client_query_set_query ()

void
hud_client_query_set_query (HudClientQuery *cquery,
                            const gchar *query);

This revises the query to be the new query string. Updates can be seen through the DeeModel's.

Parameters

cquery

A HudClientQuery

 

query

New query string

 

hud_client_query_get_query ()

const gchar *
hud_client_query_get_query (HudClientQuery *cquery);

Accessor for the current query string.

Parameters

cquery

A HudClientQuery

 

Returns

Query string.

[transfer none]


hud_client_query_voice_query ()

void
hud_client_query_voice_query (HudClientQuery *cquery);

Execute a HUD query using voice recognition.

Will cause a series of signals to be emitted indicating progress:

  • voice-query-loading - the voice recognition toolkit is loading.

  • voice-query-failed - the voice recognition toolkit has failed to initialize.

  • voice-query-listening - the voice recognition toolkit is listening to speech.

  • voice-query-heard-something - the voice recognition toolkit has heard a complete utterance.

  • voice-query-finished - the voice recognition toolkit has completed, and has a (possibly empty) result.

Parameters

cquery

A HudClientQuery

 

hud_client_query_get_results_model ()

DeeModel *
hud_client_query_get_results_model (HudClientQuery *cquery);

Accessor for the current results model.

Parameters

cquery

A HudClientQuery

 

Returns

Results Model.

[transfer none]


hud_client_query_get_appstack_model ()

DeeModel *
hud_client_query_get_appstack_model (HudClientQuery *cquery);

Accessor for the current appstack model.

Parameters

cquery

A HudClientQuery

 

Returns

Appstack Model.

[transfer none]


hud_client_query_toolbar_item_active ()

gboolean
hud_client_query_toolbar_item_active (HudClientQuery *cquery,
                                      HudClientQueryToolbarItems item);

Checks to see if a particular toolbar item is implemented by the application and should be shown to the user as available for use.

Parameters

cquery

A HudClientQuery

 

item

Item to check for

 

Returns

Whether this item is active.


hud_client_query_get_active_toolbar ()

GArray *
hud_client_query_get_active_toolbar (HudClientQuery *cquery);

Gets a list of all the active toolbar items as an array. Array should be free'd after use.

Parameters

cquery

A HudClientQuery

 

Returns

A list of the active toolbar items.

[transfer full][element-type HudClientQueryToolbarItems]


hud_client_query_set_appstack_app ()

void
hud_client_query_set_appstack_app (HudClientQuery *cquery,
                                   const gchar *application_id);

This revises the query application to be application_id. Updates can be seen through the DeeModel's.

Parameters

cquery

A HudClientQuery

 

application_id

New application to get results from

 

hud_client_query_execute_command ()

void
hud_client_query_execute_command (HudClientQuery *cquery,
                                  GVariant *command_key,
                                  guint timestamp);

Executes a particular entry from the results model. The command_key should be grabbed from the table and passed to this function to activate it. This function will block until the command is activated.

Parameters

cquery

A HudClientQuery

 

command_key

The key from the results model for the entry to activate

 

timestamp

Timestamp for the user event

 

hud_client_query_execute_param_command ()

HudClientParam *
hud_client_query_execute_param_command
                               (HudClientQuery *cquery,
                                GVariant *command_key,
                                guint timestamp);

Executes a command that results in a parameterized dialog which is controlled using the returned HudClientParam object. When created this sends the "opened" event to the application.

Parameters

cquery

A HudClientQuery

 

command_key

The key from the results model for the entry to activate

 

timestamp

Timestamp for the user event

 

Returns

Object to control the parameterized dialog.

[transfer full]


hud_client_query_execute_toolbar_item ()

void
hud_client_query_execute_toolbar_item (HudClientQuery *cquery,
                                       HudClientQueryToolbarItems item,
                                       guint timestamp);

Executes a particular item in the tool bar. The item should be active before passing this.

Parameters

cquery

A HudClientQuery

 

item

Which toolbar item is being activated

 

timestamp

Timestamp for the user event

 

hud_client_query_appstack_get_app_id ()

const gchar *
hud_client_query_appstack_get_app_id (HudClientQuery *cquery,
                                      DeeModelIter *row);

Get the application ID for a given row in the appstack table.

Parameters

cquery

A HudClientQuery

 

row

Which row in the table to grab the ID from

 

Returns

The application ID


hud_client_query_appstack_get_app_icon ()

const gchar *
hud_client_query_appstack_get_app_icon
                               (HudClientQuery *cquery,
                                DeeModelIter *row);

Get the application icon for a given row in the appstack table.

Parameters

cquery

A HudClientQuery

 

row

Which row in the table to grab the icon from

 

Returns

The application icon


hud_client_query_results_get_command_id ()

GVariant *
hud_client_query_results_get_command_id
                               (HudClientQuery *cquery,
                                DeeModelIter *row);

Get the command ID for a given row in the results table.

Parameters

cquery

A HudClientQuery

 

row

Which row in the table to grab the ID from

 

Returns

The command ID.

[transfer full]


hud_client_query_results_get_command_name ()

const gchar *
hud_client_query_results_get_command_name
                               (HudClientQuery *cquery,
                                DeeModelIter *row);

Get the human readable command name for a given row in the results table.

Parameters

cquery

A HudClientQuery

 

row

Which row in the table to grab the name from

 

Returns

The command name


hud_client_query_results_get_command_highlights ()

GVariant *
hud_client_query_results_get_command_highlights
                               (HudClientQuery *cquery,
                                DeeModelIter *row);

Get the command highlights for a row in the table with start and stop characters in an array.

Parameters

cquery

A HudClientQuery

 

row

Which row in the table to grab the highlights from

 

Returns

The command highlights as a variant of type "a(ii)".

[transfer full]


hud_client_query_results_get_description ()

const gchar *
hud_client_query_results_get_description
                               (HudClientQuery *cquery,
                                DeeModelIter *row);

Get the human readable description for the command in the given row in the results table.

Parameters

cquery

A HudClientQuery

 

row

Which row in the table to grab the description from

 

Returns

The description


hud_client_query_results_get_description_highlights ()

GVariant *
hud_client_query_results_get_description_highlights
                               (HudClientQuery *cquery,
                                DeeModelIter *row);

Get the description highlights for a row in the table with start and stop characters in an array.

Parameters

cquery

A HudClientQuery

 

row

Which row in the table to grab the highlights from

 

Returns

The description highlights as a variant of type "a(ii)".

[transfer full]


hud_client_query_results_get_shortcut ()

const gchar *
hud_client_query_results_get_shortcut (HudClientQuery *cquery,
                                       DeeModelIter *row);

Get the human readable shortcut for the command in the given row in the results table.

Parameters

cquery

A HudClientQuery

 

row

Which row in the table to grab the shortcut from

 

Returns

The shortcut


hud_client_query_results_is_parameterized ()

gboolean
hud_client_query_results_is_parameterized
                               (HudClientQuery *cquery,
                                DeeModelIter *row);

Check to see if the given command is parameterized

Parameters

cquery

A HudClientQuery

 

row

Which row in the table to check if the command is parameterized

 

Returns

Whether the command in the row is parameterized

Types and Values

HUD_CLIENT_QUERY_SIGNAL_MODELS_CHANGED

#define HUD_CLIENT_QUERY_SIGNAL_MODELS_CHANGED   "models-changed"

Signal to indicate when the models have changed


HUD_CLIENT_QUERY_SIGNAL_TOOLBAR_UPDATED

#define HUD_CLIENT_QUERY_SIGNAL_TOOLBAR_UPDATED   "toolbar-updated"

Signal to indicate when the toolbar has been updated


struct HudClientQueryClass

struct HudClientQueryClass {
	GObjectClass parent_class;
};

Class information for HudClientQuery

Members

GObjectClass parent_class;

GObjectClass

 

struct HudClientQuery

struct HudClientQuery;

Object to track a query and the models for that query. Should be unref'd when a client is done using the query so that applications can be told that the HUD is no longer open.


HudClientQueryPrivate

typedef struct _HudClientQueryPrivate HudClientQueryPrivate;

Private data for HudClientQuery.

Property Details

The “connection” property

  “connection”               HudClientConnection *

HUD service connection.

Flags: Read / Write / Construct Only


The “query” property

  “query”                    gchar *

HUD query.

Flags: Read / Write / Construct

Default value: NULL

Signal Details

The “models-changed” signal

void
user_function (HudClientQuery *arg0,
               gpointer        user_data)

Something has caused the models to be changed, you should probably figure out their state again.

Parameters

user_data

user data set when the signal handler was connected.

 

Flags: Run Last


The “toolbar-updated” signal

void
user_function (HudClientQuery *arg0,
               gpointer        user_data)

The active items in the toolbar changed. Please requery.

Parameters

user_data

user data set when the signal handler was connected.

 

Flags: Run Last


The “voice-query-failed” signal

void
user_function (HudClientQuery *arg0,
               gchar          *arg1,
               gpointer        user_data)

The voice recognition toolkit has failed to connect to the audio device. The specific cause is provided as an argument.

Parameters

user_data

user data set when the signal handler was connected.

 

Flags: Run Last


The “voice-query-finished” signal

void
user_function (HudClientQuery *arg0,
               gchar          *arg1,
               gpointer        user_data)

The voice recognition toolkit has completed and has a (possibly empty) result.

Parameters

user_data

user data set when the signal handler was connected.

 

Flags: Run Last


The “voice-query-heard-something” signal

void
user_function (HudClientQuery *arg0,
               gpointer        user_data)

The voice recognition toolkit has heard an utterance.

Parameters

user_data

user data set when the signal handler was connected.

 

Flags: Run Last


The “voice-query-listening” signal

void
user_function (HudClientQuery *arg0,
               gpointer        user_data)

The voice recognition toolkit is active and listening for speech.

Parameters

user_data

user data set when the signal handler was connected.

 

Flags: Run Last


The “voice-query-loading” signal

void
user_function (HudClientQuery *arg0,
               gpointer        user_data)

The voice recognition toolkit is loading, and not ready for speech yet.

Parameters

user_data

user data set when the signal handler was connected.

 

Flags: Run Last