Adding entry to applet's popup menu



I'm trying to understand how to add an "About" entry to the popup
menu of my GNOME 2 Panel applet.

I start with an applet that works.  My call to the
PANEL_APPLET_BONOBO_FACTORY() macro designates applet_fill() as
the function that builds the applet's interface.  In that function,
there is this statement:

panel_applet_setup_menu(applet, applet_menu_xml, applet_menu_verbs, NULL);

where 'applet' is the PanelApplet * received by applet_fill()
as its 1st parameter; 'applet_menu_xml' is defined this way:

static const gchar *applet_menu_xml =
"<Root>\n"
"    <popups>\n"
"        <popup name=\"button3\">\n"
"            <menuitem\n"
"                name=\"Verbiste About Item\"\n"
"                verb=\"VerbisteAbout\"\n"
"                _label=\"_About...\"\n"
"                pixtype=\"stock\"\n"
"                pixname=\"gnome-stock-about\"\n"
"                />\n"
"        </popup>\n"
"    </popups>\n"
"</Root>\n"
;

and applet_menu_verbs is defined like this:

static const BonoboUIVerb applet_menu_verbs[] =
{
    BONOBO_UI_VERB("VerbisteAbout", about_cb),
    BONOBO_UI_VERB_END
};


The about_cb callback is this:

static
void
about_cb(BonoboUIComponent *uic, gpointer user_data, const char *verbname)
{
}

It has no body because I'm waiting to see "About" in the applet's
menu before writing the code.

The thing is that I use /home/ps/ROOT/usr as the installation prefix.
I wonder if there is something that needs to be done to tell the
system about the About menu entry.

Note that /home/ps/ROOT/usr/lib/bonobo/servers is in the search path
mentioned in the /etc/bonobo-activation/bonobo-activation-config.xml
file.

I've tried 'killall gnome-panel' after installing, but to no avail.
The applet starts and appears in the Panel, but its context menu
only contains the standard "Remove from Panel" and "Move" entries.

If I can make this work, maybe I could contribute some text for the
"Panel Applet Writer's Reference Manual", which currently contains
a few empty sections:

http://developer.gnome.org/doc/API/2.0/panel-applet/libpanel-applet.html

-- 
Pierre Sarrazin <sarrazip at sympatico . ca>



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