Make the memory and null settings backends public

Bug #636806.
This commit is contained in:
Christian Persch 2010-12-05 15:34:26 +01:00
parent 0b59cf6566
commit 8d74c96b76
11 changed files with 43 additions and 76 deletions

View File

@ -2158,6 +2158,7 @@ G_TYPE_FILE_DESCRIPTOR_BASED
GSettingsBackend
GSettingsBackendClass
G_SETTINGS_BACKEND_EXTENSION_POINT_NAME
g_settings_backend_get_default
g_settings_backend_changed
g_settings_backend_path_changed
g_settings_backend_keys_changed
@ -2166,6 +2167,8 @@ g_settings_backend_writable_changed
g_settings_backend_changed_tree
g_settings_backend_flatten_tree
g_keyfile_settings_backend_new
g_memory_settings_backend_new
g_null_settings_backend_new
<SUBSECTION Standard>
G_IS_SETTINGS_BACKEND

View File

@ -116,9 +116,7 @@ settings_sources = \
gdelayedsettingsbackend.h \
gdelayedsettingsbackend.c \
gkeyfilesettingsbackend.c \
gmemorysettingsbackend.h \
gmemorysettingsbackend.c \
gnullsettingsbackend.h \
gnullsettingsbackend.c \
gsettingsbackendinternal.h \
gsettingsbackend.c \

View File

@ -1544,13 +1544,20 @@ g_settings_backend_path_changed
g_settings_backend_path_writable_changed
g_settings_backend_writable_changed
g_settings_backend_changed_tree
#endif
g_settings_backend_get_default
#endif
#if IN_HEADER(__G_SETTINGS_BACKEND_H__)
#if IN_FILE(__G_KEYFILE_SETTINGS_BACKEND_C__)
g_keyfile_settings_backend_new
#endif
#if IN_FILE(__G_MEMORY_SETTINGS_BACKEND_C__)
g_memory_settings_backend_new
#endif
#if IN_FILE(__G_NULL_SETTINGS_BACKEND_C__)
g_null_settings_backend_new
#endif
#endif
#if IN_HEADER(__G_SETTINGS_H__)

View File

@ -26,12 +26,12 @@
#include "giomodule.h"
#include "giomodule-priv.h"
#include "gmemorysettingsbackend.h"
#include "glocalfilemonitor.h"
#include "glocaldirectorymonitor.h"
#include "gnativevolumemonitor.h"
#include "gproxyresolver.h"
#include "gproxy.h"
#include "gsettingsbackendinternal.h"
#include "gsocks4proxy.h"
#include "gsocks4aproxy.h"
#include "gsocks5proxy.h"
@ -598,6 +598,7 @@ _g_io_modules_ensure_loaded (void)
}
/* Initialize types from built-in "modules" */
g_null_settings_backend_get_type ();
g_memory_settings_backend_get_type ();
#if defined(HAVE_SYS_INOTIFY_H) || defined(HAVE_LINUX_INOTIFY_H)
_g_inotify_directory_monitor_get_type ();

View File

@ -21,9 +21,8 @@
#include "config.h"
#include "gmemorysettingsbackend.h"
#include "gsimplepermission.h"
#include "gsettingsbackend.h"
#include "gsettingsbackendinternal.h"
#include "giomodule.h"
@ -174,3 +173,9 @@ g_memory_settings_backend_class_init (GMemorySettingsBackendClass *class)
backend_class->get_permission = g_memory_settings_backend_get_permission;
object_class->finalize = g_memory_settings_backend_finalize;
}
GSettingsBackend *
g_memory_settings_backend_new (void)
{
return g_object_new (G_TYPE_MEMORY_SETTINGS_BACKEND, NULL);
}

View File

@ -1,30 +0,0 @@
/*
* Copyright © 2010 Codethink Limited
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the licence, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Author: Ryan Lortie <desrt@desrt.ca>
*/
#ifndef __GMEMORY_SETTINGS_BACKEND_H__
#define __GMEMORY_SETTINGS_BACKEND_H__
#include <glib-object.h>
G_GNUC_INTERNAL
GType g_memory_settings_backend_get_type (void);
#endif /* __G_MEMORY_SETTINGS_BACKEND_H__ */

View File

@ -21,7 +21,8 @@
#include "config.h"
#include "gnullsettingsbackend.h"
#include "gsettingsbackendinternal.h"
#include "giomodule.h"
#include "gsimplepermission.h"
@ -34,10 +35,11 @@
typedef GSettingsBackendClass GNullSettingsBackendClass;
typedef GSettingsBackend GNullSettingsBackend;
static GType g_null_settings_backend_get_type (void);
G_DEFINE_TYPE (GNullSettingsBackend,
g_null_settings_backend,
G_TYPE_SETTINGS_BACKEND)
G_DEFINE_TYPE_WITH_CODE (GNullSettingsBackend,
g_null_settings_backend,
G_TYPE_SETTINGS_BACKEND,
g_io_extension_point_implement (G_SETTINGS_BACKEND_EXTENSION_POINT_NAME,
g_define_type_id, "null", 10))
static GVariant *
g_null_settings_backend_read (GSettingsBackend *backend,

View File

@ -1,30 +0,0 @@
/*
* Copyright © 2010 Codethink Limited
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the licence, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
* Author: Ryan Lortie <desrt@desrt.ca>
*/
#ifndef __G_NULL_SETTINGS_BACKEND_H__
#define __G_NULL_SETTINGS_BACKEND_H__
#include <gio/gsettingsbackend.h>
G_GNUC_INTERNAL
GSettingsBackend * g_null_settings_backend_new (void);
#endif /* __G_NULL_SETTINGS_BACKEND_H__ */

View File

@ -24,7 +24,6 @@
#include "config.h"
#include "gsettingsbackendinternal.h"
#include "gnullsettingsbackend.h"
#include "gsimplepermission.h"
#include "giomodule-priv.h"
#include "gio-marshal.h"
@ -925,7 +924,7 @@ g_settings_backend_create_tree (void)
g_free, (GDestroyNotify) g_variant_unref);
}
/*< private >
/**
* g_settings_backend_get_default:
* @returns: the default #GSettingsBackend
*
@ -934,6 +933,8 @@ g_settings_backend_create_tree (void)
* environment variable to the name of a settings backend.
*
* The user gets a reference to the backend.
*
* Since: 2.28
*/
GSettingsBackend *
g_settings_backend_get_default (void)

View File

@ -129,10 +129,16 @@ void g_settings_backend_changed_tree (GSettin
GTree *tree,
gpointer origin_tag);
GSettingsBackend * g_settings_backend_get_default (void);
GSettingsBackend * g_keyfile_settings_backend_new (const gchar *filename,
const gchar *root_path,
const gchar *root_group);
GSettingsBackend * g_null_settings_backend_new (void);
GSettingsBackend * g_memory_settings_backend_new (void);
G_END_DECLS
#endif /* __G_SETTINGS_BACKEND_H__ */

View File

@ -92,8 +92,12 @@ G_GNUC_INTERNAL
GPermission * g_settings_backend_get_permission (GSettingsBackend *backend,
const gchar *path);
G_GNUC_INTERNAL
GSettingsBackend * g_settings_backend_get_default (void);
G_GNUC_INTERNAL
void g_settings_backend_sync_default (void);
G_GNUC_INTERNAL
GType g_null_settings_backend_get_type (void);
G_GNUC_INTERNAL
GType g_memory_settings_backend_get_type (void);
#endif /* __G_SETTINGS_BACKEND_INTERNAL_H__ */