+ browser_open_url()
authorlego <lego@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 27 Dec 2006 01:46:42 +0000 (01:46 +0000)
committerlego <lego@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 27 Dec 2006 01:46:42 +0000 (01:46 +0000)
+ browser_open_data_file()

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@20223 f5534014-38df-0310-8fa8-9805f1628bb7

epan/funnel.h
epan/wslua/console.lua
epan/wslua/wslua_gui.c
gtk/funnel_stat.c
tap-funnel.c

index 09be5448ebaa0c42285d23e316035827d89a286f..d93b52cbb3ac95667b70020995a7fcb9e82663b4 100644 (file)
@@ -64,32 +64,29 @@ typedef struct _funnel_ops_t {
     void (*set_editable)(funnel_text_window_t*  win, gboolean editable);
     void (*destroy_text_window)(funnel_text_window_t*  win);
     void (*add_button)(funnel_text_window_t*  win, funnel_bt_t* cb, const gchar* label);
-#if 0
-    funnel_node_t* (*new_tree_window)(const gchar* title, gchar** columns);
-    funnel_node_t* (*add_node)(funnel_node_t* node, gchar** values);
-    void  (*remove_node)(funnel_node_t* node);
-    void  (*set_cell)(funnel_node_t* node, gchar* column, const gchar* text);
-
-    void (*set_filter)(const gchar* filter_string);
-
-#endif
 
+       
+       
     void (*new_dialog)(const gchar* title,
                                    const gchar** fieldnames,
                                    funnel_dlg_cb_t dlg_cb,
                                    void* data);
-    
+       
+       
     void (*logger)(const gchar *log_domain,
                    GLogLevelFlags log_level,
                    const gchar *message,
                    gpointer user_data);
        
+       
        void (*retap_packets)(void);
        void (*copy_to_clipboard)(GString *str);
        void (*set_filter)(const char*);
        gboolean (*open_file)(const char* fname, const char* filter, char** error);
        void (*reload)(void);
        void (*apply_filter)(void);
+       gboolean (*browser_open_url)(const gchar *url);
+       void (*browser_open_data_file)(const gchar *filename);
 } funnel_ops_t;
 
 
index 04e066bd00b34aa2b9dba9523b46e5ba6c630bdb..45339ccd708c3b01697888649d88665f572603ef 100644 (file)
@@ -101,6 +101,11 @@ if (gui_enabled()) then
                info("Console opened")
        end
 
-       register_menu("Lua/Evaluate",evaluate_lua,MENU_TOOLS)
-       register_menu("Lua/Console",run_console,MENU_TOOLS)
+       function wiki_page()
+               browser_open_url("http://wiki.wireshark.org/Lua")
+       end
+
+       register_menu("Lua/Evaluate", evaluate_lua, MENU_TOOLS)
+       register_menu("Lua/Console", run_console, MENU_TOOLS)
+       register_menu("Lua/Wiki", wiki_page, MENU_TOOLS)
 end
index 8b799ce5aae21089d073ffdf4fe31b0bfb16c9c3..57888941c3327b02f3851aaa224ddc6f755a64f8 100644 (file)
@@ -600,3 +600,40 @@ WSLUA_FUNCTION wslua_reload(lua_State* L) { /* reload the current capture file *
 
        return 0;
 }
+
+
+WSLUA_FUNCTION wslua_browser_open_url(lua_State* L) { /* open an url in a browser */
+#define WSLUA_ARG_browser_open_url_URL 1 /* The url. */
+       const char* url = luaL_checkstring(L,WSLUA_ARG_browser_open_url_URL);
+
+       if (!ops->browser_open_url) {
+               WSLUA_ERROR(browser_open_url, "does not work on TShark");
+       }
+
+       if (!url) {
+               WSLUA_ARG_ERROR(browser_open_url,URL,"must be a string");
+       }
+
+       ops->browser_open_url(url);
+
+       return 0;
+}
+
+WSLUA_FUNCTION wslua_browser_open_data_file(lua_State* L) { /* open an file in a browser */
+#define WSLUA_ARG_browser_open_data_file_FILENAME 1 /* The url. */
+       const char* url = luaL_checkstring(L,WSLUA_ARG_browser_open_data_file_FILENAME);
+
+       if (!ops->browser_open_url) {
+               WSLUA_ERROR(browser_open_data_file, "does not work on TShark");
+       }
+
+       if (!url) {
+               WSLUA_ARG_ERROR(browser_open_data_file,FILENAME,"must be a string");
+       }
+
+       ops->browser_open_data_file(url);
+
+       return 0;
+}
+
+
index 5868151572d469810afd374217ea47a32863ccc6..b3366f5efc6041554dcb9d93011f6f87a1834997 100644 (file)
@@ -60,6 +60,7 @@
 #include "prefs_dlg.h"
 #include "file.h"
 #include "main.h"
+#include "webbrowser.h"
 
 #include "gtkglobals.h"
 
@@ -615,7 +616,9 @@ static const funnel_ops_t funnel_ops = {
        funnel_set_filter,
        funnel_open_file,
        funnel_reload,
-       funnel_apply_filter
+       funnel_apply_filter,
+       browser_open_url,
+       browser_open_data_file
 };
 
 
index 506ad63459e215ca159a75cba1fdb1a61795f9ea..7fed0d2f9d95d0e8b26e498e1d74808657b074e6 100644 (file)
@@ -103,7 +103,9 @@ static const funnel_ops_t funnel_ops = {
     NULL,
     NULL,
     NULL,
-    NULL
+    NULL,
+       NULL,
+       NULL
 };