From 11754fc1183bbca571714f032ee6b42c7df9e6dd Mon Sep 17 00:00:00 2001 From: Jean-Philippe Orsini Date: Wed, 25 Apr 2012 10:30:53 +0000 Subject: [PATCH] removed config_init. config_load initializes automaticaly the gconf client --- src/cfg.c | 12 +++++++++--- src/cfg.h | 2 -- src/main.c | 2 -- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/cfg.c b/src/cfg.c index daa0a89..55a20e5 100644 --- a/src/cfg.c +++ b/src/cfg.c @@ -74,7 +74,7 @@ #define KEY_INTERFACE_TEMPERATURE_UNIT \ "/apps/psensor/interface/temperature_unit" -GConfClient *client; +static GConfClient *client; static char *get_string(char *key, char *default_value) { @@ -424,9 +424,13 @@ static void config_set_window_keep_below_enabled(int enabled) FALSE, NULL); } -void config_init() +/* + * Initializes the GConf client. + */ +static void init() { - client = gconf_client_get_default(); + if (!client) + client = gconf_client_get_default(); } void config_cleanup() @@ -441,6 +445,8 @@ struct config *config_load() { struct config *c; + init(); + c = malloc(sizeof(struct config)); c->graph_bgcolor = config_get_background_color(); diff --git a/src/cfg.h b/src/cfg.h index 11a8f6b..6013f10 100644 --- a/src/cfg.h +++ b/src/cfg.h @@ -80,8 +80,6 @@ struct config *config_load(); void config_save(struct config *); -void config_init(); - void config_cleanup(); struct color *config_get_sensor_color(char *, struct color *); diff --git a/src/main.c b/src/main.c index 6ad3547..9b6de9a 100644 --- a/src/main.c +++ b/src/main.c @@ -551,8 +551,6 @@ int main(int argc, char **argv) ui.sensors_mutex = g_mutex_new(); - config_init(); - ui.config = config_load(); psensor_init(); -- 2.7.4