X-Git-Url: https://git.wpitchoune.net/gitweb/?a=blobdiff_plain;f=src%2Fui_sensorlist.c;h=b4ac650167c605642383da850c5334a196f8e5fe;hb=e57d7f801ae20f02e0cb28107a89b31fa51de1c1;hp=a29a1b6a83346de45007d987e3becb7860101c07;hpb=7cf703ceb488aaefdbf43e496e44865ead748e54;p=psensor.git diff --git a/src/ui_sensorlist.c b/src/ui_sensorlist.c index a29a1b6..b4ac650 100644 --- a/src/ui_sensorlist.c +++ b/src/ui_sensorlist.c @@ -1,23 +1,21 @@ /* - Copyright (C) 2010-2011 jeanfi@gmail.com - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA - 02110-1301 USA -*/ - - + * Copyright (C) 2010-2012 jeanfi@gmail.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301 USA + */ #include #include @@ -58,32 +56,36 @@ static int col_index_to_col(int idx) void ui_sensorlist_update(struct ui_psensor *ui) { + char *str; + struct psensor *s; GtkTreeIter iter; struct ui_sensorlist *ui_sl = ui->ui_sensorlist; GtkTreeModel *model = gtk_tree_view_get_model(ui_sl->treeview); gboolean valid = gtk_tree_model_get_iter_first(model, &iter); struct psensor **sensor = ui->sensors; + int use_celcius; - while (valid && *sensor) { - struct psensor *s = *sensor; + use_celcius = ui->config->temperature_unit == CELCIUS; - char *str; + while (valid && *sensor) { + s = *sensor; str = psensor_value_to_string(s->type, s->measures[s->values_max_length - - 1].value.d_num); + 1].value.d_num, + use_celcius); gtk_list_store_set(GTK_LIST_STORE(model), &iter, COL_TEMP, str, -1); free(str); - str = psensor_value_to_string(s->type, s->min); + str = psensor_value_to_string(s->type, s->min, use_celcius); gtk_list_store_set(GTK_LIST_STORE(model), &iter, COL_TEMP_MIN, str, -1); free(str); - str = psensor_value_to_string(s->type, s->max); + str = psensor_value_to_string(s->type, s->max, use_celcius); gtk_list_store_set(GTK_LIST_STORE(model), &iter, COL_TEMP_MAX, str, -1); free(str); @@ -313,7 +315,7 @@ static void create_widget(struct ui_psensor *ui) gtk_tree_view_insert_column_with_attributes(ui_sl->treeview, -1, - _("Current"), + _("Value"), renderer, "text", COL_TEMP, NULL);