summaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
authorRyan Lortie <desrt@desrt.ca>2012-07-08 19:07:23 -0400
committerRyan Lortie <desrt@desrt.ca>2012-07-08 19:07:23 -0400
commit792a13279603b2533961a48b778514c805ef39cd (patch)
tree97d3e6dc693c94ffabc2b06c25a32c93851b30bb /engine
parent341cd4350474c166b0a737339b4dc40d7c0a5ca0 (diff)
downloaddconf-792a13279603b2533961a48b778514c805ef39cd.tar.gz
user source: change approach to shm
Use dconf_shm_is_flagged() instead of direct access. Change the semantics of what happens when we fail to open the shm file. We used to refuse to initialise at all in that case -- now we initialise but will try again every time to reopen ourselves. The error case will now be slower but closer to the correct behaviour.
Diffstat (limited to 'engine')
-rw-r--r--engine/dconf-engine-source-user.c15
1 files changed, 3 insertions, 12 deletions
diff --git a/engine/dconf-engine-source-user.c b/engine/dconf-engine-source-user.c
index 4f2d49b..3a2ddba 100644
--- a/engine/dconf-engine-source-user.c
+++ b/engine/dconf-engine-source-user.c
@@ -54,18 +54,12 @@ static gboolean
dconf_engine_source_user_init (DConfEngineSource *source)
{
DConfEngineSourceUser *user_source = (DConfEngineSourceUser *) source;
- guint8 *shm;
-
- shm = dconf_shm_open (source->name);
-
- if (shm == NULL)
- return FALSE;
source->bus_type = G_BUS_TYPE_SESSION;
source->bus_name = g_strdup ("ca.desrt.dconf");
source->object_path = g_strdup_printf ("/ca/desrt/dconf/Writer/%s", source->name);
source->writable = TRUE;
- user_source->shm = shm;
+ user_source->shm = dconf_shm_open (source->name);
source->values = dconf_engine_source_user_open_gvdb (source->name);
@@ -77,7 +71,7 @@ dconf_engine_source_user_needs_reopen (DConfEngineSource *source)
{
DConfEngineSourceUser *user_source = (DConfEngineSourceUser *) source;
- return user_source->shm && *user_source->shm;
+ return dconf_shm_is_flagged (user_source->shm);
}
static GvdbTable *
@@ -88,10 +82,7 @@ dconf_engine_source_user_reopen (DConfEngineSource *source)
dconf_shm_close (user_source->shm);
user_source->shm = dconf_shm_open (source->name);
- if (user_source->shm)
- return dconf_engine_source_user_open_gvdb (source->name);
-
- return NULL;
+ return dconf_engine_source_user_open_gvdb (source->name);
}
static void