+
+static GKeyfileSettingsBackend *
+g_keyfile_settings_backend_new (const gchar *filename)
+{
+ GKeyfileSettingsBackend *kf_backend;
+ GFile *file;
+
+ kf_backend = g_object_new (G_TYPE_KEYFILE_SETTINGS_BACKEND, NULL);
+ kf_backend->priv->file_path = g_strdup (filename);
+
+ file = g_file_new_for_path (kf_backend->priv->file_path);
+
+ kf_backend->priv->writable = g_keyfile_settings_backend_keyfile_writable (file);
+
+ kf_backend->priv->monitor = g_file_monitor_file (file, G_FILE_MONITOR_SEND_MOVED, NULL, NULL);
+ g_signal_connect (kf_backend->priv->monitor, "changed",
+ (GCallback)g_keyfile_settings_backend_keyfile_changed, kf_backend);
+
+ g_object_unref (file);
+
+ g_keyfile_settings_backend_keyfile_reload (kf_backend);
+
+ return kf_backend;
+}
+
+/**
+ * g_settings_backend_setup_keyfile:
+ * @context: a context string (not %NULL or "")
+ * @filename: a filename
+ *
+ * Sets up a keyfile for use with #GSettings.
+ *
+ * If you create a #GSettings with its context property set to @context
+ * then the settings will be stored in the keyfile at @filename. See
+ * g_settings_new_with_context().
+ *
+ * The keyfile must be setup before any settings objects are created
+ * for the named context.
+ *
+ * It is not possible to specify a keyfile for the default context.
+ *
+ * If the path leading up to @filename does not exist, it will be
+ * recursively created with user-only permissions. If the keyfile is
+ * not writable, any #GSettings objects created using @context will
+ * return %FALSE for any calls to g_settings_is_writable() and any
+ * attempts to write will fail.
+ */
+void
+g_settings_backend_setup_keyfile (const gchar *context,
+ const gchar *filename)
+{
+ GKeyfileSettingsBackend *kf_backend;
+
+ kf_backend = g_keyfile_settings_backend_new (filename);
+ g_settings_backend_setup (context, G_SETTINGS_BACKEND (kf_backend));
+ g_object_unref (kf_backend);
+}
+
+#define __G_KEYFILE_SETTINGS_BACKEND_C__
+#include "gioaliasdef.c"