static GtkTreeModel *gdaex_grid_get_model (GdaExGrid *grid);
static GtkTreeView *gdaex_grid_get_view (GdaExGrid *grid);
-#define GDAEX_GRID_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GDAEX_TYPE_GRID, GdaExGridPrivate))
-
typedef struct _GdaExGridPrivate GdaExGridPrivate;
struct _GdaExGridPrivate
{
gchar *app_textdomain;
};
-G_DEFINE_TYPE (GdaExGrid, gdaex_grid, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (GdaExGrid, gdaex_grid, G_TYPE_OBJECT)
#ifdef G_OS_WIN32
static HMODULE hmodule;
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (object_class, sizeof (GdaExGridPrivate));
-
object_class->set_property = gdaex_grid_set_property;
object_class->get_property = gdaex_grid_get_property;
}
static void
gdaex_grid_init (GdaExGrid *gdaex_grid)
{
- GdaExGridPrivate *priv = GDAEX_GRID_GET_PRIVATE (gdaex_grid);
+ GdaExGridPrivate *priv = gdaex_grid_get_instance_private (gdaex_grid);
priv->columns = g_ptr_array_new ();
priv->title = NULL;
GdaExGrid *gdaex_grid = GDAEX_GRID (g_object_new (gdaex_grid_get_type (), NULL));
- GdaExGridPrivate *priv = GDAEX_GRID_GET_PRIVATE (gdaex_grid);
+ GdaExGridPrivate *priv = gdaex_grid_get_instance_private (gdaex_grid);
#ifdef G_OS_WIN32
g_return_if_fail (GDAEX_IS_GRID (grid));
- priv = GDAEX_GRID_GET_PRIVATE (grid);
+ priv = gdaex_grid_get_instance_private (grid);
if (priv->app_textdomain != NULL)
{
g_return_if_fail (GDAEX_IS_GRID (grid));
- priv = GDAEX_GRID_GET_PRIVATE (grid);
+ priv = gdaex_grid_get_instance_private (grid);
if (priv->title != NULL)
{
g_return_val_if_fail (GDAEX_IS_GRID (grid), NULL);
- priv = GDAEX_GRID_GET_PRIVATE (grid);
+ priv = gdaex_grid_get_instance_private (grid);
if (priv->title != NULL)
{
g_return_if_fail (GDAEX_IS_GRID (grid));
g_return_if_fail (GDAEX_IS_GRID_COLUMN (column));
- priv = GDAEX_GRID_GET_PRIVATE (grid);
+ priv = gdaex_grid_get_instance_private (grid);
g_ptr_array_add (priv->columns, g_object_ref (column));
}
g_return_if_fail (GDAEX_IS_GRID (grid));
- priv = GDAEX_GRID_GET_PRIVATE (grid);
+ priv = gdaex_grid_get_instance_private (grid);
for (col = 0; priv->columns->len; col++)
{
g_return_val_if_fail (GDAEX_IS_GRID (grid), FALSE);
g_return_val_if_fail (GDA_IS_DATA_MODEL (dm), FALSE);
- priv = GDAEX_GRID_GET_PRIVATE (grid);
+ priv = gdaex_grid_get_instance_private (grid);
if (priv->model == NULL)
{
gdaex_grid_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
{
GdaExGrid *gdaex_grid = GDAEX_GRID (object);
- GdaExGridPrivate *priv = GDAEX_GRID_GET_PRIVATE (gdaex_grid);
+ GdaExGridPrivate *priv = gdaex_grid_get_instance_private (gdaex_grid);
switch (property_id)
{
gdaex_grid_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
{
GdaExGrid *gdaex_grid = GDAEX_GRID (object);
- GdaExGridPrivate *priv = GDAEX_GRID_GET_PRIVATE (gdaex_grid);
+ GdaExGridPrivate *priv = gdaex_grid_get_instance_private (gdaex_grid);
switch (property_id)
{
g_return_val_if_fail (GDAEX_IS_GRID (grid), NULL);
- priv = GDAEX_GRID_GET_PRIVATE (grid);
+ priv = gdaex_grid_get_instance_private (grid);
cols = priv->columns->len;
gtype = g_new0 (GType, cols);
g_return_val_if_fail (GDAEX_IS_GRID (grid), NULL);
- priv = GDAEX_GRID_GET_PRIVATE (grid);
+ priv = gdaex_grid_get_instance_private (grid);
model = gdaex_grid_get_model (grid);
view = gtk_tree_view_new_with_model (model);
gchar *_title;
- priv = GDAEX_GRID_GET_PRIVATE (user_data);
+ priv = gdaex_grid_get_instance_private (user_data);
if (priv->title != NULL)
{
GdaExGridColumn *gcolumn;
GString *gstr;
- priv = GDAEX_GRID_GET_PRIVATE (user_data);
+ priv = gdaex_grid_get_instance_private (user_data);
if (priv->columns->len)
{
if (event->type == GDK_BUTTON_PRESS && event->button == 3)
{
- priv = GDAEX_GRID_GET_PRIVATE (user_data);
+ priv = gdaex_grid_get_instance_private (user_data);
gtk_menu_popup (GTK_MENU (priv->menu), NULL, NULL, NULL, NULL,
event->button, event->time);
{
GdaExGridPrivate *priv;
- priv = GDAEX_GRID_GET_PRIVATE (user_data);
+ priv = gdaex_grid_get_instance_private (user_data);
gtk_menu_popup (GTK_MENU (priv->menu), NULL, NULL, NULL, NULL,
0, gtk_get_current_event_time ());
guint col;
GdaExGridColumn *gcolumn;
- priv = GDAEX_GRID_GET_PRIVATE (user_data);
+ priv = gdaex_grid_get_instance_private (user_data);
for (col = 0; col < priv->columns->len; col++)
{
guint col;
GdaExGridColumn *gcolumn;
- priv = GDAEX_GRID_GET_PRIVATE (user_data);
+ priv = gdaex_grid_get_instance_private (user_data);
for (col = 0; col < priv->columns->len; col++)
{
{
GdaExGridPrivate *priv;
- priv = GDAEX_GRID_GET_PRIVATE (user_data);
+ priv = gdaex_grid_get_instance_private (user_data);
GdaExGridColumn *gcolumn = g_object_get_data (G_OBJECT (checkmenuitem), "GdaExGridColumn");
/*
* gridcolumn.c
*
- * Copyright (C) 2010-2019 Andrea Zagli <azagli@libero.it>
+ * Copyright (C) 2010-2021 Andrea Zagli <azagli@libero.it>
*
* This file is part of libgdaexgrid.
*
GValue *value,
GParamSpec *pspec);
-#define GDAEX_GRID_COLUMN_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GDAEX_TYPE_GRID_COLUMN, GdaExGridColumnPrivate))
-
typedef struct _GdaExGridColumnPrivate GdaExGridColumnPrivate;
struct _GdaExGridColumnPrivate
{
GtkTreeViewColumn *vcolumn;
};
-G_DEFINE_TYPE (GdaExGridColumn, gdaex_grid_column, G_TYPE_OBJECT)
+G_DEFINE_TYPE_WITH_PRIVATE (GdaExGridColumn, gdaex_grid_column, G_TYPE_OBJECT)
static void
gdaex_grid_column_class_init (GdaExGridColumnClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- g_type_class_add_private (object_class, sizeof (GdaExGridColumnPrivate));
-
object_class->set_property = gdaex_grid_column_set_property;
object_class->get_property = gdaex_grid_column_get_property;
}
static void
gdaex_grid_column_init (GdaExGridColumn *gdaex_grid_column)
{
- GdaExGridColumnPrivate *priv = GDAEX_GRID_COLUMN_GET_PRIVATE (gdaex_grid_column);
+ GdaExGridColumnPrivate *priv = gdaex_grid_column_get_instance_private (gdaex_grid_column);
priv->title = NULL;
priv->field_name = NULL;
{
GdaExGridColumn *gdaex_grid_column = GDAEX_GRID_COLUMN (g_object_new (gdaex_grid_column_get_type (), NULL));
- GdaExGridColumnPrivate *priv = GDAEX_GRID_COLUMN_GET_PRIVATE (gdaex_grid_column);
+ GdaExGridColumnPrivate *priv = gdaex_grid_column_get_instance_private (gdaex_grid_column);
gdaex_grid_column_set_title (gdaex_grid_column, title);
gdaex_grid_column_set_field_name (gdaex_grid_column, field_name);
{
g_return_if_fail (GDAEX_IS_GRID_COLUMN (column));
- GdaExGridColumnPrivate *priv = GDAEX_GRID_COLUMN_GET_PRIVATE (column);
+ GdaExGridColumnPrivate *priv = gdaex_grid_column_get_instance_private (column);
g_free (priv->title);
priv->title = g_strdup (title);
{
g_return_val_if_fail (GDAEX_IS_GRID_COLUMN (column), NULL);
- GdaExGridColumnPrivate *priv = GDAEX_GRID_COLUMN_GET_PRIVATE (column);
+ GdaExGridColumnPrivate *priv = gdaex_grid_column_get_instance_private (column);
return (const gchar *)g_strdup (priv->title);
}
{
g_return_if_fail (GDAEX_IS_GRID_COLUMN (column));
- GdaExGridColumnPrivate *priv = GDAEX_GRID_COLUMN_GET_PRIVATE (column);
+ GdaExGridColumnPrivate *priv = gdaex_grid_column_get_instance_private (column);
g_free (priv->field_name);
priv->field_name = g_strdup (field_name);
{
g_return_val_if_fail (GDAEX_IS_GRID_COLUMN (column), NULL);
- GdaExGridColumnPrivate *priv = GDAEX_GRID_COLUMN_GET_PRIVATE (column);
+ GdaExGridColumnPrivate *priv = gdaex_grid_column_get_instance_private (column);
return (const gchar *)g_strdup (priv->field_name);
}
{
g_return_if_fail (GDAEX_IS_GRID_COLUMN (column));
- GdaExGridColumnPrivate *priv = GDAEX_GRID_COLUMN_GET_PRIVATE (column);
+ GdaExGridColumnPrivate *priv = gdaex_grid_column_get_instance_private (column);
priv->type = type;
}
{
g_return_val_if_fail (GDAEX_IS_GRID_COLUMN (column), G_TYPE_NONE);
- GdaExGridColumnPrivate *priv = GDAEX_GRID_COLUMN_GET_PRIVATE (column);
+ GdaExGridColumnPrivate *priv = gdaex_grid_column_get_instance_private (column);
return priv->type;
}
{
g_return_if_fail (GDAEX_IS_GRID_COLUMN (column));
- GdaExGridColumnPrivate *priv = GDAEX_GRID_COLUMN_GET_PRIVATE (column);
+ GdaExGridColumnPrivate *priv = gdaex_grid_column_get_instance_private (column);
if (!priv->viewable)
{
{
g_return_val_if_fail (GDAEX_IS_GRID_COLUMN (column), FALSE);
- GdaExGridColumnPrivate *priv = GDAEX_GRID_COLUMN_GET_PRIVATE (column);
+ GdaExGridColumnPrivate *priv = gdaex_grid_column_get_instance_private (column);
return priv->visible;
}
{
g_return_if_fail (GDAEX_IS_GRID_COLUMN (column));
- GdaExGridColumnPrivate *priv = GDAEX_GRID_COLUMN_GET_PRIVATE (column);
+ GdaExGridColumnPrivate *priv = gdaex_grid_column_get_instance_private (column);
if (!viewable)
{
{
g_return_val_if_fail (GDAEX_IS_GRID_COLUMN (column), FALSE);
- GdaExGridColumnPrivate *priv = GDAEX_GRID_COLUMN_GET_PRIVATE (column);
+ GdaExGridColumnPrivate *priv = gdaex_grid_column_get_instance_private (column);
return priv->viewable;
}
{
g_return_if_fail (GDAEX_IS_GRID_COLUMN (column));
- GdaExGridColumnPrivate *priv = GDAEX_GRID_COLUMN_GET_PRIVATE (column);
+ GdaExGridColumnPrivate *priv = gdaex_grid_column_get_instance_private (column);
priv->resizable = resizable;
{
g_return_val_if_fail (GDAEX_IS_GRID_COLUMN (column), FALSE);
- GdaExGridColumnPrivate *priv = GDAEX_GRID_COLUMN_GET_PRIVATE (column);
+ GdaExGridColumnPrivate *priv = gdaex_grid_column_get_instance_private (column);
return priv->resizable;
}
{
g_return_if_fail (GDAEX_IS_GRID_COLUMN (column));
- GdaExGridColumnPrivate *priv = GDAEX_GRID_COLUMN_GET_PRIVATE (column);
+ GdaExGridColumnPrivate *priv = gdaex_grid_column_get_instance_private (column);
priv->sortable = sortable;
{
g_return_val_if_fail (GDAEX_IS_GRID_COLUMN (column), FALSE);
- GdaExGridColumnPrivate *priv = GDAEX_GRID_COLUMN_GET_PRIVATE (column);
+ GdaExGridColumnPrivate *priv = gdaex_grid_column_get_instance_private (column);
return priv->sortable;
}
{
g_return_if_fail (GDAEX_IS_GRID_COLUMN (column));
- GdaExGridColumnPrivate *priv = GDAEX_GRID_COLUMN_GET_PRIVATE (column);
+ GdaExGridColumnPrivate *priv = gdaex_grid_column_get_instance_private (column);
priv->reorderable = reorderable;
{
g_return_val_if_fail (GDAEX_IS_GRID_COLUMN (column), FALSE);
- GdaExGridColumnPrivate *priv = GDAEX_GRID_COLUMN_GET_PRIVATE (column);
+ GdaExGridColumnPrivate *priv = gdaex_grid_column_get_instance_private (column);
return priv->reorderable;
}
{
g_return_if_fail (GDAEX_IS_GRID_COLUMN (column));
- GdaExGridColumnPrivate *priv = GDAEX_GRID_COLUMN_GET_PRIVATE (column);
+ GdaExGridColumnPrivate *priv = gdaex_grid_column_get_instance_private (column);
priv->decimals = decimals;
}
{
g_return_val_if_fail (GDAEX_IS_GRID_COLUMN (column), FALSE);
- GdaExGridColumnPrivate *priv = GDAEX_GRID_COLUMN_GET_PRIVATE (column);
+ GdaExGridColumnPrivate *priv = gdaex_grid_column_get_instance_private (column);
return priv->decimals;
}
g_return_val_if_fail (GDAEX_IS_GRID_COLUMN (column), NULL);
- priv = GDAEX_GRID_COLUMN_GET_PRIVATE (column);
+ priv = gdaex_grid_column_get_instance_private (column);
renderer = NULL;
if (priv->type == G_TYPE_STRING
gdaex_grid_column_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
{
GdaExGridColumn *gdaex_grid_column = GDAEX_GRID_COLUMN (object);
- GdaExGridColumnPrivate *priv = GDAEX_GRID_COLUMN_GET_PRIVATE (gdaex_grid_column);
+ GdaExGridColumnPrivate *priv = gdaex_grid_column_get_instance_private (gdaex_grid_column);
switch (property_id)
{
gdaex_grid_column_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
{
GdaExGridColumn *gdaex_grid_column = GDAEX_GRID_COLUMN (object);
- GdaExGridColumnPrivate *priv = GDAEX_GRID_COLUMN_GET_PRIVATE (gdaex_grid_column);
+ GdaExGridColumnPrivate *priv = gdaex_grid_column_get_instance_private (gdaex_grid_column);
switch (property_id)
{