From: Jean-Philippe Orsini Date: Wed, 3 Apr 2013 06:35:15 +0000 (+0000) Subject: style X-Git-Tag: v0.8.0.5~95 X-Git-Url: http://git.wpitchoune.net/gitweb/?p=psensor.git;a=commitdiff_plain;h=920b0beeceeb7bc3892d15796956b9c6fe3824a0 style --- diff --git a/src/main.c b/src/main.c index 67c1d6a..627043c 100644 --- a/src/main.c +++ b/src/main.c @@ -259,22 +259,17 @@ static void associate_colors(struct psensor **sensors) {0x0000, 0x0000, 0x7fff}, /* dark blue */ {0x0000, 0x7fff, 0x0000} /* dark green */ }; + struct psensor **cur; + int i; + struct color c; - struct psensor **sensor_cur = sensors; - int i = 0; - while (*sensor_cur) { - struct color default_color; - color_set(&default_color, + for (cur = sensors, i = 0; *cur; cur++) { + color_set(&c, colors[i % COLORS_COUNT][0], colors[i % COLORS_COUNT][1], colors[i % COLORS_COUNT][2]); - (*sensor_cur)->color - = config_get_sensor_color((*sensor_cur)->id, - &default_color); - - sensor_cur++; - i++; + (*cur)->color = config_get_sensor_color((*cur)->id, &c); } } diff --git a/src/ui_sensorpref.c b/src/ui_sensorpref.c index 0016234..1b7ee16 100644 --- a/src/ui_sensorpref.c +++ b/src/ui_sensorpref.c @@ -321,20 +321,17 @@ static void on_changed(GtkTreeSelection *selection, gpointer data) static void select_sensor(struct psensor *s, struct psensor **sensors, GtkTreeView *tree) { - struct psensor **s_cur = sensors; - int i = 0; - GtkTreePath *p = NULL; + struct psensor **s_cur; + int i; + GtkTreePath *p; - while (*s_cur) { + p = NULL; + for (s_cur = sensors, i = 0; *s_cur; s_cur++, i++) if (s == *s_cur) { p = gtk_tree_path_new_from_indices(i, -1); break; } - i++; - s_cur++; - } - if (p) { GtkTreeSelection *s = gtk_tree_view_get_selection(tree);