Re: [Vala] plugin development in Vala



As I am also interested in porting bulldozer to Vala I've looked at the
problem. Beginning was quite easy:

using GLib;

public class NautilusModule
{
        public static void initialize(TypeModule module)
        {
                module.register_type(typeof(NautilusModule));
        }

        public static void shutdown()
        {
        }

        [NoArrayLength ()]
        public static void list_types(out Type[] types, out int ntypes)
        {
        }
}

Expect that Vala doesn't properly convert "out int" into "int *". Well,
and to comply with C#, Vala should accept [Attribute] in addition to
[Attribute ()]. Vala also needs some attribute to express that ntypes
contains the array length. There also are various places in the vapi dir
which would benefit from that addition.

Real trouble started when telling glib-2.0.vala about GTypeModule:

        [CCode (cheader_filename = "glib-object.h")]
        public class TypeModule {
                string name;

                bool use ();
                void unuse ();
                void set_name (string name);

                Type register_type (Type parent_type,
                                    string type_name,
                                    TypeInfo type_info);
                void add_interface (Type instance_type,
                                    Type interface_type,
                                    InterfaceInfo interface_info);
                Type register_enum (string name,
                                    EnumValue values);
                Type register_flags (string name,
                                     FlagsValue values);
        }
        
Don't know how to express the const attributes that class uses. Would
not know how to pass those type information required to the C API.

Ciao,
Mathias




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