X-Git-Url: https://git.wpitchoune.net/gitweb/?p=psensor.git;a=blobdiff_plain;f=src%2Fui_appindicator.c;h=29244b568ef49031db7074cc8110b43dc2820ad0;hp=c6b3f5276fbbdf99237fe49b3931c43410b5e956;hb=77fbc451078b7c4bf9cd4884814f0f087e87dd77;hpb=4368fadfe471113e67497f9fa0f6cfc724835de5 diff --git a/src/ui_appindicator.c b/src/ui_appindicator.c index c6b3f52..29244b5 100644 --- a/src/ui_appindicator.c +++ b/src/ui_appindicator.c @@ -175,21 +175,37 @@ static GtkWidget *get_menu(struct ui_psensor *ui) void ui_appindicator_update(struct ui_psensor *ui, unsigned int attention) { AppIndicatorStatus status; - char *label; - double v; + char *label, *str, *tmp; + struct psensor **p; if (!indicator) return; status = app_indicator_get_status(indicator); - v = psensor_get_max_current_value(ui->sensors, SENSOR_TYPE_TEMP); - if (v != UNKNOWN_DBL_VALUE) { - label = psensor_value_to_str(SENSOR_TYPE_TEMP, v, 1); - app_indicator_set_label(indicator, label, NULL); - free(label); + p = ui_get_sensors_ordered_by_position(ui); + label = NULL; + while (*p) { + if (config_is_appindicator_label_enabled((*p)->id)) { + str = psensor_current_value_to_str(*p, 1); + if (label == NULL) { + label = str; + } else { + tmp = malloc(strlen(label) + + 1 + + strlen(str) + + 1); + sprintf(tmp, "%s %s", label, str); + free(label); + free(str); + label = tmp; + } + } + p++; } + app_indicator_set_label(indicator, label, NULL); + if (!attention && status == APP_INDICATOR_STATUS_ATTENTION) app_indicator_set_status(indicator, APP_INDICATOR_STATUS_ACTIVE);