aboutsummaryrefslogtreecommitdiffstats
path: root/gtk
diff options
context:
space:
mode:
Diffstat (limited to 'gtk')
-rw-r--r--gtk/main.c23
-rw-r--r--gtk/main.h11
-rw-r--r--gtk/menu.c6
3 files changed, 40 insertions, 0 deletions
diff --git a/gtk/main.c b/gtk/main.c
index ba6e4f6b15..5dd37998d9 100644
--- a/gtk/main.c
+++ b/gtk/main.c
@@ -89,6 +89,7 @@
#include "cmdarg_err.h"
#include "version_info.h"
#include "merge.h"
+#include <epan/oid_resolv.h>
#ifdef HAVE_LIBPCAP
#include "capture-pcap-util.h"
@@ -382,6 +383,28 @@ selected_ptree_ref_cb(GtkWidget *widget _U_, gpointer data _U_)
}
}
+void
+selected_ptree_field_url_cb(GtkWidget *widget _U_, gpointer data _U_)
+{
+ gchar *selected_info_url;
+
+ /* only OIDs for now */
+ if(cfile.finfo_selected->hfinfo->type == FT_OID) {
+ if(get_oid_url(cfile.finfo_selected, &selected_info_url)) {
+ browser_open_url(selected_info_url);
+ g_free(selected_info_url);
+ }
+ }
+}
+
+gboolean selected_ptree_has_field_url()
+{
+ /* only OIDs for now */
+ if(cfile.finfo_selected->hfinfo->type == FT_OID)
+ return get_oid_url(cfile.finfo_selected, NULL);
+
+ return FALSE;
+}
static gchar *
get_text_from_packet_list(gpointer data)
diff --git a/gtk/main.h b/gtk/main.h
index eae8a1dd34..6b279d7e98 100644
--- a/gtk/main.h
+++ b/gtk/main.h
@@ -105,6 +105,17 @@ extern void selected_ptree_info_cb(GtkWidget *widget, gpointer data);
*/
extern void selected_ptree_ref_cb(GtkWidget *widget, gpointer data);
+/** User requested "Field Information" by ptree context menu.
+ *
+ * @param widget parent widget (unused)
+ * @param data unused
+ */
+extern void selected_ptree_field_url_cb(GtkWidget *widget, gpointer data);
+
+/** Determine if "Field Information" should be enabled in ptree context menu.
+ *
+ */
+extern gboolean selected_ptree_has_field_url();
/** "Apply as Filter" / "Prepare a Filter" action type. */
typedef enum {
diff --git a/gtk/menu.c b/gtk/menu.c
index 12af55fd22..20b08ebc6b 100644
--- a/gtk/menu.c
+++ b/gtk/menu.c
@@ -519,6 +519,8 @@ static GtkItemFactoryEntry tree_view_menu_items[] =
0, ETHEREAL_STOCK_WIKI),
ITEM_FACTORY_STOCK_ENTRY("/Filter Field Reference", NULL, selected_ptree_ref_cb,
0, ETHEREAL_STOCK_INTERNET),
+ ITEM_FACTORY_STOCK_ENTRY("/Field Information", NULL, selected_ptree_field_url_cb,
+ 0, ETHEREAL_STOCK_INTERNET),
ITEM_FACTORY_ENTRY("/Protocol Preferences...", NULL, properties_cb,
0, NULL, NULL),
ITEM_FACTORY_ENTRY("/<separator>", NULL, NULL, 0, "<Separator>", NULL),
@@ -2135,6 +2137,8 @@ set_menus_for_selected_tree_row(capture_file *cf)
TRUE);
set_menu_sensitivity(tree_view_menu_factory, "/Filter Field Reference",
TRUE);
+ set_menu_sensitivity(tree_view_menu_factory, "/Field Information",
+ selected_ptree_has_field_url());
} else {
set_menu_sensitivity(main_menu_factory,
"/Go/Go to Corresponding Packet", FALSE);
@@ -2152,6 +2156,8 @@ set_menus_for_selected_tree_row(capture_file *cf)
FALSE);
set_menu_sensitivity(tree_view_menu_factory, "/Filter Field Reference",
FALSE);
+ set_menu_sensitivity(tree_view_menu_factory, "/Field Information",
+ FALSE);
}
walk_menu_tree_for_selected_tree_row(tap_menu_tree_root, cf->finfo_selected);