]> saetta.ns0.it Git - libgdaex/commitdiff
Added GdaExGridColumn::get_gtype and GdaExGridColumn::set_gtype.
authorAndrea Zagli <azagli@libero.it>
Mon, 27 Dec 2010 16:51:02 +0000 (17:51 +0100)
committerAndrea Zagli <azagli@libero.it>
Mon, 27 Dec 2010 16:51:02 +0000 (17:51 +0100)
Bugfix.

src/grid.c
src/gridcolumn.c
src/gridcolumn.h

index b196ce4c53bb1d6b2a315d0eeed6ac69e39d46f3..56e6b2c8955c28648646ca878bf44d8a5265987e 100644 (file)
@@ -91,12 +91,18 @@ gdaex_grid_add_column (GdaExGrid *grid, GdaExGridColumn *column)
 {
        GdaExGridPrivate *priv;
 
+       _Column *col;
+
        g_return_if_fail (GDAEX_IS_GRID (grid));
        g_return_if_fail (GDAEX_IS_GRID_COLUMN (column));
 
        priv = GDAEX_GRID_GET_PRIVATE (grid);
 
-       g_ptr_array_add (priv->columns, g_memdup (column, sizeof (GdaExGridColumn)));
+       col = g_new0 (_Column, 1);
+       col->view_col = NULL;
+       col->grid_col = g_memdup (column, sizeof (GdaExGridColumn));
+
+       g_ptr_array_add (priv->columns, col);
 }
 
 void
index b3a76382a62010e78b7c794a554da24370faa7e4..d280f0895aa0fae827a988b6a836086a5352562c 100644 (file)
@@ -46,6 +46,7 @@ struct _GdaExGridColumnPrivate
        {
                gchar *title;
                gchar *field_name;
+               GType type;
                gboolean visible;
                gboolean resizable;
                gboolean sortable;
@@ -72,6 +73,7 @@ gdaex_grid_column_init (GdaExGridColumn *gdaex_grid_column)
 
        priv->title = NULL;
        priv->field_name = NULL;
+       priv->type = G_TYPE_NONE;
        priv->visible = FALSE;
        priv->resizable = FALSE;
        priv->sortable = FALSE;
@@ -81,6 +83,7 @@ gdaex_grid_column_init (GdaExGridColumn *gdaex_grid_column)
 GdaExGridColumn
 *gdaex_grid_column_new (const gchar *title,
                         const gchar *field_name,
+                        GType type,
                         gboolean visible,
                         gboolean resizable,
                         gboolean sortable,
@@ -92,6 +95,7 @@ GdaExGridColumn
 
        gdaex_grid_column_set_title (gdaex_grid_column, title);
        gdaex_grid_column_set_field_name (gdaex_grid_column, field_name);
+       gdaex_grid_column_set_gtype (gdaex_grid_column, type);
        gdaex_grid_column_set_visible (gdaex_grid_column, visible);
        gdaex_grid_column_set_resizable (gdaex_grid_column, resizable);
        gdaex_grid_column_set_sortable (gdaex_grid_column, sortable);
@@ -142,6 +146,26 @@ const gchar
        return (const gchar *)g_strdup (priv->field_name);
 }
 
+void
+gdaex_grid_column_set_gtype (GdaExGridColumn *column, GType type)
+{
+       g_return_if_fail (GDAEX_IS_GRID_COLUMN (column));
+
+       GdaExGridColumnPrivate *priv = GDAEX_GRID_COLUMN_GET_PRIVATE (column);
+
+       priv->type = type;
+}
+
+GType
+gdaex_grid_column_get_gtype (GdaExGridColumn *column)
+{
+       g_return_val_if_fail (GDAEX_IS_GRID_COLUMN (column), G_TYPE_NONE);
+
+       GdaExGridColumnPrivate *priv = GDAEX_GRID_COLUMN_GET_PRIVATE (column);
+
+       return priv->type;
+}
+
 void
 gdaex_grid_column_set_visible (GdaExGridColumn *column, gboolean visible)
 {
index 9ecbbbeea7419973c2693380cb4ae1b533b5eb20..bfba21049622120014f2e4b3f2b76900b0035b0d 100644 (file)
@@ -56,6 +56,7 @@ GType gdaex_grid_column_get_type (void) G_GNUC_CONST;
 
 GdaExGridColumn *gdaex_grid_column_new (const gchar *title,
                                         const gchar *field_name,
+                                        GType type,
                                         gboolean visible,
                                         gboolean resizable,
                                         gboolean sortable,
@@ -67,6 +68,9 @@ const gchar *gdaex_grid_column_get_title (GdaExGridColumn *column);
 void gdaex_grid_column_set_field_name (GdaExGridColumn *column, const gchar *field_name);
 const gchar *gdaex_grid_column_get_field_name (GdaExGridColumn *column);
 
+void gdaex_grid_column_set_gtype (GdaExGridColumn *column, GType type);
+GType gdaex_grid_column_get_gtype (GdaExGridColumn *column);
+
 void gdaex_grid_column_set_visible (GdaExGridColumn *column, gboolean visible);
 gboolean gdaex_grid_column_get_visible (GdaExGridColumn *column);