Properties on interfaces



When thinking about the file selector design, it occurred to me that the
best way of handling the GtkFileChooserDialog GtkFileChooser split (as
we have for GtkFontSelection and GtkColorSelection) was to make
GtkFileChooser an interface implemented by the different interfaces.

For the methods and signals, this works well, but GtkFileChooser will
presumably have a bunch of properties. We could just use a convention
that objects implementing GtkFileChooser need to implement a set of
properties but this is ugly, will cause duplication of doc strings,
and won't work well in the documentation. 

Does properties on interface make conceptual sense? I think so.
Basically, properties are just a generic way to encapsulate a setter and
a getter. Since setters and getters can be part of interfaces,
properties should be able to be part of interfaces as well.

Is it easy to implement? As far as I can see, basically all that is
needed is:

 A) An API call:

    g_object_interface_install_property()

   Aside from different parameters, it should be pretty similar
   to g_object_class_install_property

 B) Replacement of some of the calls to g_param_spec_pool_lookup()
    in gobject.c with a function that first checks the objects
    class (and ancestors) then looks for the properties on 
    the interfaces.

 C) Extension of _object_class_list_properties to list the
    properties of the objects interfaces as well.

Probably a few more details, but doesn't look like much more than
a couple of hours work.

Thoughts?
                                                Owen






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