Panel Update

Brian J. Tarricone bjt23 at cornell.edu
Sat Sep 10 00:17:19 CEST 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 9/9/2005 7:22 AM, Jasper Huijsmans wrote:
> Hi all,
> 
> A quick update about the new panel framework. I just committed a rather 
> large update that changes the plugin API. Hopefully it will also be a 
> bit more friendly to binding writers.
> 
> I also fixed the generation of API docs to properly include signals and 
> properties. You can also read it at:
> 
> http://xfce.loculus.nl/documentation/API/
> 
> Basic API from the perspective of a plugin writer:
> 
> ===
>   #include <libxfce4panel/xfce-panel-plugin.h>
> 
>   static void plugin_construct (XfcePanelPlugin *plugin);
> 
>   XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL (panel_construct);
> 
>   static void
>   plugin_construct (XfcePanelPlugin *plugin)
>   {
>        /* create widgets */
>        /* connect to plugin signals */
>   }
> ===
> 
> That's it ;-)
> 
> The plugin should install a <pluginname>.desktop file in 
> ${prefix}/share/xfce4/panel-plugins/ . There's information about that in 
> the README.Plugins file.
> 
> Language bindings should basically reimplement the 
> XFCE_PANEL_PLUGIN_REGISTER_EXTERNAL() macro, defined in 
> libxfce4panel/xfce-panel-plugin.h .
> 
> So, if you have any comments about this API, please let me know now, 
> before people have started to port any plugins.

Like Benny said, I don't see the need for xfce_panel_plugin_set_data()
and xfce_panel_plugin_get_data().  GObject provides these, and having
another function that does the same thing is redundant and confusing.

I'm a little confused as to what xfce_panel_plugin_add_action_widget() does:

"Attach the plugin menu to this widget. Plugin writers should call this
for every widget that can receive mouse events."

Does this replace the old "attach_callback" thingy in the old panel?  Or
is this do something else?

Also a nitpick on the implementation of
XFCE_PANE_PLUGIN_REGISTER_EXTERNAL().  You connect the 'destroy' signal
to gtk_main_quit().  I'd suggest just connecting it to exit().  The
reasoning here is that if the plugin has another mainloop running at
that time (perhaps via gtk_dialog_run()), then gtk_main_quit() will only
quit that inner mainloop, and not the outer.

Another issue with that is allowing the plugin to catch destruction.
Since glib can't guarantee callback order, if the plugin itself hooks
'destroy', it might never get the signal.  (Well, ok, in your method it
does, but not in mine where you call exit().)  I'd suggest changing that
to g_signal_connect_after().

Actually, you can eliminate both problems by declaring a helper
function, and then doing:

while(gtk_main_level())
    gtk_main_quit();

I think.  Or maybe you have to do a for loop.  I don't remember if
gtk_main_quit() immediately decrements the main level, or if it only
does it after gtk_main() or gtk_dialog_run() actually returns.

Anyway, just a few random things off the top of my head...

	-brian

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (MingW32)

iD8DBQFDIgnu6XyW6VEeAnsRAgulAJ4zU+ZFmExP6EIg/h9oeb6Wj7uJ4wCfcZe1
6XhPwII/RvK3ONT2vEIYs9w=
=sugN
-----END PGP SIGNATURE-----



More information about the Xfce4-dev mailing list