X-Git-Url: http://git.wpitchoune.net/gitweb/?p=psensor.git;a=blobdiff_plain;f=src%2Fui_appindicator.c;h=5d301bf06039f485167f88ccf5c250dcf1492d02;hp=277688276e302290c5e2817b222bcd71e26f7343;hb=51450a36b7143fe230197dfa89b5fd072af7421c;hpb=270d8e258b541a4e481c7323a2c1feb49f19dc2e diff --git a/src/ui_appindicator.c b/src/ui_appindicator.c index 2776882..5d301bf 100644 --- a/src/ui_appindicator.c +++ b/src/ui_appindicator.c @@ -96,7 +96,10 @@ create_sensor_menu_items(const struct ui_psensor *ui, GtkMenu *menu) 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); @@ -165,14 +168,20 @@ static void update_label(struct ui_psensor *ui) { 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; @@ -232,7 +241,10 @@ void ui_appindicator_update(struct ui_psensor *ui, bool attention) 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)