style
[psensor.git] / src / ui_sensorpref.c
index 01ea462..8fa4400 100644 (file)
@@ -31,7 +31,8 @@
 #endif
 
 enum {
-       COL_NAME = 0
+       COL_NAME = 0,
+       COL_SENSOR
 };
 
 struct sensor_pref {
@@ -110,14 +111,11 @@ static struct sensor_pref **sensor_pref_list_new(struct psensor **sensors,
 
 static void sensor_pref_list_free(struct sensor_pref **list)
 {
-       struct sensor_pref **cur = list;
+       struct sensor_pref **cur;
 
-       while (*cur) {
+       for (cur = list; *cur; cur++) 
                sensor_pref_free(*cur);
 
-               cur++;
-       }
-
        free(list);
 }
 
@@ -526,7 +524,10 @@ void ui_sensorpref_dialog_run(struct psensor *sensor, struct ui_psensor *ui)
        for (s_cur = ui->sensors; *s_cur; s_cur++) {
                s = *s_cur;
                gtk_list_store_append(store, &iter);
-               gtk_list_store_set(store, &iter, COL_NAME, s->name, -1);
+               gtk_list_store_set(store, &iter,
+                                  COL_NAME, s->name,
+                                  COL_SENSOR, s,
+                                  -1);
        }
 
        selection = gtk_tree_view_get_selection(w_sensors_list);