c->window_h = 200;
}
- c->temperature_unit = get_int(KEY_INTERFACE_TEMPERATURE_UNIT);
-
c->sensor_values_max_length = compute_values_max_length(c);
return c;
set_int(KEY_INTERFACE_WINDOW_H, c->window_h);
set_int(KEY_INTERFACE_WINDOW_DIVIDER_POS, c->window_divider_pos);
-
- set_int(KEY_INTERFACE_TEMPERATURE_UNIT, c->temperature_unit);
}
const char *get_psensor_user_dir(void)
{
return get_int(KEY_INTERFACE_TEMPERATURE_UNIT);
}
+
+void config_set_temperature_unit(enum temperature_unit u)
+{
+ set_int(KEY_INTERFACE_TEMPERATURE_UNIT, u);
+}
int hide_on_startup;
- enum temperature_unit temperature_unit;
-
bool slog_enabled;
int slog_interval;
};
void config_set_atiadlsdk_enable(bool);
enum temperature_unit config_get_temperature_unit(void);
+void config_set_temperature_unit(enum temperature_unit);
double config_get_default_high_threshold_temperature(void);
subdir = src/glade
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \
- $(top_srcdir)/m4/iconv.m4 $(top_srcdir)/m4/lib-ld.m4 \
- $(top_srcdir)/m4/lib-link.m4 $(top_srcdir)/m4/lib-prefix.m4 \
- $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \
- $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
+GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@
GLIB_COMPILE_SCHEMAS = @GLIB_COMPILE_SCHEMAS@
GMSGFMT = @GMSGFMT@
GMSGFMT_015 = @GMSGFMT_015@
POSUB = @POSUB@
PTHREAD_LIBS = @PTHREAD_LIBS@
RANLIB = @RANLIB@
+SED = @SED@
SENSORS_LIBS = @SENSORS_LIBS@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
XEXT_LIBS = @XEXT_LIBS@
XGETTEXT = @XGETTEXT@
XGETTEXT_015 = @XGETTEXT_015@
+XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@
XMKMF = @XMKMF@
abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
<item translatable="yes">Celsius</item>
<item translatable="yes">Fahrenheit</item>
</items>
+ <signal name="changed" handler="ui_pref_temperature_unit_changed_cbk" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
double min_rpm, max_rpm, mint, maxt, min, max;
char *strmin, *strmax;
/* horizontal and vertical offset of the graph */
- int g_xoff, g_yoff, no_graphs;
+ int g_xoff, g_yoff, no_graphs, use_celsius;
cairo_surface_t *cst;
cairo_t *cr, *cr_pixmap;
char *str_btime, *str_etime;
min_rpm = get_min_rpm(enabled_sensors);
max_rpm = get_max_rpm(enabled_sensors);
+ if (config_get_temperature_unit() == CELSIUS)
+ use_celsius = 1;
+ else
+ use_celsius = 0;
+
mint = get_min_temp(enabled_sensors);
- strmin = psensor_value_to_str(SENSOR_TYPE_TEMP,
- mint,
- config->temperature_unit == CELSIUS);
+ strmin = psensor_value_to_str(SENSOR_TYPE_TEMP, mint, use_celsius);
maxt = get_max_temp(enabled_sensors);
- strmax = psensor_value_to_str(SENSOR_TYPE_TEMP,
- maxt,
- config->temperature_unit == CELSIUS);
+ strmax = psensor_value_to_str(SENSOR_TYPE_TEMP, maxt, use_celsius);
et = get_graph_end_time_s(enabled_sensors);
bt = get_graph_begin_time_s(config, et);
struct config *cfg;
gboolean ret;
struct ui_psensor *ui = (struct ui_psensor *)data;
+ int use_celsius;
ret = TRUE;
cfg = ui->config;
if (is_appindicator_supported() || is_status_supported())
indicators_update(ui);
+ if (config_get_temperature_unit() == CELSIUS)
+ use_celsius = 1;
+ else
+ use_celsius = 0;
ui_unity_launcher_entry_update(ui->sensors,
!cfg->unity_launcher_count_disabled,
- cfg->temperature_unit == CELSIUS);
+ use_celsius);
if (ui->graph_update_interval != cfg->graph_update_interval) {
ui->graph_update_interval = cfg->graph_update_interval;
const char *name;
struct psensor **sorted_sensors;
- celsius = ui->config->temperature_unit == CELSIUS;
+ if (config_get_temperature_unit() == CELSIUS)
+ celsius = 1;
+ else
+ celsius = 0;
sorted_sensors = ui_get_sensors_ordered_by_position(ui->sensors);
n = psensor_list_size(sorted_sensors);
{
char *label, *str, *tmp, *guide;
struct psensor **p;
+ int use_celsius;
p = ui_get_sensors_ordered_by_position(ui->sensors);
label = NULL;
guide = NULL;
+
+ if (config_get_temperature_unit() == CELSIUS)
+ use_celsius = 1;
+ else
+ use_celsius = 0;
+
while (*p) {
if (config_is_appindicator_label_enabled((*p)->id)) {
- str = psensor_current_value_to_str
- (*p, ui->config->temperature_unit == CELSIUS);
+ str = psensor_current_value_to_str(*p, use_celsius);
if (label == NULL) {
label = str;
app_indicator_set_status(indicator,
APP_INDICATOR_STATUS_ATTENTION);
- update_menu_items(ui->config->temperature_unit == CELSIUS);
+ if (config_get_temperature_unit() == CELSIUS)
+ update_menu_items(1);
+ else
+ update_menu_items(0);
}
static GtkStatusIcon *unity_fallback(AppIndicator *indicator)
notify_init("psensor");
if (notify_is_initted() == TRUE) {
- if (ui->config->temperature_unit == CELSIUS)
+ if (config_get_temperature_unit() == CELSIUS)
use_celsius = 1;
else
use_celsius = 0;
(!config_is_window_keep_below_enabled());
}
+void ui_pref_temperature_unit_changed_cbk(GtkComboBox *combo, gpointer data)
+{
+ config_set_temperature_unit(gtk_combo_box_get_active(combo));
+}
+
GdkRGBA color_to_GdkRGBA(struct color *color)
{
GdkRGBA c;
GtkSpinButton *w_update_interval, *w_monitoring_duration,
*w_s_update_interval, *w_slog_interval;
GtkComboBox *w_sensorlist_pos;
- GtkToggleButton
- *w_enable_menu, *w_enable_launcher_counter, *w_hide_on_startup,
- *w_win_restore, *w_slog_enabled, *w_autostart, *w_smooth_curves,
- *w_atiadlsdk, *w_lmsensors, *w_nvctrl, *w_gtop2, *w_hddtemp,
- *w_libatasmart, *w_udisks2;
+ GtkToggleButton *w_enable_menu, *w_enable_launcher_counter,
+ *w_hide_on_startup, *w_win_restore, *w_slog_enabled,
+ *w_autostart, *w_smooth_curves, *w_atiadlsdk, *w_lmsensors,
+ *w_nvctrl, *w_gtop2, *w_hddtemp, *w_libatasmart, *w_udisks2;
GtkComboBoxText *w_temp_unit;
GtkEntry *w_notif_script;
char *notif_script;
= GTK_COMBO_BOX_TEXT(gtk_builder_get_object
(builder, "temperature_unit"));
gtk_combo_box_set_active(GTK_COMBO_BOX(w_temp_unit),
- cfg->temperature_unit);
+ config_get_temperature_unit());
/* providers */
w_lmsensors
cfg->slog_interval
= gtk_spin_button_get_value_as_int(w_slog_interval);
- cfg->temperature_unit
- = gtk_combo_box_get_active(GTK_COMBO_BOX(w_temp_unit));
-
cfg->sensor_values_max_length = compute_values_max_length(cfg);
config_save(cfg);
store = ui->sensors_store;
- use_celsius = ui->config->temperature_unit == CELSIUS;
+ if (config_get_temperature_unit() == CELSIUS)
+ use_celsius = 1;
+ else
+ use_celsius = 0;
valid = gtk_tree_model_get_iter_first(model, &iter);
while (valid) {
}
}
}
+
+void ui_unity_init(void)
+{
+}
void ui_unity_launcher_entry_update(struct psensor **, unsigned int, int);
+void ui_unity_init(void);
+
#else
static inline bool ui_unity_is_supported(void) { return false; }
unsigned int show,
int use_celsius) {}
+static inline void ui_unity_init(void) {}
+
#endif
#endif