Re: Forcing an applet to popup its context menu



Dixit Michael Meeks (2003-11-10 11:35):
> On Sat, 2003-11-08 at 04:40, Pierre Sarrazin wrote:
> > 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.
> 
>       You prolly want bonobo_control_do_popup_full or somesuch, I'm slightly
> suprised the panel doesn't wrap that for you in some friendly way
> though.

Thanks.  I ended up studying the source code of the clock applet
in gnome-panel (clock.c) and saw that there is a special callback
that prevents the button widget from absorbing the right-button
press event:

static gboolean
do_not_eat_button_press (GtkWidget      *widget,
                         GdkEventButton *event)
{
        if (event->button != 1)
                g_signal_stop_emission_by_name (widget, "button_press_event");

        return FALSE;
}

/* ... */

        g_signal_connect (toggle, "button_press_event",
                          G_CALLBACK (do_not_eat_button_press), NULL);

I don't understand how having the button widget stop the emission
of the signal lets this signal continue to the applet widget,
but this magic worked for me.

-- 
Pierre Sarrazin <sarrazip at sympatico dot ca>



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