gsettingsbackend.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. /*
  2. * Copyright © 2009, 2010 Codethink Limited
  3. * Copyright © 2010 Red Hat, Inc.
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Lesser General Public
  7. * License as published by the Free Software Foundation; either
  8. * version 2 of the licence, or (at your option) any later version.
  9. *
  10. * This library is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Lesser General Public
  16. * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  17. *
  18. * Authors: Ryan Lortie <[email protected]>
  19. * Matthias Clasen <[email protected]>
  20. */
  21. #ifndef __G_SETTINGS_BACKEND_H__
  22. #define __G_SETTINGS_BACKEND_H__
  23. #if !defined (G_SETTINGS_ENABLE_BACKEND) && !defined (GIO_COMPILATION)
  24. #error "You must define G_SETTINGS_ENABLE_BACKEND before including <gio/gsettingsbackend.h>."
  25. #endif
  26. #define __GIO_GIO_H_INSIDE__
  27. #include <gio/giotypes.h>
  28. #undef __GIO_GIO_H_INSIDE__
  29. G_BEGIN_DECLS
  30. #define G_TYPE_SETTINGS_BACKEND (g_settings_backend_get_type ())
  31. #define G_SETTINGS_BACKEND(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
  32. G_TYPE_SETTINGS_BACKEND, GSettingsBackend))
  33. #define G_SETTINGS_BACKEND_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
  34. G_TYPE_SETTINGS_BACKEND, GSettingsBackendClass))
  35. #define G_IS_SETTINGS_BACKEND(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
  36. G_TYPE_SETTINGS_BACKEND))
  37. #define G_IS_SETTINGS_BACKEND_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
  38. G_TYPE_SETTINGS_BACKEND))
  39. #define G_SETTINGS_BACKEND_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
  40. G_TYPE_SETTINGS_BACKEND, GSettingsBackendClass))
  41. /**
  42. * G_SETTINGS_BACKEND_EXTENSION_POINT_NAME:
  43. *
  44. * Extension point for #GSettingsBackend functionality.
  45. **/
  46. #define G_SETTINGS_BACKEND_EXTENSION_POINT_NAME "gsettings-backend"
  47. /**
  48. * GSettingsBackend:
  49. *
  50. * An implementation of a settings storage repository.
  51. **/
  52. typedef struct _GSettingsBackendPrivate GSettingsBackendPrivate;
  53. typedef struct _GSettingsBackendClass GSettingsBackendClass;
  54. struct _GSettingsBackendClass
  55. {
  56. GObjectClass parent_class;
  57. GVariant * (*read) (GSettingsBackend *backend,
  58. const gchar *key,
  59. const GVariantType *expected_type,
  60. gboolean default_value);
  61. gboolean (*get_writable) (GSettingsBackend *backend,
  62. const gchar *key);
  63. gboolean (*write) (GSettingsBackend *backend,
  64. const gchar *key,
  65. GVariant *value,
  66. gpointer origin_tag);
  67. gboolean (*write_tree) (GSettingsBackend *backend,
  68. GTree *tree,
  69. gpointer origin_tag);
  70. void (*reset) (GSettingsBackend *backend,
  71. const gchar *key,
  72. gpointer origin_tag);
  73. void (*subscribe) (GSettingsBackend *backend,
  74. const gchar *name);
  75. void (*unsubscribe) (GSettingsBackend *backend,
  76. const gchar *name);
  77. void (*sync) (GSettingsBackend *backend);
  78. GPermission * (*get_permission) (GSettingsBackend *backend,
  79. const gchar *path);
  80. GVariant * (*read_user_value) (GSettingsBackend *backend,
  81. const gchar *key,
  82. const GVariantType *expected_type);
  83. gpointer padding[23];
  84. };
  85. struct _GSettingsBackend
  86. {
  87. GObject parent_instance;
  88. /*< private >*/
  89. GSettingsBackendPrivate *priv;
  90. };
  91. GLIB_AVAILABLE_IN_ALL
  92. GType g_settings_backend_get_type (void);
  93. GLIB_AVAILABLE_IN_ALL
  94. void g_settings_backend_changed (GSettingsBackend *backend,
  95. const gchar *key,
  96. gpointer origin_tag);
  97. GLIB_AVAILABLE_IN_ALL
  98. void g_settings_backend_path_changed (GSettingsBackend *backend,
  99. const gchar *path,
  100. gpointer origin_tag);
  101. GLIB_AVAILABLE_IN_ALL
  102. void g_settings_backend_flatten_tree (GTree *tree,
  103. gchar **path,
  104. const gchar ***keys,
  105. GVariant ***values);
  106. GLIB_AVAILABLE_IN_ALL
  107. void g_settings_backend_keys_changed (GSettingsBackend *backend,
  108. const gchar *path,
  109. gchar const * const *items,
  110. gpointer origin_tag);
  111. GLIB_AVAILABLE_IN_ALL
  112. void g_settings_backend_path_writable_changed (GSettingsBackend *backend,
  113. const gchar *path);
  114. GLIB_AVAILABLE_IN_ALL
  115. void g_settings_backend_writable_changed (GSettingsBackend *backend,
  116. const gchar *key);
  117. GLIB_AVAILABLE_IN_ALL
  118. void g_settings_backend_changed_tree (GSettingsBackend *backend,
  119. GTree *tree,
  120. gpointer origin_tag);
  121. GLIB_AVAILABLE_IN_ALL
  122. GSettingsBackend * g_settings_backend_get_default (void);
  123. GLIB_AVAILABLE_IN_ALL
  124. GSettingsBackend * g_keyfile_settings_backend_new (const gchar *filename,
  125. const gchar *root_path,
  126. const gchar *root_group);
  127. GLIB_AVAILABLE_IN_ALL
  128. GSettingsBackend * g_null_settings_backend_new (void);
  129. GLIB_AVAILABLE_IN_ALL
  130. GSettingsBackend * g_memory_settings_backend_new (void);
  131. G_END_DECLS
  132. #endif /* __G_SETTINGS_BACKEND_H__ */