Wireshark-dev: [Wireshark-dev] Adding a file-picker dialog box capability to Lua
From: Richard Sharpe <[email protected]>
Date: Sat, 14 Jul 2012 11:14:19 -0700
Hi folks,

I want to be able to put up a file-picker dialog box from Lua.

Something like this:

----------------
function dialog_ttload()
    file_picker_new_dialog("My Plugin Load and Filter",
do_load_and_filter, "File to load", "Filter String")
end

register_menu("My Plugin Load & Filter", dialog_ttload, MENU_TOOLS_UNSORTED)
----------------

And then have the callback do interesting things, like pre-filter
through tshark or talk to a special hardware device or whatever.

In any event, it allows a plugin to put up a file picker dialog box.

It turns out that it is not hard to do. Please see the attached.

However, I am sure I have not thought of all the necessary things and
maybe it needs to be decomposed into smaller units.

That is, it might be that it would be useful to be able to compose a
dialog box in Lua from existing components in Wireshark. Something
like:

    dlg = new_dialog_composable("This is my new dialog")
    file_picker = get_wireshark_file_selection_browse();
    add_to_dialog(dlg, file_picker)
    other_stuff = get_wireshark_other_stuff();
    add_to_dialog(dlg, other_stuff)

Anyway, comments welcome.

-- 
Regards,
Richard Sharpe
(何以解憂?唯有杜康。--曹操)

Attachment: wslua-file-picker.patch
Description: Binary data