~indicator-applet-developers/hud/phablet

« back to all changes in this revision

Viewing changes to libhud-client/query.c

  • Committer: Tarmac
  • Author(s): Ted Gould
  • Date: 2013-03-25 16:24:27 UTC
  • mfrom: (350.1.14 abstract-columns)
  • Revision ID: tarmac-20130325162427-iccot0i7luf7ydxw
Client API for accessing the model columns without magic numbers.

Approved by Antti Kaijanmäki, PS Jenkins bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
#include "connection.h"
27
27
#include "query-iface.h"
28
28
#include "enum-types.h"
 
29
#include "query-columns.h"
29
30
 
30
31
struct _HudClientQueryPrivate {
31
32
        _HudQueryComCanonicalHudQuery * proxy;
598
599
 
599
600
        return;
600
601
}
 
602
 
 
603
/**
 
604
 * hud_client_query_appstack_get_app_id:
 
605
 * @cquery: A #HudClientQuery
 
606
 * @row: Which row in the table to grab the ID from
 
607
 *
 
608
 * Get the application ID for a given row in the appstack table.
 
609
 *
 
610
 * Return value: The application ID
 
611
 */
 
612
const gchar *
 
613
hud_client_query_appstack_get_app_id (HudClientQuery * cquery, DeeModelIter * row)
 
614
{
 
615
        g_return_val_if_fail(HUD_CLIENT_IS_QUERY(cquery), NULL);
 
616
        g_return_val_if_fail(row != NULL, NULL);
 
617
 
 
618
        return dee_model_get_string(cquery->priv->appstack, row, HUD_QUERY_APPSTACK_APPLICATION_ID);
 
619
}
 
620
 
 
621
/**
 
622
 * hud_client_query_appstack_get_app_icon:
 
623
 * @cquery: A #HudClientQuery
 
624
 * @row: Which row in the table to grab the icon from
 
625
 *
 
626
 * Get the application icon for a given row in the appstack table.
 
627
 *
 
628
 * Return value: The application icon
 
629
 */
 
630
const gchar *
 
631
hud_client_query_appstack_get_app_icon (HudClientQuery * cquery, DeeModelIter * row)
 
632
{
 
633
        g_return_val_if_fail(HUD_CLIENT_IS_QUERY(cquery), NULL);
 
634
        g_return_val_if_fail(row != NULL, NULL);
 
635
 
 
636
        return dee_model_get_string(cquery->priv->appstack, row, HUD_QUERY_APPSTACK_ICON_NAME);
 
637
}
 
638
 
 
639
/**
 
640
 * hud_client_query_results_get_command_id:
 
641
 * @cquery: A #HudClientQuery
 
642
 * @row: Which row in the table to grab the ID from
 
643
 *
 
644
 * Get the command ID for a given row in the results table.
 
645
 *
 
646
 * Return value: (transfer full): The command ID
 
647
 */
 
648
GVariant *
 
649
hud_client_query_results_get_command_id (HudClientQuery * cquery, DeeModelIter * row)
 
650
{
 
651
        g_return_val_if_fail(HUD_CLIENT_IS_QUERY(cquery), NULL);
 
652
        g_return_val_if_fail(row != NULL, NULL);
 
653
 
 
654
        return dee_model_get_value(cquery->priv->results, row, HUD_QUERY_RESULTS_COMMAND_ID);
 
655
}
 
656
 
 
657
/**
 
658
 * hud_client_query_results_get_command_name:
 
659
 * @cquery: A #HudClientQuery
 
660
 * @row: Which row in the table to grab the name from
 
661
 *
 
662
 * Get the human readable command name for a given row in the results table.
 
663
 *
 
664
 * Return value: The command name
 
665
 */
 
666
const gchar *
 
667
hud_client_query_results_get_command_name (HudClientQuery * cquery, DeeModelIter * row)
 
668
{
 
669
        g_return_val_if_fail(HUD_CLIENT_IS_QUERY(cquery), NULL);
 
670
        g_return_val_if_fail(row != NULL, NULL);
 
671
 
 
672
        return dee_model_get_string(cquery->priv->results, row, HUD_QUERY_RESULTS_COMMAND_NAME);
 
673
}
 
