Re: Properties on interfaces



On Fri, 2003-02-14 at 00:25, Owen Taylor wrote:
> Fooling around with this a little more, two fairly obvious
> issues came up:
> 
>  * What get_property/set_property methods get called? 
>    Maybe the ones for the type for which add_interface() is called?
>    But that doesn't allow overriding the implementation in
>    derived classes, and also doesn't    

There is no other set_property method, or is there ? the interface
doesn't provide any implementations, only interfaces.

> 
>  * What to do about property IDs, since they are different
>    for each class that has a given interface?

Is this a problem ? g_object_set_property looks up the paramspecs by
name anyway. That is also how overriding paramspecs in derived classes
works: use the same name.

> 
> What I was thinking about to solve these problems is something
> like:
> 
>  g_object_class_install_interface_property (file_chooser_dialog_class, 
>                                             PROP_FILENAME,
>                                             "filename",
>                                             GTK_TYPE_FILE_CHOOSER);
> 
> Which says to forward PROP_FILENAME/filename to the "filename" property
> of the GtkFileChooser interface.

What does "forwarding" mean here, considering that the
get_property/set_property implementation is in the dialog_class anyway ?
If it only means to reuse the paramspec from the interface property,
couldn't you achieve the same effect by

g_object_class_install_property (file_chooser_dialog_class,
                                 PROP_FILENAME,
                                 g_param_spec_pool_lookup (pspec_pool,
                                              "filename",
                                              GTK_TYPE_FILE_CHOOSER));






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]