Re: Forcing an applet to popup its context menu
- From: "Kevin Vandersloot" <kfv101 hotmail com>
- To: sarrazip sympatico ca, gnome-devel-list gnome org
- Subject: Re: Forcing an applet to popup its context menu
- Date: Mon, 10 Nov 2003 16:12:28 +0000
Basically the panelapplet library will handle to right click context menu
automatically using panel_applet_setup_menu_from_file. You then want to do
two things (from the cdplayer applet)
1) Connect to the button press event and copy the "button_press_hack"
function from cdplayer.c (see line 1171 here
http://cvs.gnome.org/bonsai/cvsblame.cgi?file=gnome-applets%2Fcdplayer/cdplayer.c&rev=&root=/cvs/gnome
This is a hack around a gtk bug (maybe it has been fixed since. Otherwise
the rick click event wasn't getting sent to the applet hence the need for a
hack)
2) Connect to the clicked event and in this callback do what you want with
the left button.
Hope that helps.
Regards,
Kevin
From: Pierre Sarrazin <sarrazip sympatico ca>
To: gnome-devel-list gnome org
Subject: Forcing an applet to popup its context menu
Date: Fri, 7 Nov 2003 23:40:08 -0500
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>
_______________________________________________
gnome-devel-list mailing list
gnome-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gnome-devel-list
_________________________________________________________________
Crave some Miles Davis or Grateful Dead? Your old favorites are always
playing on MSN Radio Plus. Trial month free!
http://join.msn.com/?page=offers/premiumradio
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]