[dconf/wip/reorg] DConfEngineSource: remove the external init call



commit 207918c6281deb82e65243fb33eb6ef7d4f2a59c
Author: Ryan Lortie <desrt desrt ca>
Date:   Thu Jul 12 22:56:12 2012 -0400

    DConfEngineSource: remove the external init call
    
    Always do init as part of the process of dconf_engine_source_new() to
    avoid the consumer from having to call it for themselves.

 engine/dconf-engine-source.c |    8 ++------
 engine/dconf-engine-source.h |    3 ---
 engine/dconf-engine.c        |    4 ----
 tests/engine.c               |    4 +---
 4 files changed, 3 insertions(+), 16 deletions(-)
---
diff --git a/engine/dconf-engine-source.c b/engine/dconf-engine-source.c
index 19ae851..3c1f330 100644
--- a/engine/dconf-engine-source.c
+++ b/engine/dconf-engine-source.c
@@ -58,12 +58,6 @@ dconf_engine_source_refresh (DConfEngineSource *source)
   return FALSE;
 }
 
-void
-dconf_engine_source_init (DConfEngineSource *source)
-{
-  source->vtable->init (source);
-}
-
 DConfEngineSource *
 dconf_engine_source_new (const gchar *description)
 {
@@ -90,6 +84,7 @@ dconf_engine_source_new (const gchar *description)
   source->name = strchr (description, ':');
   if (source->name)
     source->name = g_strdup (source->name + 1);
+  source->vtable->init (source);
 
   return source;
 }
@@ -102,6 +97,7 @@ dconf_engine_source_new_default (void)
   source = g_malloc0 (dconf_engine_source_user_vtable.instance_size);
   source->vtable = &dconf_engine_source_user_vtable;
   source->name = g_strdup ("user");
+  source->vtable->init (source);
 
   return source;
 }
diff --git a/engine/dconf-engine-source.h b/engine/dconf-engine-source.h
index 065be14..3828dba 100644
--- a/engine/dconf-engine-source.h
+++ b/engine/dconf-engine-source.h
@@ -64,7 +64,4 @@ DConfEngineSource *     dconf_engine_source_new                         (const g
 G_GNUC_INTERNAL
 DConfEngineSource *     dconf_engine_source_new_default                 (void);
 
-G_GNUC_INTERNAL
-void                    dconf_engine_source_init                        (DConfEngineSource  *source);
-
 #endif /* __dconf_engine_source_h__ */
diff --git a/engine/dconf-engine.c b/engine/dconf-engine.c
index e40126a..cf10f84 100644
--- a/engine/dconf-engine.c
+++ b/engine/dconf-engine.c
@@ -225,7 +225,6 @@ dconf_engine_new (gpointer       user_data,
                   GDestroyNotify free_func)
 {
   DConfEngine *engine;
-  gint i;
 
   engine = g_slice_new0 (DConfEngine);
   engine->user_data = user_data;
@@ -238,9 +237,6 @@ dconf_engine_new (gpointer       user_data,
 
   engine->sources = dconf_engine_profile_open (NULL, &engine->n_sources);
 
-  for (i = 0; i < engine->n_sources; i++)
-    dconf_engine_source_init (engine->sources[i]);
-
   g_mutex_lock (&dconf_engine_global_lock);
   dconf_engine_global_list = g_slist_prepend (dconf_engine_global_list, engine);
   g_mutex_unlock (&dconf_engine_global_lock);
diff --git a/tests/engine.c b/tests/engine.c
index 4ac0a2e..31eaab6 100644
--- a/tests/engine.c
+++ b/tests/engine.c
@@ -232,11 +232,9 @@ test_user_source (void)
   DConfMockGvdbTable *locks;
   gboolean reopened;
 
+  /* Create the source from a clean slate */
   source = dconf_engine_source_new ("user-db:user");
   g_assert (source != NULL);
-
-  /* Create the source from a clean slate */
-  dconf_engine_source_init (source);
   g_assert (source->values == NULL);
   g_assert (source->locks == NULL);
   dconf_mock_shm_assert_log ("open user;");



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]