avoid configuration data in psensor struct
[psensor.git] / src / ui_sensorpref.c
index 282eed4..78fb551 100644 (file)
@@ -61,7 +61,7 @@ sensor_pref_new(struct psensor *s, struct config *cfg)
 
        p->sensor = s;
        p->name = strdup(s->name);
-       p->graph_enabled = s->graph_enabled;
+       p->graph_enabled = config_is_sensor_graph_enabled(s->id);
        p->alarm_enabled = config_get_sensor_alarm_enabled(s->id);
        p->color = color_dup(s->color);
        p->display_enabled = config_is_sensor_enabled(s->id);
@@ -366,10 +366,7 @@ static void apply_pref(struct sensor_pref *p, int pos, struct config *cfg)
                config_set_sensor_name(s->id, s->name);
        }
 
-       if (s->graph_enabled != p->graph_enabled) {
-               s->graph_enabled = p->graph_enabled;
-               config_set_sensor_graph_enabled(s->id, s->graph_enabled);
-       }
+       config_set_sensor_graph_enabled(s->id, p->graph_enabled);
 
        if (is_temp_type(s->type) && cfg->temperature_unit == FAHRENHEIT) {
                s->alarm_high_threshold