default property values

From: Paul Forgey <paulf_at_aphrodite.com>
Date: Tue, 5 Jun 2007 17:44:40 -0700

I have an object with a string property as such:

class My:Example from G:Object
{
...

     private char *databasePath destroywith g_free;

...

     property STRING databasePath
         ( nick = "databasePath",
           blurb = "Full path to database",
           default_value = "/tmp/database.db" )
     set
     {
         g_free (selfp->databasePath);
         selfp->databasePath = g_value_dup_string (VAL);
     }

     get
     {
         g_value_set_string (VAL, selfp->databasePath);
     };

...

 From the documentation, I am assuming this will be set after GET_NEW:

> Almost all types also have a 'default_value' attribute which sets
> the initial value of this property (on object initialization, the
> set handler will be run automatically with this value). This value
> will be overriden if the user sets a value of this property on the
> call to g_object_new.

The set handler is never getting called and selfp->databasePath is
NULL after GET_NEW.

I can set the property during g_object_new () or once instantiated
with g_object_set ().

Why aren't the default values being properly set?
Received on Tue Jun 05 2007 - 18:00:53 CDT

This archive was generated by hypermail 2.2.0 : Sun Apr 17 2011 - 21:05:02 CDT