gaction.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. * Copyright © 2010 Codethink Limited
  3. *
  4. * SPDX-License-Identifier: LGPL-2.1-or-later
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Lesser General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2.1 of the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Lesser General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Lesser General
  17. * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
  18. *
  19. * Authors: Ryan Lortie <desrt@desrt.ca>
  20. */
  21. #ifndef __G_ACTION_H__
  22. #define __G_ACTION_H__
  23. #if !defined (__GIO_GIO_H_INSIDE__) && !defined (GIO_COMPILATION)
  24. #error "Only <gio/gio.h> can be included directly."
  25. #endif
  26. #include <gio/giotypes.h>
  27. G_BEGIN_DECLS
  28. #define G_TYPE_ACTION (g_action_get_type ())
  29. #define G_ACTION(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
  30. G_TYPE_ACTION, GAction))
  31. #define G_IS_ACTION(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), G_TYPE_ACTION))
  32. #define G_ACTION_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), \
  33. G_TYPE_ACTION, GActionInterface))
  34. typedef struct _GActionInterface GActionInterface;
  35. struct _GActionInterface
  36. {
  37. GTypeInterface g_iface;
  38. /* virtual functions */
  39. const gchar * (* get_name) (GAction *action);
  40. const GVariantType * (* get_parameter_type) (GAction *action);
  41. const GVariantType * (* get_state_type) (GAction *action);
  42. GVariant * (* get_state_hint) (GAction *action);
  43. gboolean (* get_enabled) (GAction *action);
  44. GVariant * (* get_state) (GAction *action);
  45. void (* change_state) (GAction *action,
  46. GVariant *value);
  47. void (* activate) (GAction *action,
  48. GVariant *parameter);
  49. };
  50. GIO_AVAILABLE_IN_2_30
  51. GType g_action_get_type (void) G_GNUC_CONST;
  52. GIO_AVAILABLE_IN_ALL
  53. const gchar * g_action_get_name (GAction *action);
  54. GIO_AVAILABLE_IN_ALL
  55. const GVariantType * g_action_get_parameter_type (GAction *action);
  56. GIO_AVAILABLE_IN_ALL
  57. const GVariantType * g_action_get_state_type (GAction *action);
  58. GIO_AVAILABLE_IN_ALL
  59. GVariant * g_action_get_state_hint (GAction *action);
  60. GIO_AVAILABLE_IN_ALL
  61. gboolean g_action_get_enabled (GAction *action);
  62. GIO_AVAILABLE_IN_ALL
  63. GVariant * g_action_get_state (GAction *action);
  64. GIO_AVAILABLE_IN_ALL
  65. void g_action_change_state (GAction *action,
  66. GVariant *value);
  67. GIO_AVAILABLE_IN_ALL
  68. void g_action_activate (GAction *action,
  69. GVariant *parameter);
  70. GIO_AVAILABLE_IN_2_28
  71. gboolean g_action_name_is_valid (const gchar *action_name);
  72. GIO_AVAILABLE_IN_2_38
  73. gboolean g_action_parse_detailed_name (const gchar *detailed_name,
  74. gchar **action_name,
  75. GVariant **target_value,
  76. GError **error);
  77. GIO_AVAILABLE_IN_2_38
  78. gchar * g_action_print_detailed_name (const gchar *action_name,
  79. GVariant *target_value);
  80. G_END_DECLS
  81. #endif /* __G_ACTION_H__ */