struct sensor_pref {
struct psensor *sensor;
char *name;
- int enabled;
+ int graph_enabled;
struct color *color;
int alarm_enabled;
int alarm_high_threshold;
int alarm_low_threshold;
unsigned int appindicator_enabled;
unsigned int appindicator_label_enabled;
+ unsigned int display_enabled;
};
struct cb_data {
p->sensor = s;
p->name = strdup(s->name);
- p->enabled = s->graph_enabled;
+ p->graph_enabled = s->graph_enabled;
p->alarm_enabled = s->alarm_enabled;
p->color = color_dup(s->color);
+ p->display_enabled = config_is_sensor_enabled(s->id);
if (cfg->temperature_unit == CELSIUS) {
p->alarm_high_threshold = s->alarm_high_threshold;
p = get_selected_sensor_pref(GTK_TREE_VIEW(data));
if (p)
- p->enabled = gtk_toggle_button_get_active(btn);
+ p->graph_enabled = gtk_toggle_button_get_active(btn);
+}
+
+void ui_sensorpref_display_toggled_cb(GtkToggleButton *btn, gpointer data)
+{
+ struct sensor_pref *p;
+
+ p = get_selected_sensor_pref(GTK_TREE_VIEW(data));
+
+ if (p)
+ p->display_enabled = gtk_toggle_button_get_active(btn);
}
void ui_sensorpref_alarm_toggled_cb(GtkToggleButton *btn, gpointer data)
*w_chipname;
GtkEntry *w_name;
GtkToggleButton *w_draw, *w_alarm, *w_appindicator_enabled,
- *w_appindicator_label_enabled;
+ *w_appindicator_label_enabled, *w_display;
GtkColorButton *w_color;
GtkSpinButton *w_high_threshold, *w_low_threshold;
GdkColor *color;
w_draw = GTK_TOGGLE_BUTTON(gtk_builder_get_object(builder,
"sensor_draw"));
- gtk_toggle_button_set_active(w_draw, p->enabled);
+ gtk_toggle_button_set_active(w_draw, p->graph_enabled);
+
+ w_display = GTK_TOGGLE_BUTTON(gtk_builder_get_object
+ (builder,
+ "sensor_enable_checkbox"));
+ gtk_toggle_button_set_active(w_display, p->display_enabled);
color = color_to_gdkcolor(p->color);
w_color = GTK_COLOR_BUTTON(gtk_builder_get_object(builder,
w_appindicator_label_enabled = GTK_TOGGLE_BUTTON
(gtk_builder_get_object(builder, "indicator_label_checkbox"));
-
if (is_temp_type(s->type) || is_fan_type(s->type)) {
gtk_toggle_button_set_active(w_alarm, p->alarm_enabled);
gtk_spin_button_set_value(w_high_threshold,
config_set_sensor_name(s->id, s->name);
}
- if (s->graph_enabled != p->enabled) {
- s->graph_enabled = p->enabled;
- config_set_sensor_enabled(s->id, s->graph_enabled);
+ if (s->graph_enabled != p->graph_enabled) {
+ s->graph_enabled = p->graph_enabled;
+ config_set_sensor_graph_enabled(s->id, s->graph_enabled);
}
if (is_temp_type(s->type) && cfg->temperature_unit == FAHRENHEIT) {
p->appindicator_label_enabled);
config_set_sensor_position(s->id, pos);
+
+ config_set_sensor_enabled(s->id, p->display_enabled);
}
static void apply_prefs(GtkTreeModel *model, struct config *cfg)
valid = gtk_tree_model_iter_next(model, &iter);
i++;
}
+ config_sync();
}
void ui_sensorpref_dialog_run(struct psensor *sensor, struct ui_psensor *ui)