Questions about xfdesktop's menu plugin

Jasper Huijsmans jasper at xfce.org
Fri Apr 20 22:53:02 CEST 2007


Hi Diego,

Diego Ongaro wrote:
> I sent this message to the goodies-dev list, but Brian Tarricone
> suggested I send it to xfce4-dev. I've also added a couple comments he
> made on IRC.
>   
...
> 2) registering menu with panel
>
> xfdesktop calls xfce_panel_plugin_register_menu() before each time the
> menu is opened. Is it sufficient to call
> xfce_panel_plugin_register_menu() only when the menu is (re-)created?
>
>   
No you have to call it every time the menu is opened. That function 
probably should have been called *_register_open_menu() or something. It 
allows the panel to properly handle focus, transparency, autohide and 
probably some other things when the menu closes.

> 3) Menu deactivate signal
>
> menu_activate() stores the signal id of the menu_deactivated()
> callback with the menu. Later, menu_deactivated() does two things.
> First, it sets the button state to inactivated. Second, it retrieves
> the signal id and disables that signal with it. Is this done simply
> because the deactivate callback could be connected multiple times?
>
> Brian on IRC: "i don't know, but it's probably more complicated than
> it needs to be"
>
>   
The panel does something like this, but that's because the register 
function is called every time the menu is opened -- hmm, that does make 
me wonder if that was really necessary, a one-time registration might 
have worked just as well...., ah well, soimthing for the next redesign 
;-) Anyway, you can probably get away with connecting the signal only once.

...
> 5) Tooltips
>
> This is probably the wrong mailing list for this item. Regardless:
>
> I call gtk_tooltips_new() and then gtk_tooltips_set_tip() on the
> button to _("Places"). Do I need to ref, unref, and/or sink the
> GtkTooltips variable? xfdesktop keeps a pointer to its GtkTooltips
> struct since its tooltip changes based on preferences. It later calls
> gtk_object_sink() in dmp_free().
>
> Brian on IRC: "i never remember whether or not you have to unref/sink
> GtkTooltips. it's possible that when you calk gtk_tooltips_set_tip(),
> the sinks and takes owners hip of it but i don't know. reading gtk
> source will probably tell you, though"
>
>   
Ok, this is from memory, so I may not remember this correctly, but I 
think it's like this:

gtk_tooltips_new() creates a GtkObject with a floating reference. This 
means that you either use it like that and call gtk_object_sink() to 
free the object, or you take a reference (g_object_ref()), remove the 
floating flag (gtk_object_sink()) and then to free the object you use 
g_object_unref().

HTH,

    Jasper




More information about the Xfce4-dev mailing list