[dconf] engine: only Init the service when needed
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf] engine: only Init the service when needed
- Date: Fri, 11 Jan 2013 20:27:25 +0000 (UTC)
commit 554c431c95d4c6ad0de6871134b1952d08f11efd
Author: Ryan Lortie <desrt desrt ca>
Date: Fri Jan 11 14:15:41 2013 -0500
engine: only Init the service when needed
Instead of calling Init() blindly on startup for any service-db, only do
it if the file is missing when we go to open it.
engine/dconf-engine-source-service.c | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/engine/dconf-engine-source-service.c b/engine/dconf-engine-source-service.c
index a65be7b..5024fc0 100644
--- a/engine/dconf-engine-source-service.c
+++ b/engine/dconf-engine-source-service.c
@@ -24,6 +24,7 @@
#include "dconf-engine.h"
#include <sys/mman.h>
+#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
@@ -34,9 +35,6 @@ dconf_engine_source_service_init (DConfEngineSource *source)
source->bus_name = g_strdup ("ca.desrt.dconf");
source->object_path = g_strdup_printf ("/ca/desrt/dconf/%s", source->name);
source->writable = TRUE;
-
- dconf_engine_dbus_call_sync_func (source->bus_type, source->bus_name, source->object_path,
- "ca.desrt.dconf.Writer", "Init", NULL, NULL, NULL);
}
static gboolean
@@ -54,6 +52,12 @@ dconf_engine_source_service_reopen (DConfEngineSource *source)
gchar *filename;
filename = g_build_filename (g_get_user_runtime_dir (), "dconf-service", source->name, NULL);
+
+ /* If the file does not exist, kick the service to have it created. */
+ if (access (filename, R_OK) != 0)
+ dconf_engine_dbus_call_sync_func (source->bus_type, source->bus_name, source->object_path,
+ "ca.desrt.dconf.Writer", "Init", NULL, NULL, NULL);
+
table = gvdb_table_new (filename, FALSE, &error);
if (table == NULL)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]