Ethereal-dev: [Ethereal-dev] Changes to allow the movement of the filter toolbar via a gui pre
Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.
All,
Below are diffs of main.c, gui_prefs.c, prefs.h, and prefs.c that allow the movement of the Filter Toolbar from the bottom "Status Bar" to just below the main toolbar. Under GTK2, the status bar is unreadable when the filter toolbar is in the status bar. I have built and tested this on W2K using Winpcap 3.1 beta. I hope that this is useful to someone.
tjp
C:\ethereal-2004-04-01>diff -u -d c:\p\gui_prefs.c c:\ethereal-2004-04-01\gtk\gui_prefs.c
--- c:\p\gui_prefs.c 2004-03-13 09:15:24.000000000 -0600
+++ c:\ethereal-2004-04-01\gtk\gui_prefs.c 2004-04-01 14:40:02.000000000 -0600
@@ -62,6 +62,7 @@
#else
#define ALTERN_COLORS_KEY "altern_colors"
#endif
+#define FILTER_TOOLBAR_PLACEMENT_KEY "filter_toolbar_show_in_statusbar"
#define HEX_DUMP_HIGHLIGHT_STYLE_KEY "hex_dump_highlight_style"
#define GEOMETRY_POSITION_KEY "geometry_position"
#define GEOMETRY_SIZE_KEY "geometry_size"
@@ -108,6 +109,12 @@
{ NULL, 0 }
};
#endif
+static const enum_val_t filter_toolbar_placement_vals[] = {
+ { "Top", FALSE },
+ { "Bottom", TRUE },
+ { NULL, 0 }
+};
+
static const enum_val_t highlight_style_vals[] = {
{ "Bold", FALSE },
@@ -156,6 +163,7 @@
GtkWidget *scrollbar_om, *plist_browse_om;
GtkWidget *ptree_browse_om, *highlight_style_om;
GtkWidget *fileopen_rb, *fileopen_dir_te, *toolbar_style_om;
+ GtkWidget *filter_toolbar_placement_om;
GtkWidget *recent_files_count_max_te;
GtkWidget *save_position_cb, *save_size_cb, *save_maximized_cb;
#if GTK_MAJOR_VERSION < 2
@@ -223,6 +231,12 @@
OBJECT_SET_DATA(main_vb, ALTERN_COLORS_KEY, altern_colors_om);
#endif
+ /* Placement of Filter toolbar */
+ filter_toolbar_placement_om = create_preference_option_menu(main_tb, pos++,
+ "Filter toolbar placement:", NULL,
+ filter_toolbar_placement_vals, prefs.filter_toolbar_show_in_statusbar);
+ OBJECT_SET_DATA(main_vb, FILTER_TOOLBAR_PLACEMENT_KEY, filter_toolbar_placement_om);
+
/* Hex Dump highlight style */
highlight_style_om = create_preference_option_menu(main_tb, pos++,
"Hex display highlight style:", NULL, highlight_style_vals,
@@ -422,6 +436,8 @@
prefs.gui_altern_colors = fetch_enum_value(
OBJECT_GET_DATA(w, ALTERN_COLORS_KEY), altern_colors_vals);
#endif
+ prefs.filter_toolbar_show_in_statusbar = fetch_enum_value(
+ OBJECT_GET_DATA(w, FILTER_TOOLBAR_PLACEMENT_KEY), filter_toolbar_placement_vals);
prefs.gui_hex_dump_highlight_style = fetch_enum_value(
OBJECT_GET_DATA(w, HEX_DUMP_HIGHLIGHT_STYLE_KEY),
highlight_style_vals);
@@ -505,6 +521,7 @@
set_plist_sel_browse(prefs.gui_plist_sel_browse);
set_ptree_sel_browse_all(prefs.gui_ptree_sel_browse);
set_tree_styles_all();
+ main_widgets_rearrange();
}
void
C:\ethereal-2004-04-01>diff -u -d c:\p\main.c c:\ethereal-2004-04-01\gtk\main.c
--- c:\p\main.c 2004-03-23 15:19:56.000000000 -0600
+++ c:\ethereal-2004-04-01\gtk\main.c 2004-04-01 14:22:34.000000000 -0600
@@ -3548,8 +3548,7 @@
gint widgets = 0;
GtkWidget *w[10];
/* XXX: add this to the recent settings */
- gboolean filter_toolbar_show_in_statusbar = TRUE;
-
+ gboolean filter_toolbar_show_in_statusbar = prefs.filter_toolbar_show_in_statusbar;
/* be a bit faster */
gtk_widget_hide(main_vbox);
C:\ethereal-2004-04-01>diff -u -d c:\p\prefs.h c:\ethereal-2004-04-01\prefs.h
--- c:\p\prefs.h 2004-02-01 14:28:10.000000000 -0600
+++ c:\ethereal-2004-04-01\prefs.h 2004-04-01 14:06:16.000000000 -0600
@@ -78,6 +78,7 @@
gboolean gui_plist_sel_browse;
gboolean gui_ptree_sel_browse;
gboolean gui_altern_colors;
+ gboolean filter_toolbar_show_in_statusbar;
gint gui_ptree_line_style;
gint gui_ptree_expander_style;
gboolean gui_hex_dump_highlight_style;
C:\ethereal-2004-04-01>diff -u -d c:\p\prefs.c c:\ethereal-2004-04-01\prefs.c
--- c:\p\prefs.c 2004-02-27 22:39:12.000000000 -0600
+++ c:\ethereal-2004-04-01\prefs.c 2004-04-01 15:10:28.000000000 -0600
@@ -1271,6 +1271,7 @@
#define PRS_GUI_PLIST_SEL_BROWSE "gui.packet_list_sel_browse"
#define PRS_GUI_PTREE_SEL_BROWSE "gui.protocol_tree_sel_browse"
#define PRS_GUI_ALTERN_COLORS "gui.tree_view_altern_colors"
+#define PRS_GUI_FILTER_TOOLBAR_ON_BOTTOM "gui.filter_toolbar_show_in_statusbar"
#define PRS_GUI_PTREE_LINE_STYLE "gui.protocol_tree_line_style"
#define PRS_GUI_PTREE_EXPANDER_STYLE "gui.protocol_tree_expander_style"
#define PRS_GUI_HEX_DUMP_HIGHLIGHT_STYLE "gui.hex_dump_highlight_style"
@@ -1521,6 +1522,13 @@
} else if (strcmp(pref_name, PRS_GUI_PTREE_EXPANDER_STYLE) == 0) {
prefs.gui_ptree_expander_style =
find_index_from_string_array(value, gui_ptree_expander_style_text, 1);
+ } else if (strcmp(pref_name, PRS_GUI_FILTER_TOOLBAR_ON_BOTTOM) == 0) {
+ if (strcasecmp(value, "true") == 0) {
+ prefs.filter_toolbar_show_in_statusbar = TRUE;
+ }
+ else {
+ prefs.filter_toolbar_show_in_statusbar = FALSE;
+ }
} else if (strcmp(pref_name, PRS_GUI_HEX_DUMP_HIGHLIGHT_STYLE) == 0) {
prefs.gui_hex_dump_highlight_style =
find_index_from_string_array(value, gui_hex_dump_highlight_style_text, 1);
@@ -2110,6 +2118,11 @@
fprintf(pf, PRS_GUI_ALTERN_COLORS ": %s\n",
prefs.gui_altern_colors == TRUE ? "TRUE" : "FALSE");
+ fprintf(pf, "\n# Place filter toolbar on bottom?\n");
+ fprintf(pf, "# TRUE or FALSE (case-insensitive).\n");
+ fprintf(pf, PRS_GUI_FILTER_TOOLBAR_ON_BOTTOM ": %s\n",
+ prefs.filter_toolbar_show_in_statusbar == TRUE ? "TRUE" : "FALSE");
+
fprintf(pf, "\n# Protocol-tree line style.\n");
fprintf(pf, "# One of: NONE, SOLID, DOTTED, TABBED\n");
fprintf(pf, PRS_GUI_PTREE_LINE_STYLE ": %s\n",
@@ -2262,6 +2275,7 @@
dest->gui_plist_sel_browse = src->gui_plist_sel_browse;
dest->gui_ptree_sel_browse = src->gui_ptree_sel_browse;
dest->gui_altern_colors = src->gui_altern_colors;
+ dest->filter_toolbar_show_in_statusbar = src->filter_toolbar_show_in_statusbar;
dest->gui_ptree_line_style = src->gui_ptree_line_style;
dest->gui_ptree_expander_style = src->gui_ptree_expander_style;
dest->gui_hex_dump_highlight_style = src->gui_hex_dump_highlight_style;
- Follow-Ups:
- Prev by Date: Re: [Ethereal-dev] FW: [Ethereal-users] post processing script for "-R msnms -V"
- Next by Date: [Ethereal-dev] nettl (HP-UX) changes for FDDI & Token Ring
- Previous by thread: Re: [Ethereal-dev] FW: [Ethereal-users] post processing script for "-R msnms -V"
- Next by thread: Re: [Ethereal-dev] Changes to allow the movement of the filter toolbar via a gui preferences variable
- Index(es):