/* set the default values for the rtp player dialog box */
prefs.rtp_player_max_visible = RTP_PLAYER_DEFAULT_VISIBLE;
+ prefs.display_hidden_proto_items = FALSE;
+
prefs_initialized = TRUE;
}
/* values for the rtp player preferences dialog box */
#define PRS_RTP_PLAYER_MAX_VISIBLE "rtp_player.max_visible"
+#define PRS_DISPLAY_HIDDEN_PROTO_ITEMS "packet_list.display_hidden_proto_items"
+
static const gchar *pr_formats[] = { "text", "postscript" };
static const gchar *pr_dests[] = { "command", "file" };
prefs.name_resolve_concurrency = strtol(value, NULL, 10);
} else if (strcmp(pref_name, PRS_RTP_PLAYER_MAX_VISIBLE) == 0) {
prefs.rtp_player_max_visible = strtol(value, NULL, 10);
+ } else if (strcmp(pref_name, PRS_DISPLAY_HIDDEN_PROTO_ITEMS) == 0) {
+ prefs.display_hidden_proto_items = ((g_ascii_strcasecmp(value, "true") == 0)?TRUE:FALSE);
} else {
/* To which module does this preference belong? */
module = NULL;
fprintf(pf, "\n####### Protocols ########\n");
+ fprintf(pf, "\n# Display hidden items in packet details pane?\n");
+ fprintf(pf, "# TRUE or FALSE (case-insensitive).\n");
+ fprintf(pf, PRS_DISPLAY_HIDDEN_PROTO_ITEMS ": %s\n",
+ prefs.display_hidden_proto_items == TRUE ? "TRUE" : "FALSE");
+
pe_tree_foreach(prefs_modules, write_module_prefs, pf);
fclose(pf);
dest->capture_show_info = src->capture_show_info;
dest->name_resolve = src->name_resolve;
dest->name_resolve_concurrency = src->name_resolve_concurrency;
+ dest->display_hidden_proto_items = src->display_hidden_proto_items;
}
gboolean capture_auto_scroll;
gboolean capture_show_info;
guint rtp_player_max_visible;
+ gboolean display_hidden_proto_items;
} e_prefs;
WS_VAR_IMPORT e_prefs prefs;
prefs_layout.c \
prefs_nameres.c \
prefs_print.c \
+ prefs_protocols.c \
prefs_rtp_player.c \
prefs_stream.c \
print_dlg.c \
prefs_layout.h \
prefs_nameres.h \
prefs_print.h \
+ prefs_protocols.h \
prefs_rtp_player.h \
prefs_stream.h \
profile_dlg.h \
GdkColor expert_color_note = { 0, 0xa000, 0xff00, 0xff00 }; /* a bright turquoise */
GdkColor expert_color_warn = { 0, 0xff00, 0xff00, 0 }; /* yellow */
GdkColor expert_color_error = { 0, 0xff00, 0x5c00, 0x5c00 }; /* pale red */
+GdkColor hidden_proto_item = { 0, 0x4400, 0x4400, 0x4400 }; /* gray */
void proto_draw_colors_init(void)
{
get_color(&expert_color_note);
get_color(&expert_color_warn);
get_color(&expert_color_error);
+ get_color(&hidden_proto_item);
colors_ok = TRUE;
}
*/
/*g_object_set (cell, "weight", PANGO_WEIGHT_BOLD, NULL);
g_object_set (cell, "weight-set", TRUE, NULL);*/
+ } else if(FI_GET_FLAG(fi, FI_HIDDEN)) {
+ g_object_set (cell, "foreground-gdk", &hidden_proto_item, NULL);
+ g_object_set (cell, "foreground-set", TRUE, NULL);
}
if(fi->hfinfo->type == FT_PROTOCOL) {
GtkTreeIter iter;
GtkTreePath *path;
- if (PROTO_ITEM_IS_HIDDEN(node))
+ if (PROTO_ITEM_IS_HIDDEN(node) && !prefs.display_hidden_proto_items)
return;
/* was a free format label produced? */
is_expanded = FALSE;
}
- if(PROTO_ITEM_IS_GENERATED(node)) {
+ if (PROTO_ITEM_IS_GENERATED(node)) {
label_ptr = g_strdup_printf("[%s]", label_ptr);
+ } else if (PROTO_ITEM_IS_HIDDEN(node)) {
+ label_ptr = g_strdup_printf("<%s>", label_ptr);
}
info.tree_view = parent_info->tree_view;
gtk_tree_store_append(store, &iter, parent_info->iter);
gtk_tree_store_set(store, &iter, 0, label_ptr, 1, fi, -1);
- if(PROTO_ITEM_IS_GENERATED(node)) {
+ if (PROTO_ITEM_IS_GENERATED(node) || PROTO_ITEM_IS_HIDDEN(node)) {
g_free(label_ptr);
}
#include "gtk/prefs_capture.h"
#include "gtk/prefs_nameres.h"
#include "gtk/prefs_rtp_player.h"
+#include "gtk/prefs_protocols.h"
#include "gtk/gui_utils.h"
#include "gtk/dlg_utils.h"
#include "gtk/stock_icons.h"
#define E_PRINT_PAGE_KEY "printer_options_page"
#define E_NAMERES_PAGE_KEY "nameres_options_page"
#define E_RTP_PLAYER_PAGE_KEY "rtp_player_options_page"
+#define E_PROTOCOLS_PAGE_KEY "protocols_options_page"
/*
* Keep a static pointer to the current "Preferences" window, if any, so that
gboolean is_protocol;
};
-static gint blank_page = 0;
+static gint protocols_page = 0;
static guint
pref_exists(pref_t *pref _U_, gpointer user_data _U_)
/* Show 'em what we got */
gtk_widget_show_all(main_sw);
} else {
- /* show the blank page */
+ /* show the protocols page */
- gtk_tree_store_set(model, &iter, 0, label_str, 1, blank_page, -1);
+ gtk_tree_store_set(model, &iter, 0, label_str, 1, protocols_page, -1);
}
cts.page = 0;
- /* Blank Page */
- g_strlcpy(label_str, "(No Specific Preferences)", MAX_TREE_NODE_NAME_LEN);
- prefs_nb_page_add(prefs_nb, label_str, NULL, NULL);
- blank_page = cts.page++;
+ /* Preferences common for all protocols */
+ g_strlcpy(label_str, "Protocols", MAX_TREE_NODE_NAME_LEN);
+ prefs_nb_page_add(prefs_nb, label_str, protocols_prefs_show(), E_PROTOCOLS_PAGE_KEY);
+ protocols_page = cts.page++;
/* GUI prefs */
g_strlcpy(label_str, "User Interface", MAX_TREE_NODE_NAME_LEN);
#ifdef HAVE_LIBPORTAUDIO
rtp_player_prefs_fetch(g_object_get_data(G_OBJECT(dlg), E_RTP_PLAYER_PAGE_KEY));
#endif
+ protocols_prefs_fetch(g_object_get_data(G_OBJECT(dlg), E_PROTOCOLS_PAGE_KEY));
prefs_modules_foreach(module_prefs_fetch, must_redissect);
return TRUE;
#ifdef HAVE_LIBPORTAUDIO
rtp_player_prefs_apply(g_object_get_data(G_OBJECT(dlg), E_RTP_PLAYER_PAGE_KEY));
#endif
+ protocols_prefs_apply(g_object_get_data(G_OBJECT(dlg), E_PROTOCOLS_PAGE_KEY));
/* show/hide the Save button - depending on setting */
save_bt = g_object_get_data(G_OBJECT(prefs_w), E_PREFSW_SAVE_BT_KEY);
preferences). */
free_prefs(&saved_prefs);
prefs_modules_foreach(module_prefs_clean, NULL);
+ protocols_prefs_destroy(g_object_get_data(G_OBJECT(dlg), E_PROTOCOLS_PAGE_KEY));
}
--- /dev/null
+/* prefs_protocols.c
+ * Dialog box for preferences common for all protocols
+ *
+ * $Id$
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <gtk/gtk.h>
+
+#include <epan/prefs.h>
+
+#include "gtk/prefs_protocols.h"
+#include "gtk/prefs_dlg.h"
+
+#define PROTOCOLS_SHOW_HIDDEN_KEY "display_hidden_items"
+#define PROTOCOLS_TABLE_ROWS 1
+
+GtkWidget*
+protocols_prefs_show(void)
+{
+ GtkWidget *main_tb, *main_vb;
+ GtkWidget *display_hidden_cb;
+ GtkTooltips *tooltips = gtk_tooltips_new();
+ int pos = 0;
+
+ /* Main vertical box */
+ main_vb = gtk_vbox_new(FALSE, 7);
+ gtk_container_border_width(GTK_CONTAINER(main_vb), 5);
+
+ /* Main table */
+ main_tb = gtk_table_new(PROTOCOLS_TABLE_ROWS, 1, FALSE);
+ gtk_box_pack_start(GTK_BOX(main_vb), main_tb, FALSE, FALSE, 0);
+ gtk_table_set_row_spacings(GTK_TABLE(main_tb), 10);
+ gtk_table_set_col_spacings(GTK_TABLE(main_tb), 15);
+ gtk_widget_show(main_tb);
+ g_object_set_data(G_OBJECT(main_tb), E_TOOLTIPS_KEY, tooltips);
+
+ /* Show hidden protocol items in packet list */
+ display_hidden_cb = create_preference_check_button(main_tb, pos++,
+ "Display hidden protocol items:",
+ "Display all hidden protocol items in the packet list.",
+ prefs.display_hidden_proto_items);
+ g_object_set_data(G_OBJECT(main_vb), PROTOCOLS_SHOW_HIDDEN_KEY, display_hidden_cb);
+
+ /* Show 'em what we got */
+ gtk_widget_show_all(main_vb);
+
+ return main_vb;
+}
+
+void
+protocols_prefs_fetch(GtkWidget *w _U_)
+{
+ GtkWidget *display_hidden_cb;
+
+ display_hidden_cb = (GtkWidget *)g_object_get_data(G_OBJECT(w), PROTOCOLS_SHOW_HIDDEN_KEY);
+ prefs.display_hidden_proto_items = (GTK_TOGGLE_BUTTON (display_hidden_cb)->active ? TRUE : FALSE);
+}
+
+void
+protocols_prefs_apply(GtkWidget *w _U_)
+{
+}
+
+void
+protocols_prefs_destroy(GtkWidget *w _U_)
+{
+}
+
--- /dev/null
+/* prefs_protocols.h
+ * Definitions for preferences common for all protocols
+ *
+ * $Id$
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __PREFS_PROTOCOLS_H__
+#define __PREFS_PROTOCOLS_H__
+
+/** @file
+ * "Protocols" preferences page.
+ * @ingroup prefs_group
+ */
+
+/** Build a page for preferences common for all protocols
+ *
+ * @return the new preferences page
+ */
+GtkWidget *protocols_prefs_show(void);
+
+/** Fetch preference values from page.
+ *
+ * @param widget widget from protocols_prefs_show()
+ */
+void protocols_prefs_fetch(GtkWidget *widget);
+
+/** Apply preference values from page.
+ *
+ * @param widget widget from protocols_prefs_show()
+ */
+void protocols_prefs_apply(GtkWidget *widget);
+
+/** Destroy preference values from page.
+ *
+ * @param widget widget from protocols_prefs_show()
+ */
+void protocols_prefs_destroy(GtkWidget *widget);
+
+#endif