merge back 'master' changes

This commit is contained in:
Ryan Lortie
2010-04-15 18:25:32 -04:00
parent b82a5fce5f
commit 4c3c429f70
3 changed files with 65 additions and 31 deletions

View File

@@ -24,7 +24,7 @@
#include "config.h" #include "config.h"
#include "gsettingsbackendinternal.h" #include "gsettingsbackendinternal.h"
#include "gmemorysettingsbackend.h" #include "gnullsettingsbackend.h"
#include "giomodule-priv.h" #include "giomodule-priv.h"
#include "gio-marshal.h" #include "gio-marshal.h"
@@ -510,13 +510,13 @@ g_settings_backend_read (GSettingsBackend *backend,
* to indicate that the affected keys have suddenly "changed back" to their * to indicate that the affected keys have suddenly "changed back" to their
* old values. * old values.
*/ */
void gboolean
g_settings_backend_write (GSettingsBackend *backend, g_settings_backend_write (GSettingsBackend *backend,
const gchar *key, const gchar *key,
GVariant *value, GVariant *value,
gpointer origin_tag) gpointer origin_tag)
{ {
G_SETTINGS_BACKEND_GET_CLASS (backend) return G_SETTINGS_BACKEND_GET_CLASS (backend)
->write (backend, key, value, origin_tag); ->write (backend, key, value, origin_tag);
} }
@@ -543,41 +543,56 @@ g_settings_backend_write (GSettingsBackend *backend,
* to indicate that the affected keys have suddenly "changed back" to their * to indicate that the affected keys have suddenly "changed back" to their
* old values. * old values.
*/ */
void gboolean
g_settings_backend_write_keys (GSettingsBackend *backend, g_settings_backend_write_keys (GSettingsBackend *backend,
GTree *tree, GTree *tree,
gpointer origin_tag) gpointer origin_tag)
{ {
G_SETTINGS_BACKEND_GET_CLASS (backend) return G_SETTINGS_BACKEND_GET_CLASS (backend)
->write_keys (backend, tree, origin_tag); ->write_keys (backend, tree, origin_tag);
} }
/*< private > /*< private >
* g_settings_backend_reset: * g_settings_backend_reset:
* @backend: a #GSettingsBackend implementation * @backend: a #GSettingsBackend implementation
* @name: the name of a key or path * @key: the name of a key
* @origin_tag: the origin tag * @origin_tag: the origin tag
* *
* "Resets" the named key or path. For a key this means that it is * "Resets" the named key to its "default" value (ie: after system-wide
* reverted to its "default" value (ie: after system-wide defaults, * defaults, mandatory keys, etc. have been taken into account) or possibly
* mandatory keys, etc. have been taken into account) or possibly unsets * unsets it.
* it.
*
* For paths, it means that every key under the path is reset.
*/ */
void void
g_settings_backend_reset (GSettingsBackend *backend, g_settings_backend_reset (GSettingsBackend *backend,
const gchar *name, const gchar *key,
gpointer origin_tag) gpointer origin_tag)
{ {
G_SETTINGS_BACKEND_GET_CLASS (backend) G_SETTINGS_BACKEND_GET_CLASS (backend)
->reset (backend, name, origin_tag); ->reset (backend, key, origin_tag);
}
/*< private >
* g_settings_backend_reset_path:
* @backend: a #GSettingsBackend implementation
* @name: the name of a key or path
* @origin_tag: the origin tag
*
* "Resets" the named path. This means that every key under the path is
* reset.
*/
void
g_settings_backend_reset_path (GSettingsBackend *backend,
const gchar *path,
gpointer origin_tag)
{
G_SETTINGS_BACKEND_GET_CLASS (backend)
->reset_path (backend, path, origin_tag);
} }
/*< private > /*< private >
* g_settings_backend_get_writable: * g_settings_backend_get_writable:
* @backend: a #GSettingsBackend implementation * @backend: a #GSettingsBackend implementation
* @name: the name of a key * @key: the name of a key
* @returns: %TRUE if the key is writable * @returns: %TRUE if the key is writable
* *
* Finds out if a key is available for writing to. This is the * Finds out if a key is available for writing to. This is the
@@ -589,10 +604,10 @@ g_settings_backend_reset (GSettingsBackend *backend,
*/ */
gboolean gboolean
g_settings_backend_get_writable (GSettingsBackend *backend, g_settings_backend_get_writable (GSettingsBackend *backend,
const gchar *name) const gchar *key)
{ {
return G_SETTINGS_BACKEND_GET_CLASS (backend) return G_SETTINGS_BACKEND_GET_CLASS (backend)
->get_writable (backend, name); ->get_writable (backend, key);
} }
/*< private > /*< private >
@@ -784,7 +799,7 @@ get_default_backend (const gchar *context)
class = g_io_extension_ref_class (extension); class = g_io_extension_ref_class (extension);
backend_class = G_SETTINGS_BACKEND_CLASS (class); backend_class = G_SETTINGS_BACKEND_CLASS (class);
if (backend_class->supports_context != NULL && if (backend_class->supports_context == NULL ||
!backend_class->supports_context (context)) !backend_class->supports_context (context))
{ {
g_type_class_unref (class); g_type_class_unref (class);
@@ -828,7 +843,6 @@ g_settings_backend_get_with_context (const gchar *context)
g_return_val_if_fail (context != NULL, NULL); g_return_val_if_fail (context != NULL, NULL);
_g_io_modules_ensure_extension_points_registered (); _g_io_modules_ensure_extension_points_registered ();
G_TYPE_MEMORY_SETTINGS_BACKEND;
if (!backends) if (!backends)
backends = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); backends = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
@@ -840,9 +854,7 @@ g_settings_backend_get_with_context (const gchar *context)
backend = get_default_backend (context); backend = get_default_backend (context);
if (!backend) if (!backend)
{ backend = g_null_settings_backend_new ();
/* FIXME: create an instance of the memory backend */
}
g_hash_table_insert (backends, g_strdup (context), backend); g_hash_table_insert (backends, g_strdup (context), backend);
} }
@@ -874,3 +886,6 @@ g_settings_backend_supports_context (const gchar *context)
return FALSE; return FALSE;
} }
#define __G_SETTINGS_BACKEND_C__
#include "gioaliasdef.c"