674
 
 
675
/**
 
676
 * hud_client_query_results_get_command_highlights:
 
677
 * @cquery: A #HudClientQuery
 
678
 * @row: Which row in the table to grab the highlights from
 
679
 *
 
680
 * Get the command highlights for a row in the table with start and
 
681
 * stop characters in an array.
 
682
 *
 
683
 * Return value: (transfer full): The command highlights as a variant of type "a(ii)"
 
684
 */
 
685
GVariant *
 
686
hud_client_query_results_get_command_highlights (HudClientQuery * cquery, DeeModelIter * row)
 
687
{
 
688
        g_return_val_if_fail(HUD_CLIENT_IS_QUERY(cquery), NULL);
 
689
        g_return_val_if_fail(row != NULL, NULL);
 
690
 
 
691
        return dee_model_get_value(cquery->priv->results, row, HUD_QUERY_RESULTS_COMMAND_HIGHLIGHTS);
 
692
}
 
693
 
 
694
/**
 
695
 * hud_client_query_results_get_description:
 
696
 * @cquery: A #HudClientQuery
 
697
 * @row: Which row in the table to grab the description from
 
698
 *
 
699
 * Get the human readable description for the command in the given row in the results table.
 
700
 *
 
701
 * Return value: The description
 
702
 */
 
703
const gchar *
 
704
hud_client_query_results_get_description (HudClientQuery * cquery, DeeModelIter * row)
 
705
{
 
706
        g_return_val_if_fail(HUD_CLIENT_IS_QUERY(cquery), NULL);
 
707
        g_return_val_if_fail(row != NULL, NULL);
 
708
 
 
709
        return dee_model_get_string(cquery->priv->results, row, HUD_QUERY_RESULTS_DESCRIPTION);
 
710
}
 
711
 
 
712
/**
 
713
 * hud_client_query_results_get_description_highlights:
 
714
 * @cquery: A #HudClientQuery
 
715
 * @row: Which row in the table to grab the highlights from
 
716
 *
 
717
 * Get the description highlights for a row in the table with start and
 
718
 * stop characters in an array.
 
719
 *
 
720
 * Return value: (transfer full): The description highlights as a variant of type "a(ii)"
 
721
 */
 
722
GVariant *
 
723
hud_client_query_results_get_description_highlights (HudClientQuery * cquery, DeeModelIter * row)
 
724
{
 
725
        g_return_val_if_fail(HUD_CLIENT_IS_QUERY(cquery), NULL);
 
726
        g_return_val_if_fail(row != NULL, NULL);
 
727
 
 
728
        return dee_model_get_value(cquery->priv->results, row, HUD_QUERY_RESULTS_DESCRIPTION_HIGHLIGHTS);
 
729
}
 
730
 
 
731
/**
 
732
 * hud_client_query_results_get_shortcut:
 
733
 * @cquery: A #HudClientQuery
 
734
 * @row: Which row in the table to grab the shortcut from
 
735
 *
 
736
 * Get the human readable shortcut for the command in the given row in the results table.
 
737
 *
 
738
 * Return value: The shortcut
 
739
 */
 
740
const gchar *
 
741
hud_client_query_results_get_shortcut (HudClientQuery * cquery, DeeModelIter * row)
 
742
{
 
743
        g_return_val_if_fail(HUD_CLIENT_IS_QUERY(cquery), NULL);
 
744
        g_return_val_if_fail(row != NULL, NULL);
 
745
 
 
746
        return dee_model_get_string(cquery->priv->results, row, HUD_QUERY_RESULTS_SHORTCUT);
 
747
}
 
748
 
 
749
/**
 
750
 * hud_client_query_results_is_parameterized:
 
751
 * @cquery: A #HudClientQuery
 
752
 * @row: Which row in the table to check if the command is parameterized
 
753
 *
 
754
 * Check to see if the given command is parameterized
 
755
 *
 
756
 * Return value: Whether the command in the row is parameterized
 
757
 */
 
758
gboolean
 
759
hud_client_query_results_is_parameterized (HudClientQuery * cquery, DeeModelIter * row)
 
760
{
 
761
        g_return_val_if_fail(HUD_CLIENT_IS_QUERY(cquery), FALSE);
 
762
        g_return_val_if_fail(row != NULL, FALSE);
 
763
 
 
764
        return dee_model_get_bool(cquery->priv->results, row, HUD_QUERY_RESULTS_PARAMETERIZED);
 
765
}