[gnac/devel] Moved initialisation of gconf-client into [gs]etters



commit 17d2337304d560328077b1098fd21ee4fa63aef3
Author: Benoît Dupasquier <bdupasqu src gnome org>
Date:   Tue Sep 28 16:43:52 2010 +0100

    Moved initialisation of gconf-client into [gs]etters

 src/gnac-gconf.c |   13 ++++++++++++-
 src/gnac-gconf.h |    3 ---
 src/gnac-main.c  |    1 -
 3 files changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/src/gnac-gconf.c b/src/gnac-gconf.c
index a7c2bdc..0942923 100644
--- a/src/gnac-gconf.c
+++ b/src/gnac-gconf.c
@@ -49,7 +49,7 @@ static const gchar *gnac_gconf_paths[] = {
 GConfClient *gconf_client;        
 
 
-void
+static void
 gnac_gconf_init(void)
 {
   gconf_client = gconf_client_get_default();
@@ -80,6 +80,8 @@ gnac_gconf_get_boolean(GnacGConfParam param)
   GError *err = NULL;
   gboolean val;
 
+  if (!gconf_client) gnac_gconf_init();
+
   val = gconf_client_get_bool(gconf_client, gnac_gconf_paths[param], &err);
 
   if (err != NULL)
@@ -98,6 +100,8 @@ gnac_gconf_set_boolean(GnacGConfParam param, gboolean value)
 {
   GError *err = NULL;
 
+  if (!gconf_client) gnac_gconf_init();
+
   gconf_client_set_bool(gconf_client, gnac_gconf_paths[param], value, &err);
 
   if (err != NULL)
@@ -115,6 +119,8 @@ gnac_gconf_get_int(GnacGConfParam param)
   GError *err = NULL;
   gint val;
 
+  if (!gconf_client) gnac_gconf_init();
+
   val = gconf_client_get_int(gconf_client, gnac_gconf_paths[param], &err);
 
   if (err != NULL)
@@ -131,6 +137,8 @@ gnac_gconf_set_int(GnacGConfParam param, gint value)
 {
   GError *err = NULL;
 
+  if (!gconf_client) gnac_gconf_init();
+
   gconf_client_set_int(gconf_client, gnac_gconf_paths[param], value, &err);
   if (err != NULL)
   {
@@ -147,6 +155,8 @@ gnac_gconf_get_string(GnacGConfParam param)
   GError *err = NULL;
   gchar *val = NULL;
 
+  if (!gconf_client) gnac_gconf_init();
+
   val = gconf_client_get_string(gconf_client, gnac_gconf_paths[param], &err);
 
   if (err != NULL)
@@ -164,6 +174,7 @@ gnac_gconf_set_string(GnacGConfParam param, const gchar *value)
   GError *err = NULL;
 
   if (!value) return;
+  if (!gconf_client) gnac_gconf_init();
 
   gconf_client_set_string(gconf_client, gnac_gconf_paths[param], value, &err);
   if (err != NULL)
diff --git a/src/gnac-gconf.h b/src/gnac-gconf.h
index bbef748..d127a81 100644
--- a/src/gnac-gconf.h
+++ b/src/gnac-gconf.h
@@ -48,9 +48,6 @@ typedef enum {
 } GnacGConfParam;
 
 void
-gnac_gconf_init(void);
-
-void
 gnac_gconf_destroy(void);
 
 gboolean
diff --git a/src/gnac-main.c b/src/gnac-main.c
index 57d3e19..331b9d7 100644
--- a/src/gnac-main.c
+++ b/src/gnac-main.c
@@ -1026,7 +1026,6 @@ main(gint    argc,
   gst_pb_utils_init();
 
   gnac_ui_init();
-  gnac_gconf_init();
   gnac_profiles_init();
 
   /* Initialise converter and connect signals */



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