HudClientQuery

HudClientQuery — Query the HUD service for entries

Stability Level

Unstable, unless otherwise indicated

Synopsis

#include <libhud-client/query.h>

#define             HUD_CLIENT_QUERY_SIGNAL_MODELS_CHANGED
#define             HUD_CLIENT_QUERY_SIGNAL_TOOLBAR_UPDATED
struct              HudClientQueryClass;
enum                HudClientQueryToolbarItems;
HudClientQuery *    hud_client_query_new                (const gchar *query);
HudClientQuery *    hud_client_query_new_for_connection (const gchar *query,
                                                         HudClientConnection *connection);
void                hud_client_query_set_query          (HudClientQuery *cquery,
                                                         const gchar *query);
const gchar *       hud_client_query_get_query          (HudClientQuery *cquery);
void                hud_client_query_voice_query        (HudClientQuery *cquery);
DeeModel *          hud_client_query_get_results_model  (HudClientQuery *cquery);
DeeModel *          hud_client_query_get_appstack_model (HudClientQuery *cquery);
gboolean            hud_client_query_toolbar_item_active
                                                        (HudClientQuery *cquery,
                                                         HudClientQueryToolbarItems item);
GArray *            hud_client_query_get_active_toolbar (HudClientQuery *cquery);
void                hud_client_query_set_appstack_app   (HudClientQuery *cquery,
                                                         const gchar *application_id);
void                hud_client_query_execute_command    (HudClientQuery *cquery,
                                                         GVariant *command_key,
                                                         guint timestamp);
HudClientParam *    hud_client_query_execute_param_command
                                                        (HudClientQuery *cquery,
                                                         GVariant *command_key,
                                                         guint timestamp);
void                hud_client_query_execute_toolbar_item
                                                        (HudClientQuery *cquery,
                                                         HudClientQueryToolbarItems item,
                                                         guint timestamp);
const gchar *       hud_client_query_appstack_get_app_id
                                                        (HudClientQuery *cquery,
                                                         DeeModelIter *row);
const gchar *       hud_client_query_appstack_get_app_icon
                                                        (HudClientQuery *cquery,
                                                         DeeModelIter *row);
GVariant *          hud_client_query_results_get_command_id
                                                        (HudClientQuery *cquery,
                                                         DeeModelIter *row);
const gchar *       hud_client_query_results_get_command_name
                                                        (HudClientQuery *cquery,
                                                         DeeModelIter *row);
GVariant *          hud_client_query_results_get_command_highlights
                                                        (HudClientQuery *cquery,
                                                         DeeModelIter *row);
const gchar *       hud_client_query_results_get_description
                                                        (HudClientQuery *cquery,
                                                         DeeModelIter *row);
GVariant *          hud_client_query_results_get_description_highlights
                                                        (HudClientQuery *cquery,
                                                         DeeModelIter *row);
const gchar *       hud_client_query_results_get_shortcut
                                                        (HudClientQuery *cquery,
                                                         DeeModelIter *row);
gboolean            hud_client_query_results_is_parameterized
                                                        (HudClientQuery *cquery,
                                                         DeeModelIter *row);

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.

Details

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

GObjectClass parent_class;

GObjectClass

enum HudClientQueryToolbarItems

typedef enum {
 /*< prefix=HUD_CLIENT_QUERY_TOOLBAR >*/
	HUD_CLIENT_QUERY_TOOLBAR_FULLSCREEN,
	HUD_CLIENT_QUERY_TOOLBAR_HELP,
	HUD_CLIENT_QUERY_TOOLBAR_PREFERENCES,
	HUD_CLIENT_QUERY_TOOLBAR_UNDO,
} HudClientQueryToolbarItems;

The toolbar has a set of preconfigured items in it for the application. This enum represents them.

HUD_CLIENT_QUERY_TOOLBAR_FULLSCREEN

Make the application fullscreen

HUD_CLIENT_QUERY_TOOLBAR_HELP

Help the user use the application

HUD_CLIENT_QUERY_TOOLBAR_PREFERENCES

Configure the application

HUD_CLIENT_QUERY_TOOLBAR_UNDO

Revert the last user action

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.

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.

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.

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.

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.

cquery :

A HudClientQuery

hud_client_query_get_results_model ()

DeeModel *          hud_client_query_get_results_model  (HudClientQuery *cquery);

Accessor for the current results model.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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.

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

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