Wireshark-dev: Re: [Wireshark-dev] Adding a new menu in the MenuBar
From: Richard Sharpe <[email protected]>
Date: Mon, 9 Jul 2012 08:05:23 -0700
On Sun, Jul 8, 2012 at 10:15 PM, Tony Trinh <[email protected]> wrote:
> On Mon, Jul 9, 2012 at 1:01 AM, Richard Sharpe <[email protected]> wrote:
>> Hi folks,
>> I would like to add a new menu in the Menubar, like "Menubar/Blah" and
>> place it before help, and after the tools menu (and probably before
>> Internals).
>> I would like to do it from Lua.
>> I think I can see how to do this, but I wonder if anyone else has done
>> that before?
> WSLua does not support adding main menus. Currently, you can only add submenus to
> existing menus.

You are correct. The problem would seem to be twofold:

1. There is no function for doing that, and

2. In ui/gtk/funnel_stat.c, the stat_group_name function contains a
static value_string of the relationships between values like
REGISTER_STAT_GROUP_UNSORTED and the string to use for the menu item.

Functions/methods would have to be added to allow new menu items to be
added to allow the addition of whole new menus, but
register_lua_menu_bar_menu_items and its subsidiary functions seem
capable of this, as well as functions/methods to enter new values in
VALS_GROUP_NAMES and to retrieve the index based on the string.

BTW, it would seem that VALS_GROUP_NAMES does not follow the naming
standards. It should not be all uppercase.

Richard Sharpe