]> saetta.ns0.it Git - libgdaexgrid/commitdiff
Wrong db column variable in ::fill_from_datamodel_with_missing_func (closes #804).
authorAndrea Zagli <andrea.zagli@email.it>
Mon, 18 Jan 2016 14:18:29 +0000 (15:18 +0100)
committerAndrea Zagli <andrea.zagli@email.it>
Mon, 18 Jan 2016 14:18:29 +0000 (15:18 +0100)
src/grid.c
tests/grid.c

index cf5635a5a941b121b4f70df9a3366d4936bd742d..7699a1feae9ff9257d461eccee639219c51015ab 100644 (file)
@@ -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;
index f1761297b159d7d0e7bc4cd94b5f67694865375d..38a3ba5786964f6625e3e7cf655ddae90e1fc229 100644 (file)
@@ -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);