[Vala] plugin development in Vala




 Hi,

I'm very fascinated with this vala language and compiler, i'm truely
believes it can ease the work with the gtk+ stuff. Recently I playing
with the idea to wrote some epiphany/nautilus/etc plugin in Vala. To do
this, I have to create some specificly named procedure in my code. For
example, to create a nautilus plugin, you have to create the followings:

void nautilus_module_initialize (GTypeModule  *module);
void nautilus_module_shutdown (void);
void nautilus_module_list_types (const GType **types,
                            int *num_types)

The unfortunate thing, that I can't declare in my vala files, how my
methods are named. The following doesn't works:

[CCode (cname="something_different", cprefix="other_thing")]
static void my_method();

In fact, the best, and object oriented solution would be something
like :

public interface NautilusPlugin {

        [CCode (cname="nautilus_module_initialize")];
        void init(GTypeModule module);
        [CCode (cname="nautilus_module_shutdown")];
        void shutdown();
        
        [CCode (cname="nautilus_module_list_types")];
        void list_types(out GType types, out int num_types);
}

And if I want to create a plugin, I've just have to implement this
interface, without any annotation magic :) Of course I'know, that when
multiple NautilusPlugin declared with the same method name, it will
cause some pain :)
 Do you think this solution acceptable to the Vala-developer team? And
is it difficult to implement? 

BR, 
 Zsombor

p.s. After this enhancement the next step would be an API to help
developing applications with built-in plugin support. For example, if
nautilus would be written in vala, it would have the following code:
 ((NautilusPlugin)PluginLoader.load("libmyplugin.so")).init(module);
Okay, probably it's impossible, and just a strange dream :)






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