From: Andrea Zagli Date: Mon, 18 Jan 2016 14:18:29 +0000 (+0100) Subject: Wrong db column variable in ::fill_from_datamodel_with_missing_func (closes #804). X-Git-Tag: v0.0.1~1 X-Git-Url: https://saetta.ns0.it/gitweb?a=commitdiff_plain;h=674148bcc50f34d88ea76c291d6c6ec36be43e5a;p=libgdaexgrid Wrong db column variable in ::fill_from_datamodel_with_missing_func (closes #804). --- diff --git a/src/grid.c b/src/grid.c index cf5635a..7699a1f 100644 --- a/src/grid.c +++ b/src/grid.c @@ -400,7 +400,7 @@ gdaex_grid_fill_from_datamodel_with_missing_func (GdaExGrid *grid, switch (col_gtype) { case G_TYPE_STRING: - gda_col = gda_data_model_describe_column (dm, col); + gda_col = gda_data_model_describe_column (dm, gda_data_model_get_column_index (dm, field_name)); gda_col_gtype = gda_column_get_g_type (gda_col); switch (gda_col_gtype) @@ -602,7 +602,7 @@ gdaex_grid_get_property (GObject *object, guint property_id, GValue *value, GPar static GtkTreeModel *gdaex_grid_get_model (GdaExGrid *grid) { - /* TODO for now it returns always a GtkListStore */ + /* TODO for now it returns always a GtkTreeStore */ GdaExGridPrivate *priv; guint cols; diff --git a/tests/grid.c b/tests/grid.c index f176129..38a3ba5 100644 --- a/tests/grid.c +++ b/tests/grid.c @@ -93,6 +93,9 @@ main (int argc, char **argv) gcol = gdaex_grid_column_new_defaults ("Age", "age", G_TYPE_INT); gdaex_grid_add_column (grid, gcol); + gcol = gdaex_grid_column_new_defaults ("Missing", "missing", G_TYPE_STRING); + gdaex_grid_add_column (grid, gcol); + gcol_birthday = gdaex_grid_column_new ("Birthday", "birthday", G_TYPE_DATE, FALSE, TRUE, TRUE, TRUE, -1); gdaex_grid_add_column (grid, gcol_birthday); @@ -102,13 +105,10 @@ main (int argc, char **argv) gcol = gdaex_grid_column_new ("Married", "married", G_TYPE_BOOLEAN, TRUE, TRUE, TRUE, TRUE, -1); gdaex_grid_add_column (grid, gcol); - gcol = gdaex_grid_column_new_defaults ("Missing", "missing", G_TYPE_STRING); - gdaex_grid_add_column (grid, gcol); - wgrid = gdaex_grid_get_widget (grid); gtk_container_add (GTK_CONTAINER (scrolledw), wgrid); - gdaex_grid_fill_from_sql_with_missing_func (grid, gdaex, "SELECT * FROM clients", missing_func, NULL, NULL); + gdaex_grid_fill_from_sql_with_missing_func (grid, gdaex, "SELECT name, surname, id, birthday, married, incoming, age FROM clients", missing_func, NULL, NULL); hbtnbox = gtk_button_box_new (GTK_ORIENTATION_HORIZONTAL); gtk_box_pack_start (GTK_BOX (vbox), hbtnbox, FALSE, FALSE, 0);