Forcing an applet to popup its context menu



I am coding an applet that shows a button in the panel.  I would
like one action to happen when the user left-clicks the button,
but when the user right-clicks, I would like to show the applet's
context menu.

Currently, I'm connecting the button's "button_press_event" signal
to a callback that would be written like this:

gboolean on_button_press(GtkWidget *, GdkEventButton *event, gpointer)
{
    if (event->button == 1)
    {
	do_something();
	return TRUE;
    }
    if (event->button == 3)
    {
	/* show applet context menu */
	return TRUE;
    }
    return FALSE;
}

I'd like to know how to code the second if().

I see that there is the panel_applet_get_popup_component() function
in <http://developer.gnome.org/doc/API/2.0/panel-applet/panelapplet.html>,
but then I wouldn't know what to do with the resulting BonoboUIComponent
pointer.  Thanks.

-- 
Pierre Sarrazin <sarrazip at sympatico dot ca>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]