static GtkLabel *w_sensor_id;
static GtkLabel *w_sensor_type;
static GtkLabel *w_sensor_chipname;
+static GtkLabel *w_sensor_min;
+static GtkLabel *w_sensor_max;
static GtkLabel *w_sensor_low_threshold_unit;
static GtkLabel *w_sensor_high_threshold_unit;
static GtkEntry *w_sensor_name;
int use_celsius, threshold;
GdkRGBA *color;
const char *chip;
+ char *smin, *smax;
if (!s)
return;
chip = _("Unknown");
gtk_label_set_text(w_sensor_chipname, chip);
+ use_celsius = config_get_sensor_unit() == CELSIUS ? 1 : 0;
+
+ if (s->min == UNKNOWN_DBL_VALUE)
+ smin = strdup(_("Unknown"));
+ else
+ smin = psensor_value_to_str(s->type, s->min, use_celsius);
+
+ gtk_label_set_text(w_sensor_min, smin);
+ free(smin);
+
+ if (s->max == UNKNOWN_DBL_VALUE)
+ smax = strdup(_("Unknown"));
+ else
+ smax = psensor_value_to_str(s->type, s->max, use_celsius);
+ gtk_label_set_text(w_sensor_max, smax);
+ free(smax);
+
gtk_toggle_button_set_active(w_sensor_draw,
config_is_sensor_graph_enabled(s->id));
gtk_color_chooser_set_rgba(GTK_COLOR_CHOOSER(w_sensor_color), color);
gdk_rgba_free(color);
- use_celsius = config_get_sensor_unit() == CELSIUS ? 1 : 0;
gtk_label_set_text(w_sensor_high_threshold_unit,
psensor_type_to_unit_str(s->type, use_celsius));
gtk_label_set_text(w_sensor_low_threshold_unit,
gtk_toggle_button_set_active(w_sensor_alarm,
config_get_sensor_alarm_enabled(s->id));
- threshold = config_get_sensor_alarm_high_threshold(s->id);
+ threshold = s->alarm_high_threshold;
if (!use_celsius)
threshold = celsius_to_fahrenheit(threshold);
gtk_spin_button_set_value(w_sensor_high_threshold, threshold);
- threshold = config_get_sensor_alarm_low_threshold(s->id);
+ threshold = s->alarm_low_threshold;
if (!use_celsius)
threshold = celsius_to_fahrenheit(threshold);
gtk_spin_button_set_value(w_sensor_low_threshold, threshold);
}
}
-static gboolean
-on_delete_event_cb(GtkWidget *widget, GdkEvent *event, gpointer data)
+static void quit(void)
{
gtk_widget_destroy(GTK_WIDGET(w_dialog));
w_dialog = NULL;
+}
+
+static gboolean
+on_delete_event_cb(GtkWidget *widget, GdkEvent *event, gpointer data)
+{
+ quit();
return TRUE;
}
+void ui_sensorpref_close_clicked_cb(GtkButton *btn, gpointer data)
+{
+ quit();
+}
+
static GtkBuilder *load_ui(struct ui_psensor *ui)
{
GtkBuilder *builder;
(gtk_builder_get_object(builder, "sensor_name"));
w_sensor_chipname = GTK_LABEL
(gtk_builder_get_object(builder, "chip_name"));
+ w_sensor_min = GTK_LABEL
+ (gtk_builder_get_object(builder, "sensor_min"));
+ w_sensor_max = GTK_LABEL
+ (gtk_builder_get_object(builder, "sensor_max"));
w_sensor_draw = GTK_TOGGLE_BUTTON
(gtk_builder_get_object(builder, "sensor_draw"));
w_sensor_display = GTK_TOGGLE_BUTTON