new showdesktop plugin and plugin questions

Jasper Huijsmans jasper at xfce.org
Thu Jan 12 21:13:10 CET 2006


Jani Monoses schreef:
> Hello
> 
> I wrote a simple showdesktop internal panel plugin
> 

Thanks, that's great. I'm interested in adding this to the panel and it 
sounds like you did exactly what I had in mind.

> Differences from the 4.2 plugin:
> 
> user visible:
> 
>     -single toggle button icon (gnome/tango desktop icon) not one or two
> green arrows.

Yes.

>     -do not include a properties dialog (found the existing one
> confusing) and there is nothing to configure

Exactly.

> 
> implementation:
> 
>     -toggling show/hide windows done using libxfcegui4 not X libs
>     -figuring out whether WM supports this feature uses gdk
> not X libs
>     -of course the new panel api :)

I'll try to have a look this weekend.

> 
> If somebody needs the UI options of the existing plugin I can add them,
> I just wanted to keep it simple for now.
> 
> I am not sure what is best to do if the WM does not support showing the
> desktop or there's no WM. Gnome panel plugin pops up a dialog, the 4.2
> xfce plugin tries to do this using libxfce4 gui.
> Right now I just emit a g_message warning.

That's ok. People who are not using Xfwm should expect some things to be 
different.

> 
> I have a few questions regarding plugin writing
> 
> -what exactly is to be freed on the "free-data" signal? Does the plugin
> object itself need to be freed there? Which gtk/xfce objects need to be
> handled? How does this function relate (if at all) to glib/gtk object
> references? 

You need to free the data you have allocated yourself. The plugin and 
all gtk widgets will be handled by gtk.

> I see for instance the Tooltips object is in some plugins
> created g_object_ref()-ed gtk_object_sink()-ed and unrefe in
> plugin_free(). While in others (xfdesktop) it is just created then
> sinked in plugin_free()

GtkTooltips is one of the weirdest objects in gtk. As far as I can tell 
it works like this:

- It derives from GtkObject.
- This means it has an initial floating reference (a reference of 1 
owned by no-one).
- g_object_ref () increases the reference count
- g_object_sink () decreases the reference count and removes the 
floating flag.
- g_object_unref () decreases the reference, causing the object to be 
destroyed

It seems to me that indeed 'new,ref,sink,...,unref' is equivalent to 
'new,...,sink'.

> 
> -panel resizing
> 
> the existing plugins behave differently when the panel is resized:
>     -mailwatch seems to be the most OK in this respect as the icon
> grows/shinks proportionally with the panel.
>      -the launchers grwo/shink but do not go over a certain maximum siz
> this look OK too

I think they don't scale up, which often results in ugly icons.

>     -iconbox icons after shinked no longer grow, they always keep the
> smalles size

Oops ;-) That's a bug.

>     -mixer icon shinks to the point of totally disappearing :)

Hehe, and another one.

> 
> it would be nice if it was a helper function for plugin button with one
> icon scenario which could be reused. Rigth now gtk pixbuf, image and
> libxfcegui helpers are mixed and this causes inconsistency.

The code in libgui is meant exactly for use in panel plugins. If it is 
not fullfilling this purpose it should be changed.

> 
> is it ok to declare the set_size function with just two params as some
> plugins do? I know the 3rd arg will just be ignored if it's passed from
> the panel but I am asking from a coding style POV.

Yeah, that's fine with me.

> 
> -orientation
> this was not clear either to me what do do. The simple plugins which are
> just a box with an icon seem to work ok whatever the panels orientation.

This is why I made it a signal. You only need to attach to it if you 
want to do something special. Simple buttons will generally not care.

Thanks for the help, I'll look at it soon.

	Jasper




More information about the Xfce4-dev mailing list