summaryrefslogtreecommitdiff
path: root/epan/wslua/wslua_gui.c
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2015-08-11 14:08:08 +0200
committerStig Bjørlykke <stig@bjorlykke.org>2015-08-11 12:09:07 +0000
commitecc4f756bdb6175cc0b3b11af2f90884db1c602c (patch)
tree99d8ca48a72752e1257d4b8b321f41d1767ee020 /epan/wslua/wslua_gui.c
parent70d06deb2e31bd605e672200a7755764febe94ae (diff)
downloadwireshark-ecc4f756bdb6175cc0b3b11af2f90884db1c602c.tar.gz
Added Reload Lua plugins.
This is initial support for reloading Lua plugins without restarting the application. Still todo: - Deregister FileHandlers - Support deregister ProtoField with existing abbrev (same_name_hfinfo) - Add a progress dialog when reloading many plugins - Search for memory leakages in wslua functions Change-Id: I48870d8741251705ca15ffe1068613fcb0cb18c1 Reviewed-on: https://code.wireshark.org/review/5028 Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Diffstat (limited to 'epan/wslua/wslua_gui.c')
-rw-r--r--epan/wslua/wslua_gui.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/epan/wslua/wslua_gui.c b/epan/wslua/wslua_gui.c
index 0586293aa3..1fc3baeee7 100644
--- a/epan/wslua/wslua_gui.c
+++ b/epan/wslua/wslua_gui.c
@@ -121,8 +121,9 @@ WSLUA_FUNCTION wslua_register_menu(lua_State* L) { /* Register a menu item in o
WSLUA_RETURN(0);
}
-
-
+void wslua_deregister_menus(void) {
+ funnel_deregister_menus(lua_menu_callback);
+}
struct _dlg_cb_data {
lua_State* L;
@@ -553,6 +554,20 @@ WSLUA_METHOD TextWindow_get_text(lua_State* L) { /* Get the text of the window *
WSLUA_RETURN(1); /* The `TextWindow`'s text. */
}
+WSLUA_METHOD TextWindow_close(lua_State* L) { /* Close the window */
+ TextWindow tw = checkTextWindow(L,1);
+
+ if (!ops->destroy_text_window) {
+ WSLUA_ERROR(TextWindow_get_text,"GUI not available");
+ return 0;
+ }
+
+ ops->destroy_text_window(tw->ws_tw);
+ tw->ws_tw = NULL;
+
+ return 0;
+}
+
/* Gets registered as metamethod automatically by WSLUA_REGISTER_CLASS/META */
static int TextWindow__gc(lua_State* L) {
TextWindow tw = toTextWindow(L,1);
@@ -666,7 +681,6 @@ WSLUA_METHOD TextWindow_add_button(lua_State* L) {
WSLUA_METHODS TextWindow_methods[] = {
WSLUA_CLASS_FNREG(TextWindow,new),
WSLUA_CLASS_FNREG(TextWindow,set),
- WSLUA_CLASS_FNREG(TextWindow,new),
WSLUA_CLASS_FNREG(TextWindow,append),
WSLUA_CLASS_FNREG(TextWindow,prepend),
WSLUA_CLASS_FNREG(TextWindow,clear),
@@ -674,6 +688,7 @@ WSLUA_METHODS TextWindow_methods[] = {
WSLUA_CLASS_FNREG(TextWindow,set_editable),
WSLUA_CLASS_FNREG(TextWindow,get_text),
WSLUA_CLASS_FNREG(TextWindow,add_button),
+ WSLUA_CLASS_FNREG(TextWindow,close),
{ NULL, NULL }
};