X-Git-Url: http://git.wpitchoune.net/gitweb/?a=blobdiff_plain;f=src%2Fui_sensorpref.c;h=ecf265549a55afc7ad96e1f6a697ebf097ea6bbc;hb=1410f23801330c83c83caf21353860ff2bc18399;hp=0016234f63b2b5a0db0d741cea207c6caa17602a;hpb=2accfa623c9b197e872ddfeabcced4596039e29d;p=psensor.git diff --git a/src/ui_sensorpref.c b/src/ui_sensorpref.c index 0016234..ecf2655 100644 --- a/src/ui_sensorpref.c +++ b/src/ui_sensorpref.c @@ -60,7 +60,7 @@ sensor_pref_new(struct psensor *s, struct config *cfg) p->sensor = s; p->name = strdup(s->name); - p->enabled = s->enabled; + p->enabled = s->graph_enabled; p->alarm_enabled = s->alarm_enabled; p->color = color_dup(s->color); @@ -321,20 +321,17 @@ static void on_changed(GtkTreeSelection *selection, gpointer data) static void select_sensor(struct psensor *s, struct psensor **sensors, GtkTreeView *tree) { - struct psensor **s_cur = sensors; - int i = 0; - GtkTreePath *p = NULL; + struct psensor **s_cur; + int i; + GtkTreePath *p; - while (*s_cur) { + p = NULL; + for (s_cur = sensors, i = 0; *s_cur; s_cur++, i++) if (s == *s_cur) { p = gtk_tree_path_new_from_indices(i, -1); break; } - i++; - s_cur++; - } - if (p) { GtkTreeSelection *s = gtk_tree_view_get_selection(tree); @@ -355,9 +352,9 @@ static void apply_pref(struct sensor_pref *p, int pos, struct config *cfg) config_set_sensor_name(s->id, s->name); } - if (s->enabled != p->enabled) { - s->enabled = p->enabled; - config_set_sensor_enabled(s->id, s->enabled); + if (s->graph_enabled != p->enabled) { + s->graph_enabled = p->enabled; + config_set_sensor_enabled(s->id, s->graph_enabled); } if (is_temp_type(s->type) && cfg->temperature_unit == FAHRENHEIT) {