projects
/
psensor.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6cec5b4
)
fixed fct when the list of sensors has been reordered
author
Jean-Philippe Orsini
<jeanfi@gmail.com>
Mon, 1 Apr 2013 08:58:40 +0000
(08:58 +0000)
committer
Jean-Philippe Orsini
<jeanfi@gmail.com>
Mon, 1 Apr 2013 08:58:40 +0000
(08:58 +0000)
src/ui_sensorlist.c
patch
|
blob
|
history
diff --git
a/src/ui_sensorlist.c
b/src/ui_sensorlist.c
index
1daba90
..
d606525
100644
(file)
--- a/
src/ui_sensorlist.c
+++ b/
src/ui_sensorlist.c
@@
-114,16
+114,21
@@
void ui_sensorlist_update(struct ui_psensor *ui, bool complete)
* <null> if none.
*/
static struct psensor *
* <null> if none.
*/
static struct psensor *
-get_sensor_at_pos(GtkTreeView *view, int x, int y, struct
psensor **sensors
)
+get_sensor_at_pos(GtkTreeView *view, int x, int y, struct
ui_psensor *ui
)
{
GtkTreePath *path;
{
GtkTreePath *path;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+ struct psensor *s;
gtk_tree_view_get_path_at_pos(view, x, y, &path, NULL, NULL, NULL);
gtk_tree_view_get_path_at_pos(view, x, y, &path, NULL, NULL, NULL);
+ model = gtk_tree_view_get_model(ui->sensors_tree);
if (path) {
if (path) {
- gint *i = gtk_tree_path_get_indices(path);
- if (i)
- return *(sensors + *i);
+ if (gtk_tree_model_get_iter(model, &iter, path)) {
+ gtk_tree_model_get(model, &iter, COL_SENSOR, &s, -1);
+ return s;
+ }
}
return NULL;
}
}
return NULL;
}
@@
-209,7
+214,7
@@
static int on_clicked(GtkWidget *widget, GdkEventButton *event, gpointer data)
struct psensor *sensor = get_sensor_at_pos(view,
event->x,
event->y,
struct psensor *sensor = get_sensor_at_pos(view,
event->x,
event->y,
- ui
->sensors
);
+ ui);
if (sensor) {
int coli = col_index_to_col(get_col_index_at_pos(view,
if (sensor) {
int coli = col_index_to_col(get_col_index_at_pos(view,