GtkTreeModel *store,
const gchar *sql,
guint *cols_formatted,
- gchar *(*cols_format_func) (GdaDataModelIter *, guint),
+ GdaExColsFormatFunc format_func,
GdaExFillTreeModelMissingFunc missing_func, gpointer user_data)
{
GdaDataModel *dm;
dm = gdaex_query (gdaex, _sql);
g_free (_sql);
- gdaex_fill_treemodel_from_datamodel_with_missing_func (gdaex, store, dm, cols_formatted, cols_format_func, missing_func, user_data);
+ gdaex_fill_treemodel_from_datamodel_with_missing_func (gdaex, store, dm, cols_formatted, format_func, missing_func, user_data);
g_object_unref (dm);
}
GtkTreeModel *store,
GdaDataModel *dm,
guint *cols_formatted,
- gchar *(*cols_format_func) (GdaDataModelIter *, guint),
+ GdaExColsFormatFunc format_func,
GdaExFillTreeModelMissingFunc missing_func, gpointer user_data)
{
GtkTreeIter iter;
}
else
{
- switch (gcol_gtypes[col])
+ gchar *formatted;
+
+ formatted = NULL;
+
+ if (format_func != NULL)
{
- case G_TYPE_STRING:
- g_value_set_string (&gval, gdaex_data_model_iter_get_value_stringify_at (gda_iter, col));
- break;
-
- case G_TYPE_BOOLEAN:
- g_value_set_string (&gval, gdaex_data_model_iter_get_value_boolean_at (gda_iter, col) ? "X" : "");
- break;
-
- case G_TYPE_INT:
- ival = gdaex_data_model_iter_get_value_integer_at (gda_iter, col);
- g_value_set_string (&gval, gdaex_format_money ((gdouble)ival, 0, FALSE));
- break;
-
- case G_TYPE_FLOAT:
- case G_TYPE_DOUBLE:
- dval = gdaex_data_model_iter_get_value_double_at (gda_iter, col);
- g_value_set_string (&gval, gdaex_format_money (dval, -1, FALSE));
- break;
-
- default:
- if (cols_format_func != NULL)
- {
- g_value_set_string (&gval, (*cols_format_func) (gda_iter, col));
- }
- else if (gcol_gtypes[col] == G_TYPE_DATE
- || gcol_gtypes[col] == GDA_TYPE_TIMESTAMP
- || gcol_gtypes[col] == G_TYPE_DATE_TIME)
- {
- gdatetime = gdaex_data_model_iter_get_value_gdatetime_at (gda_iter, col);
- /* TODO find default format from locale */
- g_value_set_string (&gval, g_date_time_format (gdatetime, gcol_gtypes[col] == G_TYPE_DATE ? "%d/%m/%Y" : "%d/%m/%Y %H.%M.%S"));
- }
- else
+ formatted = (*format_func) (gda_iter, col, user_data);
+ if (formatted != NULL)
+ {
+ g_value_set_string (&gval, formatted);
+ }
+ }
+
+ if (formatted == NULL)
+ {
+ switch (gcol_gtypes[col])
+ {
+ case G_TYPE_STRING:
+ g_value_set_string (&gval, gdaex_data_model_iter_get_value_stringify_at (gda_iter, col));
+ break;
+
+ case G_TYPE_BOOLEAN:
+ g_value_set_string (&gval, gdaex_data_model_iter_get_value_boolean_at (gda_iter, col) ? "X" : "");
+ break;
+
+ case G_TYPE_INT:
+ ival = gdaex_data_model_iter_get_value_integer_at (gda_iter, col);
+ g_value_set_string (&gval, gdaex_format_money ((gdouble)ival, 0, FALSE));
+ break;
+
+ case G_TYPE_FLOAT:
+ case G_TYPE_DOUBLE:
+ dval = gdaex_data_model_iter_get_value_double_at (gda_iter, col);
+ g_value_set_string (&gval, gdaex_format_money (dval, -1, FALSE));
+ break;
+
+ default:
{
- g_value_set_string (&gval, gda_value_stringify (gda_data_model_iter_get_value_at (gda_iter, col)));
+ if (gcol_gtypes[col] == G_TYPE_DATE
+ || gcol_gtypes[col] == GDA_TYPE_TIMESTAMP
+ || gcol_gtypes[col] == G_TYPE_DATE_TIME)
+ {
+ gdatetime = gdaex_data_model_iter_get_value_gdatetime_at (gda_iter, col);
+ /* TODO find default format from locale */
+ g_value_set_string (&gval, g_date_time_format (gdatetime, gcol_gtypes[col] == G_TYPE_DATE ? "%d/%m/%Y" : "%d/%m/%Y %H.%M.%S"));
+ }
+ else
+ {
+ g_value_set_string (&gval, gda_value_stringify (gda_data_model_iter_get_value_at (gda_iter, col)));
+ }
+ break;
}
- break;
+ }
}
}
GtkTreeModel *store,
const gchar *sql,
guint *cols_formatted,
- gchar *(*cols_format_func) (GdaDataModelIter *, guint))
+ GdaExColsFormatFunc format_func)
{
- gdaex_fill_treemodel_from_sql_with_missing_func (gdaex, store, sql, cols_formatted, cols_format_func, NULL, NULL);
+ gdaex_fill_treemodel_from_sql_with_missing_func (gdaex, store, sql, cols_formatted, format_func, NULL, NULL);
}
void
GtkTreeModel *store,
GdaDataModel *dm,
guint *cols_formatted,
- gchar *(*cols_format_func) (GdaDataModelIter *, guint))
+ GdaExColsFormatFunc format_func)
{
- gdaex_fill_treemodel_from_datamodel_with_missing_func (gdaex, store, dm, cols_formatted, cols_format_func, NULL, NULL);
+ gdaex_fill_treemodel_from_datamodel_with_missing_func (gdaex, store, dm, cols_formatted, format_func, NULL, NULL);
}
G_DEPRECATED_FOR (gdaex_fill_treemodel_from_sql_with_missing_func)
GtkListStore *lstore,
const gchar *sql,
guint *cols_formatted,
- gchar *(*cols_format_func) (GdaDataModelIter *, guint),
+ GdaExColsFormatFunc format_func,
GdaExFillListStoreMissingFunc missing_func, gpointer user_data)
{
GdaDataModel *dm;
dm = gdaex_query (gdaex, _sql);
g_free (_sql);
- gdaex_fill_liststore_from_datamodel_with_missing_func (gdaex, lstore, dm, cols_formatted, cols_format_func, missing_func, user_data);
+ gdaex_fill_liststore_from_datamodel_with_missing_func (gdaex, lstore, dm, cols_formatted, format_func, missing_func, user_data);
g_object_unref (dm);
}
GtkListStore *lstore,
GdaDataModel *dm,
guint *cols_formatted,
- gchar *(*cols_format_func) (GdaDataModelIter *, guint),
+ GdaExColsFormatFunc format_func,
GdaExFillListStoreMissingFunc missing_func, gpointer user_data)
{
- gdaex_fill_treemodel_from_datamodel_with_missing_func (gdaex, GTK_TREE_MODEL (lstore), dm, cols_formatted, cols_format_func, missing_func, user_data);
+ gdaex_fill_treemodel_from_datamodel_with_missing_func (gdaex, GTK_TREE_MODEL (lstore), dm, cols_formatted, format_func, missing_func, user_data);
}
G_DEPRECATED_FOR (gdaex_fill_treemodel_from_sql)
GtkListStore *lstore,
const gchar *sql,
guint *cols_formatted,
- gchar *(*cols_format_func) (GdaDataModelIter *, guint))
+ GdaExColsFormatFunc format_func)
{
- gdaex_fill_liststore_from_sql_with_missing_func (gdaex, lstore, sql, cols_formatted, cols_format_func, NULL, NULL);
+ gdaex_fill_liststore_from_sql_with_missing_func (gdaex, lstore, sql, cols_formatted, format_func, NULL, NULL);
}
G_DEPRECATED_FOR (gdaex_fill_treemodel_from_datamodel)
GtkListStore *lstore,
GdaDataModel *dm,
guint *cols_formatted,
- gchar *(*cols_format_func) (GdaDataModelIter *, guint))
+ GdaExColsFormatFunc format_func)
{
- gdaex_fill_liststore_from_datamodel_with_missing_func (gdaex, lstore, dm, cols_formatted, cols_format_func, NULL, NULL);
+ gdaex_fill_liststore_from_datamodel_with_missing_func (gdaex, lstore, dm, cols_formatted, format_func, NULL, NULL);
}
const gchar
GtkBuilder *gdaex_get_gtkbuilder (GdaEx *gdaex);
+typedef gchar *(*GdaExColsFormatFunc) (GdaDataModelIter *iter, guint col, gpointer user_data);
typedef void (*GdaExFillTreeModelMissingFunc) (GtkTreeModel *store, GtkTreeIter *iter, gpointer user_data);
void gdaex_fill_treemodel_from_sql_with_missing_func (GdaEx *gdaex,
GtkTreeModel *store,
const gchar *sql,
guint *cols_formatted,
- gchar *(*cols_format_func) (GdaDataModelIter *, guint),
+ GdaExColsFormatFunc format_func,
GdaExFillTreeModelMissingFunc missing_func, gpointer user_data);
void gdaex_fill_treemodel_from_datamodel_with_missing_func (GdaEx *gdaex,
GtkTreeModel *store,
GdaDataModel *dm,
guint *cols_formatted,
- gchar *(*cols_format_func) (GdaDataModelIter *, guint),
+ GdaExColsFormatFunc format_func,
GdaExFillTreeModelMissingFunc missing_func, gpointer user_data);
void gdaex_fill_treemodel_from_sql (GdaEx *gdaex,
GtkTreeModel *store,
const gchar *sql,
guint *cols_formatted,
- gchar *(*cols_format_func) (GdaDataModelIter *, guint));
+ GdaExColsFormatFunc format_func);
void gdaex_fill_treemodel_from_datamodel (GdaEx *gdaex,
GtkTreeModel *store,
GdaDataModel *dm,
guint *cols_formatted,
- gchar *(*cols_format_func) (GdaDataModelIter *, guint));
+ GdaExColsFormatFunc format_func);
G_DEPRECATED_FOR (GdaExFillTreeModelMissingFunc)
typedef void (*GdaExFillListStoreMissingFunc) (GtkListStore *lstore, GtkTreeIter *iter, gpointer user_data);
GtkListStore *lstore,
const gchar *sql,
guint *cols_formatted,
- gchar *(*cols_format_func) (GdaDataModelIter *, guint),
+ GdaExColsFormatFunc format_func,
GdaExFillListStoreMissingFunc missing_func, gpointer user_data);
G_DEPRECATED_FOR (gdaex_fill_treemodel_from_datamodel_with_missing_func)
GtkListStore *lstore,
GdaDataModel *dm,
guint *cols_formatted,
- gchar *(*cols_format_func) (GdaDataModelIter *, guint),
+ GdaExColsFormatFunc format_func,
GdaExFillListStoreMissingFunc missing_func, gpointer user_data);
G_DEPRECATED_FOR (gdaex_fill_treemodel_from_sql)
GtkListStore *lstore,
const gchar *sql,
guint *cols_formatted,
- gchar *(*cols_format_func) (GdaDataModelIter *, guint));
+ GdaExColsFormatFunc format_func);
G_DEPRECATED_FOR (gdaex_fill_treemodel_from_datamodel)
void gdaex_fill_liststore_from_datamodel (GdaEx *gdaex,
GtkListStore *lstore,
GdaDataModel *dm,
guint *cols_formatted,
- gchar *(*cols_format_func) (GdaDataModelIter *, guint));
+ GdaExColsFormatFunc format_func);
typedef enum
{