default property values

View: New views
1 Messages — Rating Filter:   Alert me  

default property values

by Paul Forgey-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


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?



--
to unsubscribe:
send mail to minimalist@... with "unsubscribe gob-list" in the subject