diff options
Diffstat (limited to 'engine')
-rw-r--r-- | engine/dconf-changeset-list.h | 38 | ||||
-rw-r--r-- | engine/dconf-engine.c | 24 | ||||
-rw-r--r-- | engine/dconf-engine.h | 9 |
3 files changed, 28 insertions, 43 deletions
diff --git a/engine/dconf-changeset-list.h b/engine/dconf-changeset-list.h deleted file mode 100644 index 68963b0..0000000 --- a/engine/dconf-changeset-list.h +++ /dev/null @@ -1,38 +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 __dconf_changeset_list_h__ -#define __dconf_changeset_list_h__ - -#include "../common/dconf-changeset.h" - -typedef struct _DConfChangesetList DConfChangesetList; - -struct _DConfChangesetList -{ - GQueue queue; -}; - -DConfChangeset * dconf_changeset_list_new (void); - -void dconf_changeset_list_free (DConfChangesetList *changeset_list); - -#endif /* __dconf_changeset_list_h__ */ diff --git a/engine/dconf-engine.c b/engine/dconf-engine.c index 89a0c67..71c3038 100644 --- a/engine/dconf-engine.c +++ b/engine/dconf-engine.c @@ -295,7 +295,7 @@ dconf_engine_unref (DConfEngine *engine) goto again; } -static DConfEngine * +DConfEngine * dconf_engine_ref (DConfEngine *engine) { g_atomic_int_inc (&engine->ref_count); @@ -360,6 +360,24 @@ dconf_engine_is_writable (DConfEngine *engine, return writable; } +gboolean +dconf_engine_is_set (DConfEngine *engine, + const gchar *key) +{ + gboolean set; + + dconf_engine_acquire_sources (engine); + + set = engine->n_sources > 0 && + engine->sources[0]->writable && + engine->sources[0]->values && + gvdb_table_has_value (engine->sources[0]->values, key); + + dconf_engine_release_sources (engine); + + return set; +} + static gboolean dconf_engine_find_key_in_queue (GQueue *queue, const gchar *key, @@ -377,7 +395,7 @@ dconf_engine_find_key_in_queue (GQueue *queue, GVariant * dconf_engine_read (DConfEngine *engine, - DConfChangesetList *read_through, + GQueue *read_through, const gchar *key) { GVariant *value = NULL; @@ -500,7 +518,7 @@ dconf_engine_read (DConfEngine *engine, /* Step 2. Check read_through. */ if (read_through) - found_key = dconf_engine_find_key_in_queue (&read_through->queue, key, &value); + found_key = dconf_engine_find_key_in_queue (read_through, key, &value); /* Step 3. Check queued changes if we didn't find it in read_through. * diff --git a/engine/dconf-engine.h b/engine/dconf-engine.h index 3c65e87..f437e37 100644 --- a/engine/dconf-engine.h +++ b/engine/dconf-engine.h @@ -22,7 +22,7 @@ #ifndef __dconf_engine_h__ #define __dconf_engine_h__ -#include "dconf-changeset-list.h" +#include "../common/dconf-changeset.h" #include <gio/gio.h> @@ -109,6 +109,8 @@ DConfEngine * dconf_engine_new (gpointe GDestroyNotify free_func); G_GNUC_INTERNAL +DConfEngine * dconf_engine_ref (DConfEngine *engine); +G_GNUC_INTERNAL void dconf_engine_unref (DConfEngine *engine); /* Read API: always handled immediately */ @@ -116,12 +118,15 @@ G_GNUC_INTERNAL guint64 dconf_engine_get_state (DConfEngine *engine); G_GNUC_INTERNAL +gboolean dconf_engine_is_set (DConfEngine *engine, + const gchar *key); +G_GNUC_INTERNAL gboolean dconf_engine_is_writable (DConfEngine *engine, const gchar *key); G_GNUC_INTERNAL GVariant * dconf_engine_read (DConfEngine *engine, - DConfChangesetList *read_through, + GQueue *read_through, const gchar *key); G_GNUC_INTERNAL |