Wrapping the panel

Mike Massonnet mmassonnet at gmail.com
Tue Sep 8 14:21:41 CEST 2009


2009/9/7 Bo Lorentsen <bl at lue.dk>:
> Mike Massonnet wrote:
>>
>> I suggest to focus only on the external plugin, this is what I have
>> done for the vala bindings. Doing both is a lot more complicated, and
>> it's already very good to have one, at least in my POV.
>>
>
> So in vala you only have one XfcePanelPlugin like class, that holds the
> properties and signals and then an XfcePanelPluginInterface too ?

Roughly said, Vala bindings don't hold objects, they only hold
declarations that are used to do the translation from Vala to C by
replacing class/function names. In C an external panel plugin is build
through a MACRO that pulls in the main() function, and in Vala it is
not possible to use a MACRO or better said to have a main file without
main function, so I added custom code to be called from the main
function. With an example it looks like this:

    public static int main (string[] args) {
        return Xfce.PanelPluginRegisterExternal (ref args, TestPlugin.register);
    }

while in C it would simply be:

    XFCE_EXTERNAL_PANEL_PLUGIN_REGISTER(register);

The macro as well as the custom Vala method pass to the register
function a pointer on an XfcePanelPlugin, which would look like:

    public static void register (Xfce.PanelPlugin panel_plugin) {
        ...
    }

which in C looks like:

    static void register (XfcePanelPlugin *panel_plugin) {
        ...
    }

As you might understand there is no direct class instantiation or
inheritance here, neither for real GObjects as they are simply
"aliased" or the like.

I had suggest to build the sample plugin which is available at
git.xfce.org. But as you mentioned, if you are going to support 4.8,
you will just have to subclass the XfcePanelPlugin object.

> I am sorry to say that I'm not the biggest vala hacker myself :-)
>
> /BL
-- 
Mike



More information about the Xfce4-dev mailing list