support of fahrenheit option
[psensor.git] / src / cfg.c
index 606ecc4..99181ee 100644 (file)
--- a/src/cfg.c
+++ b/src/cfg.c
@@ -71,6 +71,9 @@
 #define KEY_INTERFACE_WINDOW_DIVIDER_POS \
 "/apps/psensor/interface/window_divider_pos"
 
+#define KEY_INTERFACE_TEMPERATURE_UNIT \
+"/apps/psensor/interface/temperature_unit"
+
 GConfClient *client;
 
 static char *get_string(char *key, char *default_value)
@@ -145,7 +148,6 @@ static double config_get_graph_background_alpha()
        double a = gconf_client_get_float(client,
                                          KEY_GRAPH_BACKGROUND_ALPHA,
                                          NULL);
-
        if (a == 0)
                gconf_client_set_float(client,
                                       KEY_GRAPH_BACKGROUND_ALPHA, 1.0, NULL);
@@ -491,6 +493,9 @@ struct config *config_load()
                c->window_h = 200;
        }
 
+       c->temperature_unit = gconf_client_get_int
+               (client, KEY_INTERFACE_TEMPERATURE_UNIT, NULL);
+
        return c;
 }
 
@@ -553,4 +558,10 @@ void config_save(struct config *c)
                             KEY_INTERFACE_WINDOW_DIVIDER_POS,
                             c->window_divider_pos,
                             NULL);
+
+       gconf_client_set_int(client,
+                            KEY_INTERFACE_TEMPERATURE_UNIT,
+                            c->temperature_unit,
+                            NULL);
+
 }