GtkBuilder *builder;
};
-static struct sensor_pref *sensor_pref_new(struct psensor *s,
- struct config *cfg)
+static struct sensor_pref *
+sensor_pref_new(struct psensor *s, struct config *cfg)
{
struct sensor_pref *p;
struct ui_psensor *ui = cbdata->ui;
struct sensor_pref *p;
GtkTreeView *tree;
-
+
tree = GTK_TREE_VIEW(gtk_builder_get_object(cbdata->builder,
"sensors_list"));
p = get_selected_sensor_pref(tree);
}
}
-static void apply_pref(struct sensor_pref *p, struct config *cfg)
+static void apply_pref(struct sensor_pref *p, int pos, struct config *cfg)
{
struct psensor *s;
config_set_sensor_enabled(s->id, s->enabled);
}
- if (is_temp_type(s->type)
- && cfg->temperature_unit == FAHRENHEIT) {
+ if (is_temp_type(s->type) && cfg->temperature_unit == FAHRENHEIT) {
s->alarm_high_threshold
= fahrenheit_to_celcius(p->alarm_high_threshold);
s->alarm_low_threshold
s->appindicator_enabled = p->appindicator_enabled;
config_set_appindicator_enabled(s->id, s->appindicator_enabled);
}
+
+ config_set_sensor_position(s->id, pos);
}
static void
gboolean valid;
struct sensor_pref *spref;
GtkTreeIter iter;
+ int i;
valid = gtk_tree_model_get_iter_first(model, &iter);
+ i = 0;
while (valid) {
gtk_tree_model_get(model, &iter, COL_SENSOR, &spref, -1);
- apply_pref(spref, cfg);
+ apply_pref(spref, i, cfg);
valid = gtk_tree_model_iter_next(model, &iter);
+ i++;
}
}