[Vala] Installing properties and interface initialization



 Hi!

I'm trying to add a new css property for my Mx widget. In C there is mx_stylable_iface_install_property function and I can create bindings for it. But this function should be used inside the interface initialization function of a class.
For example (from mx docs):

G_DEFINE_TYPE_WITH_CODE  
<http://docs.clutter-project.org/usr/share/gtk-doc/html/gobject/gobject-Type-Information.html#G-DEFINE-TYPE-WITH-CODE:CAPS>
  (FooActor,  foo_actor,  CLUTTER_TYPE_ACTOR,
                         G_IMPLEMENT_INTERFACE  
<http://docs.clutter-project.org/usr/share/gtk-doc/html/gobject/gobject-Type-Information.html#G-IMPLEMENT-INTERFACE:CAPS>
  (MX_TYPE_STYLABLE,
                                                mx_stylable_init));
...
static  void
mx_stylable_init  (MxStylableIface  
<http://docs.clutter-project.org/docs/mx/stable/mx-mx-style.html#MxStylableIface>  *iface)
{
  static  gboolean  <http://docs.clutter-project.org/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean>  
is_initialized=  FALSE  
<http://docs.clutter-project.org/usr/share/gtk-doc/html/glib/glib-Standard-Macros.html#FALSE:CAPS>;

  if  (!is_initialized)
    {
      ...
      mx_stylable_iface_install_property  
<http://docs.clutter-project.org/docs/mx/stable/mx-mx-stylable.html#mx-stylable-iface-install-property>  
(stylable,
                                            FOO_TYPE_ACTOR,
                                            g_param_spec_int  
<http://docs.clutter-project.org/usr/share/gtk-doc/html/gobject/gobject-Standard-Parameter-and-Value-Types.html#g-param-spec-int>
  ("x-spacing",
                                                              "X Spacing",
                                                              "Horizontal spacing",
                                                              -1,  G_MAXINT  
<http://docs.clutter-project.org/usr/share/gtk-doc/html/glib/glib-Limits-of-Basic-Types.html#G-MAXINT:CAPS>,
                                                              2,
                                                              G_PARAM_READWRITE  
<http://docs.clutter-project.org/usr/share/gtk-doc/html/gobject/gobject-GParamSpec.html#G-PARAM-READWRITE:CAPS>));
      ...
    }
}


Vala generates *_mx_stylable_interface_init (MxStylableIface * iface) function but I don't know how to add any code to it from my vala program.

So, is there any way to such thing in vala?

Thanks in advance

P.S. Sorry for my bad English.





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