2
* Copyright © 2012 Canonical Ltd.
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU General Public License version 3, as
6
* published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful, but
9
* WITHOUT ANY WARRANTY; without even the implied warranties of
10
* MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11
* PURPOSE. See the GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License along
14
* with this program. If not, see <http://www.gnu.org/licenses/>.
16
* Author: Ted Gould <ted@canonical.com>
26
#include "connection.h"
27
#include "query-iface.h"
28
#include "enum-types.h"
29
#include "query-columns.h"
31
struct _HudClientQueryPrivate {
32
_HudQueryComCanonicalHudQuery * proxy;
33
HudClientConnection * connection;
34
guint connection_changed_sig;
40
#define HUD_CLIENT_QUERY_GET_PRIVATE(o) \
41
(G_TYPE_INSTANCE_GET_PRIVATE ((o), HUD_CLIENT_TYPE_QUERY, HudClientQueryPrivate))
49
#define PROP_CONNECTION_S "connection"
50
#define PROP_QUERY_S "query"
52
static void hud_client_query_class_init (HudClientQueryClass *klass);
53
static void hud_client_query_init (HudClientQuery *self);
54
static void hud_client_query_constructed (GObject *object);
55
static void hud_client_query_dispose (GObject *object);
56
static void hud_client_query_finalize (GObject *object);
57
static void set_property (GObject * obj, guint id, const GValue * value, GParamSpec * pspec);
58
static void get_property (GObject * obj, guint id, GValue * value, GParamSpec * pspec);
59
static void connection_status (HudClientConnection * connection, gboolean connected, HudClientQuery * query);
60
static void new_query_cb (HudClientConnection * connection, const gchar * path, const gchar * results, const gchar * appstack, gpointer user_data);
62
G_DEFINE_TYPE (HudClientQuery, hud_client_query, G_TYPE_OBJECT);
64
static guint signal_toolbar_updated = 0;
65
static guint hud_client_query_signal_voice_query_loading;
66
static guint hud_client_query_signal_voice_query_failed;
67
static guint hud_client_query_signal_voice_query_listening;
68
static guint hud_client_query_signal_voice_query_heard_something;
69
static guint hud_client_query_signal_voice_query_finished;
70
static guint hud_client_query_signal_models_changed = 0;
73
hud_client_query_class_init (HudClientQueryClass *klass)
75
GObjectClass *object_class = G_OBJECT_CLASS (klass);
77
g_type_class_add_private (klass, sizeof (HudClientQueryPrivate));
79
object_class->dispose = hud_client_query_dispose;
80
object_class->finalize = hud_client_query_finalize;
81
object_class->constructed = hud_client_query_constructed;
82
object_class->set_property = set_property;
83
object_class->get_property = get_property;
85
g_object_class_install_property (object_class, PROP_CONNECTION,
86
g_param_spec_object(PROP_CONNECTION_S, "Connection to the HUD service",
87
"HUD service connection",
88
HUD_CLIENT_TYPE_CONNECTION,
89
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
90
g_object_class_install_property (object_class, PROP_QUERY,
91
g_param_spec_string(PROP_QUERY_S, "Query to the HUD service",
94
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
97
* HudClientQuery::toolbar-updated:
99
* The active items in the toolbar changed. Please requery.
101
signal_toolbar_updated = g_signal_new (HUD_CLIENT_QUERY_SIGNAL_TOOLBAR_UPDATED,
102
HUD_CLIENT_TYPE_QUERY,
105
NULL, NULL, /* Accumulator */
106
g_cclosure_marshal_VOID__VOID,
107
G_TYPE_NONE, 0, G_TYPE_NONE);
110
* HudClientQuery::voice-query-loading:
112
* The voice recognition toolkit is loading, and not ready for speech yet.
114
hud_client_query_signal_voice_query_loading = g_signal_new (
115
"voice-query-loading", HUD_CLIENT_TYPE_QUERY, G_SIGNAL_RUN_LAST, 0, NULL,
116
NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
119
* HudClientQuery::voice-query-failed:
121
* The voice recognition toolkit has failed to connect to the audio device.
122
* The specific cause is provided as an argument.
124
hud_client_query_signal_voice_query_failed = g_signal_new (
125
"voice-query-failed", HUD_CLIENT_TYPE_QUERY, G_SIGNAL_RUN_LAST, 0, NULL,
126
NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING );
129
* HudClientQuery::voice-query-listening:
131
* The voice recognition toolkit is active and listening for speech.
133
hud_client_query_signal_voice_query_listening = g_signal_new (
134
"voice-query-listening", HUD_CLIENT_TYPE_QUERY, G_SIGNAL_RUN_LAST, 0,
135
NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
138
* HudClientQuery::voice-query-heard-something:
140
* The voice recognition toolkit has heard an utterance.
142
hud_client_query_signal_voice_query_heard_something = g_signal_new (
143
"voice-query-heard-something", HUD_CLIENT_TYPE_QUERY, G_SIGNAL_RUN_LAST,
144
0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
147
* HudClientQuery::voice-query-finished:
149
* The voice recognition toolkit has completed and has a (possibly empty) result.
151
hud_client_query_signal_voice_query_finished = g_signal_new (
152
"voice-query-finished", HUD_CLIENT_TYPE_QUERY, G_SIGNAL_RUN_LAST, 0, NULL,
153
NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING );
156
* HudClientQuery::models-changed:
158
* Something has caused the models to be changed, you should probably
159
* figure out their state again.
161
hud_client_query_signal_models_changed = g_signal_new (
162
HUD_CLIENT_QUERY_SIGNAL_MODELS_CHANGED, HUD_CLIENT_TYPE_QUERY, G_SIGNAL_RUN_LAST, 0, NULL,
163
NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0, G_TYPE_NONE );
169
hud_client_query_init (HudClientQuery *self)
171
self->priv = HUD_CLIENT_QUERY_GET_PRIVATE(self);
177
set_property (GObject * obj, guint id, const GValue * value, GParamSpec * pspec)
179
HudClientQuery * self = HUD_CLIENT_QUERY(obj);
182
case PROP_CONNECTION:
183
g_clear_object(&self->priv->connection);
184
self->priv->connection = g_value_dup_object(value);
187
hud_client_query_set_query(self, g_value_get_string(value));
190
g_warning("Unknown property %d.", id);
198
get_property (GObject * obj, guint id, GValue * value, GParamSpec * pspec)
200
HudClientQuery * self = HUD_CLIENT_QUERY(obj);
203
case PROP_CONNECTION:
204
g_value_set_object(value, self->priv->connection);
207
g_value_set_string(value, self->priv->query);
210
g_warning("Unknown property %d.", id);
218
hud_client_query_voice_query_loading (_HudQueryComCanonicalHudQuery *object, gpointer user_data)
220
g_signal_emit(user_data, hud_client_query_signal_voice_query_loading, 0);
224
hud_client_query_voice_query_listening (_HudQueryComCanonicalHudQuery *object, gpointer user_data)
226
g_signal_emit(user_data, hud_client_query_signal_voice_query_listening, 0);
230
hud_client_query_voice_query_heard_something (_HudQueryComCanonicalHudQuery *object, gpointer user_data)
232
g_signal_emit(user_data, hud_client_query_signal_voice_query_heard_something, 0);
236
hud_client_query_constructed (GObject *object)
238
HudClientQuery * cquery = HUD_CLIENT_QUERY(object);
240
G_OBJECT_CLASS (hud_client_query_parent_class)->constructed (object);
242
if (cquery->priv->connection == NULL) {
243
cquery->priv->connection = hud_client_connection_get_ref();
246
cquery->priv->connection_changed_sig = g_signal_connect(cquery->priv->connection, HUD_CLIENT_CONNECTION_SIGNAL_CONNECTION_STATUS, G_CALLBACK(connection_status), cquery);
248
if(cquery->priv->query == NULL) {
249
cquery->priv->query = g_strdup("");
252
connection_status(cquery->priv->connection, hud_client_connection_connected(cquery->priv->connection), cquery);
257
/* Handles the connection status of the HUD service, once
258
we're connected we can do all kinds of fun stuff */
260
connection_status (HudClientConnection * connection, gboolean connected, HudClientQuery * cquery)
262
g_clear_object(&cquery->priv->results);
263
g_clear_object(&cquery->priv->appstack);
264
g_clear_object(&cquery->priv->proxy);
266
g_signal_emit(G_OBJECT(cquery), hud_client_query_signal_models_changed, 0);
272
hud_client_connection_new_query(cquery->priv->connection, cquery->priv->query, new_query_cb, g_object_ref(cquery));
277
new_query_cb (HudClientConnection * connection, const gchar * path, const gchar * results, const gchar * appstack, gpointer user_data)
279
if (path == NULL || results == NULL || appstack == NULL) {
280
g_object_unref(user_data);
284
HudClientQuery * cquery = HUD_CLIENT_QUERY(user_data);
285
GError * error = NULL;
287
cquery->priv->proxy = _hud_query_com_canonical_hud_query_proxy_new_for_bus_sync(
289
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
290
hud_client_connection_get_address(cquery->priv->connection),
292
NULL, /* GCancellable */
296
if (cquery->priv->proxy == NULL) {
297
g_debug("Unable to get proxy after getting query path: %s", error->message);
299
g_object_unref(cquery);
303
/* Set up our models */
304
cquery->priv->results = dee_shared_model_new(results);
305
cquery->priv->appstack = dee_shared_model_new(appstack);
307
/* Watch for voice signals */
308
g_signal_connect_object (cquery->priv->proxy, "voice-query-loading",
309
G_CALLBACK (hud_client_query_voice_query_loading), G_OBJECT(cquery), 0);
310
g_signal_connect_object (cquery->priv->proxy, "voice-query-listening",
311
G_CALLBACK (hud_client_query_voice_query_listening), G_OBJECT(cquery), 0);
312
g_signal_connect_object (cquery->priv->proxy, "voice-query-heard-something",
313
G_CALLBACK (hud_client_query_voice_query_heard_something), G_OBJECT(cquery), 0);
315
g_signal_emit(G_OBJECT(cquery), hud_client_query_signal_models_changed, 0);
317
g_object_unref(cquery);
323
hud_client_query_dispose (GObject *object)
325
HudClientQuery * self = HUD_CLIENT_QUERY(object);
327
/* We don't care anymore, we're dying! */
328
if (self->priv->connection_changed_sig != 0) {
329
g_signal_handler_disconnect(self->priv->connection, self->priv->connection_changed_sig);
330
self->priv->connection_changed_sig = 0;
333
if (self->priv->proxy != NULL) {
334
_hud_query_com_canonical_hud_query_call_close_query_sync(self->priv->proxy, NULL, NULL);
337
g_clear_object(&self->priv->results);
338
g_clear_object(&self->priv->appstack);
339
g_clear_object(&self->priv->proxy);
340
g_clear_object(&self->priv->connection);
342
G_OBJECT_CLASS (hud_client_query_parent_class)->dispose (object);
347
hud_client_query_finalize (GObject *object)
349
HudClientQuery * self = HUD_CLIENT_QUERY(object);
351
g_clear_pointer(&self->priv->query, g_free);
353
G_OBJECT_CLASS (hud_client_query_parent_class)->finalize (object);
358
* hud_client_query_new:
359
* @query: String to build the initial set of results from
361
* Startes a query with the HUD using a specific string. This
362
* will block until the query is created.
364
* Return value: (transfer full): A new #HudClientQuery object
367
hud_client_query_new (const gchar * query)
369
return HUD_CLIENT_QUERY(g_object_new(HUD_CLIENT_TYPE_QUERY,
376
* hud_client_query_new_for_connection:
377
* @query: String to build the initial set of results from
378
* @connection: A custom #HudClientConnection to a non-default HUD service
380
* Very similar to hud_client_query_new() except that it uses a
381
* custom connection. This is mostly for testing, though it is
382
* available if you need it.
384
* Return value: (transfer full): A new #HudClientQuery object
387
hud_client_query_new_for_connection (const gchar * query, HudClientConnection * connection)
389
return HUD_CLIENT_QUERY(g_object_new(HUD_CLIENT_TYPE_QUERY,
390
PROP_CONNECTION_S, connection,
397
* hud_client_query_set_query:
398
* @cquery: A #HudClientQuery
399
* @query: New query string
401
* This revises the query to be the new query string. Updates can
402
* be seen through the #DeeModel's.
405
hud_client_query_set_query (HudClientQuery * cquery, const gchar * query)
407
g_return_if_fail(HUD_CLIENT_IS_QUERY(cquery));
409
g_clear_pointer(&cquery->priv->query, g_free);
410
cquery->priv->query = g_strdup(query);
412
if (cquery->priv->proxy != NULL) {
414
_hud_query_com_canonical_hud_query_call_update_query_sync(cquery->priv->proxy, cquery->priv->query, &revision, NULL, NULL);
417
g_object_notify(G_OBJECT(cquery), PROP_QUERY_S);
423
* hud_client_query_get_query:
424
* @cquery: A #HudClientQuery
426
* Accessor for the current query string.
428
* Return value: (transfer none): Query string
431
hud_client_query_get_query (HudClientQuery * cquery)
433
g_return_val_if_fail(HUD_CLIENT_IS_QUERY(cquery), NULL);
435
return cquery->priv->query;
439
hud_client_query_voice_query_callback (GObject *source, GAsyncResult *result, gpointer user_data)
441
g_assert(HUD_CLIENT_IS_QUERY(user_data));
442
HudClientQuery *cquery = HUD_CLIENT_QUERY(user_data);
445
GError *error = NULL;
446
if (!_hud_query_com_canonical_hud_query_call_voice_query_finish (cquery->priv->proxy, &revision, &query, result, &error))
448
g_warning("Voice query failed to finish: [%s]", error->message);
449
g_signal_emit (user_data, hud_client_query_signal_voice_query_failed,
450
0 /* details */, error->message);
455
g_clear_pointer(&cquery->priv->query, g_free);
456
cquery->priv->query = query;
457
g_object_notify (G_OBJECT(cquery), PROP_QUERY_S);
459
g_signal_emit (user_data, hud_client_query_signal_voice_query_finished,
460
0 /* details */, query);
464
* hud_client_query_voice_query:
465
* @cquery: A #HudClientQuery
467
* Execute a HUD query using voice recognition.
469
* Will cause a series of signals to be emitted indicating progress:
470
* - voice-query-loading - the voice recognition toolkit is loading.
471
* - voice-query-failed - the voice recognition toolkit has failed to initialize.
472
* - voice-query-listening - the voice recognition toolkit is listening to speech.
473
* - voice-query-heard-something - the voice recognition toolkit has heard a complete utterance.
474
* - voice-query-finished - the voice recognition toolkit has completed, and has a (possibly empty) result.
477
hud_client_query_voice_query (HudClientQuery * cquery)
479
g_return_if_fail(HUD_CLIENT_IS_QUERY(cquery));
481
if (cquery->priv->proxy != NULL) {
482
g_debug("Running voice query");
483
_hud_query_com_canonical_hud_query_call_voice_query (cquery->priv->proxy, NULL, hud_client_query_voice_query_callback, cquery);
488
* hud_client_query_get_results_model:
489
* @cquery: A #HudClientQuery
491
* Accessor for the current results model.
493
* Return value: (transfer none): Results Model
496
hud_client_query_get_results_model (HudClientQuery * cquery)
498
g_return_val_if_fail(HUD_CLIENT_IS_QUERY(cquery), NULL);
500
return cquery->priv->results;
504
* hud_client_query_get_appstack_model:
505
* @cquery: A #HudClientQuery
507
* Accessor for the current appstack model.
509
* Return value: (transfer none): Appstack Model
512
hud_client_query_get_appstack_model (HudClientQuery * cquery)
514
g_return_val_if_fail(HUD_CLIENT_IS_QUERY(cquery), NULL);
516
return cquery->priv->appstack;
520
* hud_client_query_toolbar_item_active:
521
* @cquery: A #HudClientQuery
522
* @item: Item to check for
524
* Checks to see if a particular toolbar item is implemented by the
525
* application and should be shown to the user as available for use.
527
* Return value: Whether this @item is active.
530
hud_client_query_toolbar_item_active (HudClientQuery * cquery, HudClientQueryToolbarItems item)
532
g_return_val_if_fail(HUD_CLIENT_IS_QUERY(cquery), FALSE);
539
* hud_client_query_get_active_toolbar:
540
* @cquery: A #HudClientQuery
542
* Gets a list of all the active toolbar items as an array. Array should be
545
* Return value: (transfer full) (element-type HudClientQueryToolbarItems): A
546
* list of the active toolbar items.
549
hud_client_query_get_active_toolbar (HudClientQuery * cquery)
551
g_return_val_if_fail(HUD_CLIENT_IS_QUERY(cquery), NULL);
558
* hud_client_query_set_appstack_app:
559
* @cquery: A #HudClientQuery
560
* @application_id: New application to get results from
562
* This revises the query application to be application_id. Updates can
563
* be seen through the #DeeModel's.
566
hud_client_query_set_appstack_app (HudClientQuery * cquery,
567
const gchar * application_id)
569
g_return_if_fail(HUD_CLIENT_IS_QUERY(cquery));
571
if (cquery->priv->proxy != NULL) {
573
_hud_query_com_canonical_hud_query_call_update_app_sync(cquery->priv->proxy, application_id, &revision, NULL, NULL);
580
* hud_client_query_execute_command:
581
* @cquery: A #HudClientQuery
582
* @command_key: The key from the results model for the entry to activate
583
* @timestamp: Timestamp for the user event
585
* Executes a particular entry from the results model. The @command_key
586
* should be grabbed from the table and passed to this function to activate
587
* it. This function will block until the command is activated.
590
hud_client_query_execute_command (HudClientQuery * cquery, GVariant * command_key, guint timestamp)
592
g_return_if_fail(HUD_CLIENT_IS_QUERY(cquery));
593
g_return_if_fail(command_key != NULL);
595
GError *error = NULL;
596
if (!_hud_query_com_canonical_hud_query_call_execute_command_sync(cquery->priv->proxy, command_key, timestamp, NULL, &error))
598
g_warning("Error executing command [%s]", error->message);
606
* hud_client_query_execute_param_command:
607
* @cquery: A #HudClientQuery
608
* @command_key: The key from the results model for the entry to activate
609
* @timestamp: Timestamp for the user event
611
* Executes a command that results in a parameterized dialog
612
* which is controlled using the returned #HudClientParam object.
613
* When created this sends the "opened" event to the application.
615
* Return Value: (transfer full): Object to control the parameterized dialog.
618
hud_client_query_execute_param_command (HudClientQuery * cquery, GVariant * command_key, guint timestamp)
620
g_return_val_if_fail(HUD_CLIENT_IS_QUERY(cquery), NULL);
621
g_return_val_if_fail(command_key != NULL, NULL);
623
gchar * sender = g_dbus_proxy_get_name_owner(G_DBUS_PROXY(cquery->priv->proxy));
624
gchar * base_action = NULL;
625
gchar * action_path = NULL;
626
gchar * model_path = NULL;
628
GError * error = NULL;
630
_hud_query_com_canonical_hud_query_call_execute_parameterized_sync(cquery->priv->proxy, command_key, timestamp, &base_action, &action_path, &model_path, §ion, NULL, &error);
633
g_warning("Unable to execute paramereterized action: %s", error->message);
638
HudClientParam * param = hud_client_param_new(sender, base_action, action_path, model_path, section);
649
* hud_client_query_execute_toolbar_item:
650
* @cquery: A #HudClientQuery
651
* @item: Which toolbar item is being activated
652
* @timestamp: Timestamp for the user event
654
* Executes a particular item in the tool bar. The item should
655
* be active before passing this.
658
hud_client_query_execute_toolbar_item (HudClientQuery * cquery, HudClientQueryToolbarItems item, guint timestamp)
660
g_return_if_fail(HUD_CLIENT_IS_QUERY(cquery));
662
_hud_query_com_canonical_hud_query_call_execute_toolbar_sync(cquery->priv->proxy, hud_client_query_toolbar_items_get_nick(item), timestamp, NULL, NULL);
668
* hud_client_query_appstack_get_app_id:
669
* @cquery: A #HudClientQuery
670
* @row: Which row in the table to grab the ID from
672
* Get the application ID for a given row in the appstack table.
674
* Return value: The application ID
677
hud_client_query_appstack_get_app_id (HudClientQuery * cquery, DeeModelIter * row)
679
g_return_val_if_fail(HUD_CLIENT_IS_QUERY(cquery), NULL);
680
g_return_val_if_fail(row != NULL, NULL);
682
return dee_model_get_string(cquery->priv->appstack, row, HUD_QUERY_APPSTACK_APPLICATION_ID);
686
* hud_client_query_appstack_get_app_icon:
687
* @cquery: A #HudClientQuery
688
* @row: Which row in the table to grab the icon from
690
* Get the application icon for a given row in the appstack table.
692
* Return value: The application icon
695
hud_client_query_appstack_get_app_icon (HudClientQuery * cquery, DeeModelIter * row)
697
g_return_val_if_fail(HUD_CLIENT_IS_QUERY(cquery), NULL);
698
g_return_val_if_fail(row != NULL, NULL);
700
return dee_model_get_string(cquery->priv->appstack, row, HUD_QUERY_APPSTACK_ICON_NAME);
704
* hud_client_query_results_get_command_id:
705
* @cquery: A #HudClientQuery
706
* @row: Which row in the table to grab the ID from
708
* Get the command ID for a given row in the results table.
710
* Return value: (transfer full): The command ID
713
hud_client_query_results_get_command_id (HudClientQuery * cquery, DeeModelIter * row)
715
g_return_val_if_fail(HUD_CLIENT_IS_QUERY(cquery), NULL);
716
g_return_val_if_fail(row != NULL, NULL);
718
return dee_model_get_value(cquery->priv->results, row, HUD_QUERY_RESULTS_COMMAND_ID);
722
* hud_client_query_results_get_command_name:
723
* @cquery: A #HudClientQuery
724
* @row: Which row in the table to grab the name from
726
* Get the human readable command name for a given row in the results table.
728
* Return value: The command name
731
hud_client_query_results_get_command_name (HudClientQuery * cquery, DeeModelIter * row)
733
g_return_val_if_fail(HUD_CLIENT_IS_QUERY(cquery), NULL);
734
g_return_val_if_fail(row != NULL, NULL);
736
return dee_model_get_string(cquery->priv->results, row, HUD_QUERY_RESULTS_COMMAND_NAME);
740
* hud_client_query_results_get_command_highlights:
741
* @cquery: A #HudClientQuery
742
* @row: Which row in the table to grab the highlights from
744
* Get the command highlights for a row in the table with start and
745
* stop characters in an array.
747
* Return value: (transfer full): The command highlights as a variant of type "a(ii)"
750
hud_client_query_results_get_command_highlights (HudClientQuery * cquery, DeeModelIter * row)
752
g_return_val_if_fail(HUD_CLIENT_IS_QUERY(cquery), NULL);
753
g_return_val_if_fail(row != NULL, NULL);
755
return dee_model_get_value(cquery->priv->results, row, HUD_QUERY_RESULTS_COMMAND_HIGHLIGHTS);
759
* hud_client_query_results_get_description:
760
* @cquery: A #HudClientQuery
761
* @row: Which row in the table to grab the description from
763
* Get the human readable description for the command in the given row in the results table.
765
* Return value: The description
768
hud_client_query_results_get_description (HudClientQuery * cquery, DeeModelIter * row)
770
g_return_val_if_fail(HUD_CLIENT_IS_QUERY(cquery), NULL);
771
g_return_val_if_fail(row != NULL, NULL);
773
return dee_model_get_string(cquery->priv->results, row, HUD_QUERY_RESULTS_DESCRIPTION);
777
* hud_client_query_results_get_description_highlights:
778
* @cquery: A #HudClientQuery
779
* @row: Which row in the table to grab the highlights from
781
* Get the description highlights for a row in the table with start and
782
* stop characters in an array.
784
* Return value: (transfer full): The description highlights as a variant of type "a(ii)"
787
hud_client_query_results_get_description_highlights (HudClientQuery * cquery, DeeModelIter * row)
789
g_return_val_if_fail(HUD_CLIENT_IS_QUERY(cquery), NULL);
790
g_return_val_if_fail(row != NULL, NULL);
792
return dee_model_get_value(cquery->priv->results, row, HUD_QUERY_RESULTS_DESCRIPTION_HIGHLIGHTS);
796
* hud_client_query_results_get_shortcut:
797
* @cquery: A #HudClientQuery
798
* @row: Which row in the table to grab the shortcut from
800
* Get the human readable shortcut for the command in the given row in the results table.
802
* Return value: The shortcut
805
hud_client_query_results_get_shortcut (HudClientQuery * cquery, DeeModelIter * row)
807
g_return_val_if_fail(HUD_CLIENT_IS_QUERY(cquery), NULL);
808
g_return_val_if_fail(row != NULL, NULL);
810
return dee_model_get_string(cquery->priv->results, row, HUD_QUERY_RESULTS_SHORTCUT);
814
* hud_client_query_results_is_parameterized:
815
* @cquery: A #HudClientQuery
816
* @row: Which row in the table to check if the command is parameterized
818
* Check to see if the given command is parameterized
820
* Return value: Whether the command in the row is parameterized
823
hud_client_query_results_is_parameterized (HudClientQuery * cquery, DeeModelIter * row)
825
g_return_val_if_fail(HUD_CLIENT_IS_QUERY(cquery), FALSE);
826
g_return_val_if_fail(row != NULL, FALSE);
828
return dee_model_get_bool(cquery->priv->results, row, HUD_QUERY_RESULTS_PARAMETERIZED);