from Thomas Palmer: add a preference setting for filter toolbar placement

svn path=/trunk/; revision=10555
This commit is contained in:
Ulf Lamping 2004-04-06 19:02:18 +00:00
parent 38f778743a
commit cbcacf7e48
6 changed files with 40 additions and 7 deletions

View File

@ -2132,6 +2132,7 @@ And assorted fixes and enhancements by the people listed above and by:
Nick Black <dank [AT] reflexsecurity.com>
Bill Guyton <guyton [AT] bguyton.com>
Chernishov Yury <Chernishov [AT] iskrauraltel.ru>
Thomas Palmer <Thomas.Palmer [AT] Gunter.AF.mil>
Alain Magloire <alainm[AT]rcsm.ece.mcgill.ca> was kind enough to

View File

@ -2167,6 +2167,7 @@ B<http://www.ethereal.com>.
Nick Black <dank [AT] reflexsecurity.com>
Bill Guyton <guyton [AT] bguyton.com>
Love Hörnquist Åstrand <lha [AT] it.su.se>
Thomas Palmer <Thomas.Palmer [AT] Gunter.AF.mil>
Alain Magloire <alainm[AT]rcsm.ece.mcgill.ca> was kind enough to give his
permission to use his version of snprintf.c.

View File

@ -1,7 +1,7 @@
/* gui_prefs.c
* Dialog box for GUI preferences
*
* $Id: gui_prefs.c,v 1.66 2004/03/13 15:15:24 ulfl Exp $
* $Id: gui_prefs.c,v 1.67 2004/04/06 19:02:18 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -62,6 +62,7 @@ static gint recent_files_count_changed_cb(GtkWidget *recent_files_entry _U_,
#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"
@ -109,6 +110,12 @@ static const enum_val_t altern_colors_vals[] = {
};
#endif
static const enum_val_t filter_toolbar_placement_vals[] = {
{ "Below the main toolbar", FALSE },
{ "Insert into statusbar", TRUE },
{ NULL, 0 }
};
static const enum_val_t highlight_style_vals[] = {
{ "Bold", FALSE },
{ "Inverse", TRUE },
@ -156,6 +163,7 @@ gui_prefs_show(void)
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
@ -237,6 +245,12 @@ gui_prefs_show(void)
OBJECT_SET_DATA(main_vb, GUI_TOOLBAR_STYLE_KEY,
toolbar_style_om);
/* 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);
/* Geometry prefs */
save_position_cb = create_preference_check_button(main_tb, pos++,
"Save window position:", NULL, prefs.gui_geometry_save_position);
@ -422,6 +436,8 @@ gui_prefs_fetch(GtkWidget *w)
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 @@ gui_prefs_apply(GtkWidget *w _U_)
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

View File

@ -1,6 +1,6 @@
/* main.c
*
* $Id: main.c,v 1.421 2004/04/06 16:08:56 gerald Exp $
* $Id: main.c,v 1.422 2004/04/06 19:02:18 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -3546,9 +3546,7 @@ void foreach_remove_a_child(GtkWidget *widget, gpointer data) {
void main_widgets_rearrange(void) {
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);

17
prefs.c
View File

@ -1,7 +1,7 @@
/* prefs.c
* Routines for handling preferences
*
* $Id: prefs.c,v 1.127 2004/02/28 04:39:12 guy Exp $
* $Id: prefs.c,v 1.128 2004/04/06 19:02:17 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -921,6 +921,7 @@ read_prefs(int *gpf_errno_return, int *gpf_read_errno_return,
prefs.gui_ptree_line_style = 0;
prefs.gui_ptree_expander_style = 1;
prefs.gui_hex_dump_highlight_style = 1;
prefs.filter_toolbar_show_in_statusbar = FALSE;
prefs.gui_toolbar_main_style = TB_STYLE_ICONS;
#ifdef WIN32
prefs.gui_font_name1 = g_strdup("-*-lucida console-medium-r-*-*-*-100-*-*-*-*-*-*");
@ -1271,6 +1272,7 @@ prefs_set_pref(char *prefarg)
#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_IN_STATUSBAR "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"
@ -1524,6 +1526,13 @@ set_pref(gchar *pref_name, gchar *value)
} 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);
} else if (strcmp(pref_name, PRS_GUI_FILTER_TOOLBAR_IN_STATUSBAR) == 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_TOOLBAR_MAIN_SHOW) == 0) {
/* obsoleted by recent setting */
} else if (strcmp(pref_name, PRS_GUI_TOOLBAR_MAIN_STYLE) == 0) {
@ -2110,6 +2119,11 @@ write_prefs(char **pf_path_return)
fprintf(pf, PRS_GUI_ALTERN_COLORS ": %s\n",
prefs.gui_altern_colors == TRUE ? "TRUE" : "FALSE");
fprintf(pf, "\n# Place filter toolbar inside the statusbar?\n");
fprintf(pf, "# TRUE or FALSE (case-insensitive).\n");
fprintf(pf, PRS_GUI_FILTER_TOOLBAR_IN_STATUSBAR ": %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 +2276,7 @@ copy_prefs(e_prefs *dest, e_prefs *src)
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;

View File

@ -1,7 +1,7 @@
/* prefs.h
* Definitions for preference handling routines
*
* $Id: prefs.h,v 1.56 2004/02/01 20:28:10 ulfl Exp $
* $Id: prefs.h,v 1.57 2004/04/06 19:02:17 ulfl Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@ -78,6 +78,7 @@ typedef struct _e_prefs {
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;