Using g_value_get_*

using GValue related function is quite tricky. It is not working if you do

GdaDataModel *dm;
gint i;
i = g_value_get_int ( gda_data_model_get_value_at (dm, 0, 0));

For upcomming Version 4.0 (the main difference is at GdaDataModel API)

GdaDataModel *model;
const GValue *integer;
GError *error = NULL;

integer = gda_value_new (G_TYPE_INT);
integer = gda_data_model_get_value_at (model, 0, 0, &error);

/* All values in a Data Model must be unmodificable then use const GValue, this
will avoid compilation warnings */

Or can use (gda_value_new makes this for you 🙂
integer = g_new0 (GValue. 1);
g_value_init (inteteger, G_TYPE_INT);

thank to Daniel Espinosa

Advertisements

Published by

paragasu

Different. In a good way

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s