You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

139 lines
7.1 KiB

  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, write to the
  17. * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  18. * Boston, MA 02111-1307, USA.
  19. *
  20. * Authors: Ryan Lortie <desrt@desrt.ca>
  21. * Matthias Clasen <mclasen@redhat.com>
  22. */
  23. #ifndef __G_SETTINGS_BACKEND_H__
  24. #define __G_SETTINGS_BACKEND_H__
  25. #if !defined (G_SETTINGS_ENABLE_BACKEND) && !defined (GIO_COMPILATION)
  26. #error "You must define G_SETTINGS_ENABLE_BACKEND before including <gio/gsettingsbackend.h>."
  27. #endif
  28. #define __GIO_GIO_H_INSIDE__
  29. #include <gio/giotypes.h>
  30. #undef __GIO_GIO_H_INSIDE__
  31. G_BEGIN_DECLS
  32. #define G_TYPE_SETTINGS_BACKEND (g_settings_backend_get_type ())
  33. #define G_SETTINGS_BACKEND(inst) (G_TYPE_CHECK_INSTANCE_CAST ((inst), \
  34. G_TYPE_SETTINGS_BACKEND, GSettingsBackend))
  35. #define G_SETTINGS_BACKEND_CLASS(class) (G_TYPE_CHECK_CLASS_CAST ((class), \
  36. G_TYPE_SETTINGS_BACKEND, GSettingsBackendClass))
  37. #define G_IS_SETTINGS_BACKEND(inst) (G_TYPE_CHECK_INSTANCE_TYPE ((inst), \
  38. G_TYPE_SETTINGS_BACKEND))
  39. #define G_IS_SETTINGS_BACKEND_CLASS(class) (G_TYPE_CHECK_CLASS_TYPE ((class), \
  40. G_TYPE_SETTINGS_BACKEND))
  41. #define G_SETTINGS_BACKEND_GET_CLASS(inst) (G_TYPE_INSTANCE_GET_CLASS ((inst), \
  42. G_TYPE_SETTINGS_BACKEND, GSettingsBackendClass))
  43. /**
  44. * G_SETTINGS_BACKEND_EXTENSION_POINT_NAME:
  45. *
  46. * Extension point for #GSettingsBackend functionality.
  47. **/
  48. #define G_SETTINGS_BACKEND_EXTENSION_POINT_NAME "gsettings-backend"
  49. /**
  50. * GSettingsBackend:
  51. *
  52. * An implementation of a settings storage repository.
  53. **/
  54. typedef struct _GSettingsBackendPrivate GSettingsBackendPrivate;
  55. typedef struct _GSettingsBackendClass GSettingsBackendClass;
  56. struct _GSettingsBackendClass
  57. {
  58. GObjectClass parent_class;
  59. GVariant * (*read) (GSettingsBackend *backend,
  60. const gchar *key,
  61. const GVariantType *expected_type,
  62. gboolean default_value);
  63. gboolean (*get_writable) (GSettingsBackend *backend,
  64. const gchar *key);
  65. gboolean (*write) (GSettingsBackend *backend,
  66. const gchar *key,
  67. GVariant *value,
  68. gpointer origin_tag);
  69. gboolean (*write_tree) (GSettingsBackend *backend,
  70. GTree *tree,
  71. gpointer origin_tag);
  72. void (*reset) (GSettingsBackend *backend,
  73. const gchar *key,
  74. gpointer origin_tag);
  75. void (*subscribe) (GSettingsBackend *backend,
  76. const gchar *name);
  77. void (*unsubscribe) (GSettingsBackend *backend,
  78. const gchar *name);
  79. void (*sync) (GSettingsBackend *backend);
  80. GPermission * (*get_permission) (GSettingsBackend *backend,
  81. const gchar *path);
  82. gpointer padding[24];
  83. };
  84. struct _GSettingsBackend
  85. {
  86. GObject parent_instance;
  87. /*< private >*/
  88. GSettingsBackendPrivate *priv;
  89. };
  90. GType g_settings_backend_get_type (void);
  91. void g_settings_backend_changed (GSettingsBackend *backend,
  92. const gchar *key,
  93. gpointer origin_tag);
  94. void g_settings_backend_path_changed (GSettingsBackend *backend,
  95. const gchar *path,
  96. gpointer origin_tag);
  97. void g_settings_backend_flatten_tree (GTree *tree,
  98. gchar **path,
  99. const gchar ***keys,
  100. GVariant ***values);
  101. void g_settings_backend_keys_changed (GSettingsBackend *backend,
  102. const gchar *path,
  103. gchar const * const *items,
  104. gpointer origin_tag);
  105. void g_settings_backend_path_writable_changed (GSettingsBackend *backend,
  106. const gchar *path);
  107. void g_settings_backend_writable_changed (GSettingsBackend *backend,
  108. const gchar *key);
  109. void g_settings_backend_changed_tree (GSettingsBackend *backend,
  110. GTree *tree,
  111. gpointer origin_tag);
  112. GSettingsBackend * g_keyfile_settings_backend_new (const gchar *filename,
  113. const gchar *root_path,
  114. const gchar *root_group);
  115. G_END_DECLS
  116. #endif /* __G_SETTINGS_BACKEND_H__ */