Questions about xfdesktop's menu plugin

Diego Ongaro ongardie at
Fri Apr 20 21:33:32 CEST 2007

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.

In preparation for the next release of the places plugin, I based much
of the view on xfdesktop's menu panel plugin. Jens (perldude)
suggested I drop the arrow, so the plugin now behaves like the menu
rather than a launcher. Below, I've listed 5 different questions I
have about xfdesktop's code.

1) g_object_ref new image

Line 1016-7 of xfdesktop:
    dmp->image = gtk_image_new();

As far as I know, this is never unref'ed. Is that intentional?

Brian on IRC: "i think that's a bug in the menu plugin.  it should
call unref() in dmp_free(), but i guess i forgot. seeing as the menu
plugin is external, and it quits when it gets removed, i guess it
doesn't really matter."

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?

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"

4) Control-click

dmp_popup has:
  if(evt->button != 1 || ((evt->state & GDK_CONTROL_MASK)
  && !(evt->state & (GDK_MOD1_MASK|GDK_SHIFT_MASK

I see what that does, but why? Is this for the poor folks with 1-button mice?

Brian on IRC: "yes, more or less"

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"

Please respond to this email or catch me on IRC if you can help with
any of these.
Diego Ongaro (ongardie on freenode)

More information about the Xfce4-dev mailing list