View File

@@ -70,18 +70,21 @@ struct _GSettingsBackendClass
GVariant * (*read) (GSettingsBackend *backend, GVariant * (*read) (GSettingsBackend *backend,
const gchar *key, const gchar *key,
const GVariantType *expected_type); const GVariantType *expected_type);
void (*write) (GSettingsBackend *backend, gboolean (*write) (GSettingsBackend *backend,
const gchar *key, const gchar *key,
GVariant *value, GVariant *value,
gpointer origin_tag); gpointer origin_tag);
void (*write_keys) (GSettingsBackend *backend, gboolean (*write_keys) (GSettingsBackend *backend,
GTree *tree, GTree *tree,
gpointer origin_tag); gpointer origin_tag);
void (*reset) (GSettingsBackend *backend, void (*reset) (GSettingsBackend *backend,
const gchar *name, const gchar *key,
gpointer origin_tag);
void (*reset_path) (GSettingsBackend *backend,
const gchar *path,
gpointer origin_tag); gpointer origin_tag);
gboolean (*get_writable) (GSettingsBackend *backend, gboolean (*get_writable) (GSettingsBackend *backend,
const gchar *name); const gchar *key);
void (*subscribe) (GSettingsBackend *backend, void (*subscribe) (GSettingsBackend *backend,
const gchar *name); const gchar *name);
void (*unsubscribe) (GSettingsBackend *backend, void (*unsubscribe) (GSettingsBackend *backend,

View File

@@ -48,6 +48,7 @@ typedef void (*GSettingsBackendPathWritableChangedFunc) (GSettin
const gchar *path, const gchar *path,
gpointer user_data); gpointer user_data);
G_GNUC_INTERNAL
void g_settings_backend_watch (GSettingsBackend *backend, void g_settings_backend_watch (GSettingsBackend *backend,
GSettingsBackendChangedFunc changed, GSettingsBackendChangedFunc changed,
GSettingsBackendPathChangedFunc path_changed, GSettingsBackendPathChangedFunc path_changed,
@@ -55,31 +56,46 @@ void g_settings_backend_watch (GSettin
GSettingsBackendWritableChangedFunc writable_changed, GSettingsBackendWritableChangedFunc writable_changed,
GSettingsBackendPathWritableChangedFunc path_writable_changed, GSettingsBackendPathWritableChangedFunc path_writable_changed,
gpointer user_data); gpointer user_data);
G_GNUC_INTERNAL
void g_settings_backend_unwatch (GSettingsBackend *backend, void g_settings_backend_unwatch (GSettingsBackend *backend,
gpointer user_data); gpointer user_data);
G_GNUC_INTERNAL
gboolean g_settings_backend_supports_context (const gchar *context); gboolean g_settings_backend_supports_context (const gchar *context);
G_GNUC_INTERNAL
GSettingsBackend * g_settings_backend_get_with_context (const gchar *context); GSettingsBackend * g_settings_backend_get_with_context (const gchar *context);
G_GNUC_INTERNAL
GTree * g_settings_backend_create_tree (void); GTree * g_settings_backend_create_tree (void);
G_GNUC_INTERNAL
GVariant * g_settings_backend_read (GSettingsBackend *backend, GVariant * g_settings_backend_read (GSettingsBackend *backend,
const gchar *key, const gchar *key,
const GVariantType *expected_type); const GVariantType *expected_type);
void g_settings_backend_write (GSettingsBackend *backend, G_GNUC_INTERNAL
gboolean g_settings_backend_write (GSettingsBackend *backend,
const gchar *key, const gchar *key,
GVariant *value, GVariant *value,
gpointer origin_tag); gpointer origin_tag);
void g_settings_backend_write_keys (GSettingsBackend *backend, G_GNUC_INTERNAL
gboolean g_settings_backend_write_keys (GSettingsBackend *backend,
GTree *tree, GTree *tree,
gpointer origin_tag); gpointer origin_tag);
G_GNUC_INTERNAL
void g_settings_backend_reset (GSettingsBackend *backend, void g_settings_backend_reset (GSettingsBackend *backend,
const gchar *name, const gchar *key,
gpointer origin_tag); gpointer origin_tag);
gboolean g_settings_backend_get_writable (GSettingsBackend *backend, G_GNUC_INTERNAL
const char *name); void g_settings_backend_reset_path (GSettingsBackend *backend,
const gchar *path,
gpointer origin_tag);
G_GNUC_INTERNAL
gboolean g_settings_backend_get_writable (GSettingsBackend *backend,
const char *key);
G_GNUC_INTERNAL
void g_settings_backend_unsubscribe (GSettingsBackend *backend, void g_settings_backend_unsubscribe (GSettingsBackend *backend,
const char *name); const char *name);
G_GNUC_INTERNAL
void g_settings_backend_subscribe (GSettingsBackend *backend, void g_settings_backend_subscribe (GSettingsBackend *backend,
const char *name); const char *name);