aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>2009-09-25 05:19:18 +0000
committeretxrab <etxrab@f5534014-38df-0310-8fa8-9805f1628bb7>2009-09-25 05:19:18 +0000
commit09a8ebaf72c45343733abc2bd89c7de1a4364d9d (patch)
tree505037215aa1091dd9538420931c8bc594b3fdd6
parentcffc712c120922b8a4fa6935c0d8dbc0ebfcfc22 (diff)
Make the filter toolbar style a preference.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@30136 f5534014-38df-0310-8fa8-9805f1628bb7
-rw-r--r--epan/prefs.c14
-rw-r--r--epan/prefs.h1
-rw-r--r--gtk/keys.h48
-rw-r--r--gtk/main_filter_toolbar.c14
-rw-r--r--gtk/main_toolbar.c11
-rw-r--r--gtk/prefs_gui.c28
-rw-r--r--gtk/prefs_layout.c23
7 files changed, 87 insertions, 52 deletions
diff --git a/epan/prefs.c b/epan/prefs.c
index a52c8cd051..4f9f096fb5 100644
--- a/epan/prefs.c
+++ b/epan/prefs.c
@@ -1093,6 +1093,7 @@ init_prefs(void) {
prefs.gui_hex_dump_highlight_style = 1;
prefs.filter_toolbar_show_in_statusbar = FALSE;
prefs.gui_toolbar_main_style = TB_STYLE_ICONS;
+ prefs.gui_toolbar_filter_style = TB_STYLE_TEXT;
#ifdef _WIN32
prefs.gui_font_name = g_strdup("Lucida Console 10");
#else
@@ -1638,6 +1639,7 @@ prefs_is_capture_device_hidden(const char *name)
#define PRS_GUI_GEOMETRY_MAIN_HEIGHT "gui.geometry.main.height"
#define PRS_GUI_TOOLBAR_MAIN_SHOW "gui.toolbar_main_show"
#define PRS_GUI_TOOLBAR_MAIN_STYLE "gui.toolbar_main_style"
+#define PRS_GUI_TOOLBAR_FILTER_STYLE "gui.toolbar_filter_style"
#define PRS_GUI_WEBBROWSER "gui.webbrowser"
#define PRS_GUI_WINDOW_TITLE "gui.window_title"
#define PRS_GUI_START_TITLE "gui.start_title"
@@ -1959,10 +1961,15 @@ set_pref(gchar *pref_name, gchar *value, void *private_data _U_)
} 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) {
- /* see toolbar.c for details, "icons only" is default */
+ /* see main_toolbar.c for details, "icons only" is default */
prefs.gui_toolbar_main_style =
find_index_from_string_array(value, gui_toolbar_style_text,
TB_STYLE_ICONS);
+ } else if (strcmp(pref_name, PRS_GUI_TOOLBAR_FILTER_STYLE) == 0) {
+ /* see main_filter_toolbar.c for details, "name only" is default */
+ prefs.gui_toolbar_filter_style =
+ find_index_from_string_array(value, gui_toolbar_style_text,
+ TB_STYLE_TEXT);
} else if (strcmp(pref_name, PRS_GUI_FONT_NAME_1) == 0) {
/* GTK1 font name obsolete */
} else if (strcmp(pref_name, PRS_GUI_FONT_NAME_2) == 0) {
@@ -2744,6 +2751,11 @@ write_prefs(char **pf_path_return)
fprintf(pf, PRS_GUI_TOOLBAR_MAIN_STYLE ": %s\n",
gui_toolbar_style_text[prefs.gui_toolbar_main_style]);
+ fprintf(pf, "\n# Filter Toolbar style.\n");
+ fprintf(pf, "# One of: ICONS, TEXT, BOTH\n");
+ fprintf(pf, PRS_GUI_TOOLBAR_FILTER_STYLE ": %s\n",
+ gui_toolbar_style_text[prefs.gui_toolbar_filter_style]);
+
fprintf(pf, "\n# Save window position at exit?\n");
fprintf(pf, "# TRUE or FALSE (case-insensitive).\n");
fprintf(pf, PRS_GUI_GEOMETRY_SAVE_POSITION ": %s\n",
diff --git a/epan/prefs.h b/epan/prefs.h
index 2e12c10eb4..1650e573cd 100644
--- a/epan/prefs.h
+++ b/epan/prefs.h
@@ -115,6 +115,7 @@ typedef struct _e_prefs {
gint gui_ptree_expander_style;
gboolean gui_hex_dump_highlight_style;
gint gui_toolbar_main_style;
+ gint gui_toolbar_filter_style;
gchar *gui_font_name;
color_t gui_marked_fg;
color_t gui_marked_bg;
diff --git a/gtk/keys.h b/gtk/keys.h
index cdc60c3374..99689a293b 100644
--- a/gtk/keys.h
+++ b/gtk/keys.h
@@ -57,10 +57,10 @@
#define AIRPCAP_TOOLBAR_CHANNEL_OFFSET_LABEL_KEY "airpcap_toolbar_ch_offset_lb_key"
#define AIRPCAP_TOOLBAR_FCS_CHECK_KEY "airpcap_toolbar_fcs_check_key"
#define AIRPCAP_TOOLBAR_FCS_FILTER_LABEL_KEY "airpcap_toolbar_fcs_filter_lb_key"
-#define AIRPCAP_TOOLBAR_FCS_FILTER_KEY "airpcap_toolbar_fcs_filter_key"
-#define AIRPCAP_TOOLBAR_ADVANCED_KEY "airpcap_toolbar_advanced_key"
-#define AIRPCAP_TOOLBAR_KEY_MANAGEMENT_KEY "airpcap_toolbar_key_management_key"
-#define AIRPCAP_TOOLBAR_DECRYPTION_KEY "airpcap_toolbar_decryption_key"
+#define AIRPCAP_TOOLBAR_FCS_FILTER_KEY "airpcap_toolbar_fcs_filter_key"
+#define AIRPCAP_TOOLBAR_ADVANCED_KEY "airpcap_toolbar_advanced_key"
+#define AIRPCAP_TOOLBAR_KEY_MANAGEMENT_KEY "airpcap_toolbar_key_management_key"
+#define AIRPCAP_TOOLBAR_DECRYPTION_KEY "airpcap_toolbar_decryption_key"
#define AIRPCAP_TOOLBAR_DECRYPTION_LABEL_KEY "airpcap_toolbar_decryption_lb_key"
#define AIRPCAP_ADVANCED_KEY "airpcap_advanced_key"
@@ -80,32 +80,36 @@
#define AIRPCAP_ADVANCED_ADD_KEY_KEY_LABEL_KEY "airpcap_advanced_add_key_key_label_key"
#define AIRPCAP_ADVANCED_ADD_KEY_SSID_LABEL_KEY "airpcap_advanced_add_key_ssid_label_key"
#define AIRPCAP_ADVANCED_EDIT_KEY_SELECTED_KEY "airpcap_advanced_edit_key_selected_key"
-#define AIRPCAP_ADVANCED_EDIT_KEY_OK_KEY "airpcap_advanced_edit_key_ok_key"
-#define AIRPCAP_ADVANCED_EDIT_KEY_LIST_KEY "airpcap_advanced_edit_key_list_key"
-#define AIRPCAP_ADVANCED_EDIT_KEY_TYPE_KEY "airpcap_advanced_edit_key_type_key"
-#define AIRPCAP_ADVANCED_EDIT_KEY_KEY_KEY "airpcap_advanced_edit_key_key_key"
-#define AIRPCAP_ADVANCED_EDIT_KEY_SSID_KEY "airpcap_advanced_edit_key_ssid_key"
+#define AIRPCAP_ADVANCED_EDIT_KEY_OK_KEY "airpcap_advanced_edit_key_ok_key"
+#define AIRPCAP_ADVANCED_EDIT_KEY_LIST_KEY "airpcap_advanced_edit_key_list_key"
+#define AIRPCAP_ADVANCED_EDIT_KEY_TYPE_KEY "airpcap_advanced_edit_key_type_key"
+#define AIRPCAP_ADVANCED_EDIT_KEY_KEY_KEY "airpcap_advanced_edit_key_key_key"
+#define AIRPCAP_ADVANCED_EDIT_KEY_SSID_KEY "airpcap_advanced_edit_key_ssid_key"
#define AIRPCAP_ADVANCED_EDIT_KEY_KEY_LABEL_KEY "airpcap_advanced_edit_key_key_label_key"
#define AIRPCAP_ADVANCED_EDIT_KEY_SSID_LABEL_KEY "airpcap_advanced_edit_key_ssid_label_key"
#define AIRPCAP_ADVANCED_DECRYPTION_MODE_KEY "airpcap_advanced_decryption_mode_key"
-#define AIRPCAP_ADVANCED_WPA_DECRYPTION_KEY "airpcap_advanced_wpa_decryption_key"
-#define AIRPCAP_ADVANCED_NOTEBOOK_KEY "airpcap_advanced_notebook_key"
-#define AIRPCAP_ADVANCED_CANCEL_KEY "airpcap_advanced_cancel_key"
-#define AIRPCAP_ADVANCED_OK_KEY "airpcap_advanced_ok_key"
-#define AIRPCAP_ADVANCED_KEYLIST_KEY "airpcap_advanced_keylist_key"
-#define AIRPCAP_CHECK_WINDOW_RADIO_KEEP_KEY "airpcap_check_window_radio_keep_key"
-#define AIRPCAP_CHECK_WINDOW_RADIO_MERGE_KEY "airpcap_check_window_radio_merge_key"
-#define AIRPCAP_CHECK_WINDOW_RADIO_IMPORT_KEY "airpcap_check_window_radio_import_key"
-#define AIRPCAP_CHECK_WINDOW_RADIO_IGNORE_KEY "airpcap_check_window_radio_ignore_key"
-#define AIRPCAP_CHECK_WINDOW_RADIO_GROUP_KEY "airpcap_check_window_radio_group_key"
+#define AIRPCAP_ADVANCED_WPA_DECRYPTION_KEY "airpcap_advanced_wpa_decryption_key"
+#define AIRPCAP_ADVANCED_NOTEBOOK_KEY "airpcap_advanced_notebook_key"
+#define AIRPCAP_ADVANCED_CANCEL_KEY "airpcap_advanced_cancel_key"
+#define AIRPCAP_ADVANCED_OK_KEY "airpcap_advanced_ok_key"
+#define AIRPCAP_ADVANCED_KEYLIST_KEY "airpcap_advanced_keylist_key"
+#define AIRPCAP_CHECK_WINDOW_RADIO_KEEP_KEY "airpcap_check_window_radio_keep_key"
+#define AIRPCAP_CHECK_WINDOW_RADIO_MERGE_KEY "airpcap_check_window_radio_merge_key"
+#define AIRPCAP_CHECK_WINDOW_RADIO_IMPORT_KEY "airpcap_check_window_radio_import_key"
+#define AIRPCAP_CHECK_WINDOW_RADIO_IGNORE_KEY "airpcap_check_window_radio_ignore_key"
+#define AIRPCAP_CHECK_WINDOW_RADIO_GROUP_KEY "airpcap_check_window_radio_group_key"
-#define AIRPCAP_CHECK_WINDOW_KEY "airpcap_check_window_key"
+#define AIRPCAP_CHECK_WINDOW_KEY "airpcap_check_window_key"
#define AIRPCAP_ADVANCED_SELECTED_KEY_LIST_ITEM_KEY "airpcap_advanced_selected_key_list_item_key"
-#define AIRPCAP_OPTIONS_ADVANCED_KEY "airpcap_options_advanced_key"
+#define AIRPCAP_OPTIONS_ADVANCED_KEY "airpcap_options_advanced_key"
+
+#define AIRPCAP_ADVANCED_FROM_KEY "airpcap_advanced_from_key"
+
+#define E_TB_MAIN_KEY "toolbar_main"
+#define E_TB_FILTER_KEY "toolbar_filter"
-#define AIRPCAP_ADVANCED_FROM_KEY "airpcap_advanced_from_key"
#endif
#endif
diff --git a/gtk/main_filter_toolbar.c b/gtk/main_filter_toolbar.c
index db614c81db..a7e7b04561 100644
--- a/gtk/main_filter_toolbar.c
+++ b/gtk/main_filter_toolbar.c
@@ -50,7 +50,6 @@
#include "main_toolbar.h"
#include "main_filter_toolbar.h"
-
GtkWidget *main_display_filter_widget=NULL;
/* Run the current display filter on the current packet set, and
@@ -80,7 +79,7 @@ filter_reset_cb(GtkWidget *w, gpointer data _U_)
GtkWidget *filter_toolbar_new()
{
- GtkWidget *filter_cm, *filter_te;
+ GtkWidget *filter_cm, *filter_te;
GtkWidget *filter_tb;
GList *dfilter_list = NULL;
GtkTooltips *tooltips;
@@ -104,9 +103,11 @@ GtkWidget *filter_toolbar_new()
filter_tb = gtk_toolbar_new();
gtk_toolbar_set_orientation(GTK_TOOLBAR(filter_tb),
GTK_ORIENTATION_HORIZONTAL);
- /* XXX make this a preference? */
- gtk_toolbar_set_style(GTK_TOOLBAR(filter_tb),
- GTK_TOOLBAR_TEXT);
+
+ //gtk_toolbar_set_style(GTK_TOOLBAR(filter_tb),
+ // GTK_TOOLBAR_TEXT);
+
+ g_object_set_data(G_OBJECT(top_level), E_TB_FILTER_KEY, filter_tb);
gtk_widget_show(filter_tb);
/* Create the "Filter:" button */
@@ -249,6 +250,9 @@ GtkWidget *filter_toolbar_new()
set_toolbar_object_data(E_DFILTER_TE_KEY, filter_te);
g_object_set_data(G_OBJECT(popup_menu_object), E_DFILTER_TE_KEY, filter_te);
+ /* make current preferences effective */
+ toolbar_redraw_all();
+
return filter_tb;
}
diff --git a/gtk/main_toolbar.c b/gtk/main_toolbar.c
index b16d905f2b..64dfe2fce3 100644
--- a/gtk/main_toolbar.c
+++ b/gtk/main_toolbar.c
@@ -65,9 +65,6 @@
#include "gtk/main_packet_list.h"
#endif
-/* XXX: add this key to some .h file, as it adds a key to the top level Widget? */
-#define E_TB_MAIN_KEY "toolbar_main"
-
static gboolean toolbar_init = FALSE;
#ifdef HAVE_LIBPCAP
@@ -87,17 +84,23 @@ static GtkToolItem *color_display_button, *prefs_button, *help_button;
/*
- * Redraw all toolbars (currently only the main toolbar)
+ * Redraw all toolbars
*/
void
toolbar_redraw_all(void)
{
GtkWidget *main_tb;
+ GtkWidget *filter_tb;
main_tb = g_object_get_data(G_OBJECT(top_level), E_TB_MAIN_KEY);
gtk_toolbar_set_style(GTK_TOOLBAR(main_tb),
prefs.gui_toolbar_main_style);
+
+ filter_tb = g_object_get_data(G_OBJECT(top_level), E_TB_FILTER_KEY);
+
+ gtk_toolbar_set_style(GTK_TOOLBAR(filter_tb),
+ prefs.gui_toolbar_filter_style);
}
/* Enable or disable toolbar items based on whether you have a capture file
diff --git a/gtk/prefs_gui.c b/gtk/prefs_gui.c
index 9fe35ad53b..b04d86bf8d 100644
--- a/gtk/prefs_gui.c
+++ b/gtk/prefs_gui.c
@@ -65,22 +65,22 @@ static gint recent_df_entries_changed_cb(GtkWidget *recent_df_entry _U_,
#define PLIST_SEL_BROWSE_KEY "plist_sel_browse"
#define PTREE_SEL_BROWSE_KEY "ptree_sel_browse"
#define GEOMETRY_POSITION_KEY "geometry_position"
-#define GEOMETRY_SIZE_KEY "geometry_size"
+#define GEOMETRY_SIZE_KEY "geometry_size"
#define GEOMETRY_MAXIMIZED_KEY "geometry_maximized"
-#define MACOSX_STYLE_KEY "macosx_style"
-
-#define GUI_CONSOLE_OPEN_KEY "console_open"
-#define GUI_FILEOPEN_KEY "fileopen_behavior"
-#define GUI_FILEOPEN_PREVIEW_KEY "fileopen_preview_timeout"
-#define GUI_RECENT_FILES_COUNT_KEY "recent_files_count"
-#define GUI_RECENT_DF_ENTRIES_KEY "recent_display_filter_entries"
-#define GUI_FILEOPEN_DIR_KEY "fileopen_directory"
-#define GUI_ASK_UNSAVED_KEY "ask_unsaved"
-#define GUI_WEBBROWSER_KEY "webbrowser"
-#define GUI_FIND_WRAP_KEY "find_wrap"
-#define GUI_USE_PREF_SAVE_KEY "use_pref_save"
-#define GUI_SHOW_VERSION_KEY "show_version"
+#define MACOSX_STYLE_KEY "macosx_style"
+
+#define GUI_CONSOLE_OPEN_KEY "console_open"
+#define GUI_FILEOPEN_KEY "fileopen_behavior"
+#define GUI_FILEOPEN_PREVIEW_KEY "fileopen_preview_timeout"
+#define GUI_RECENT_FILES_COUNT_KEY "recent_files_count"
+#define GUI_RECENT_DF_ENTRIES_KEY "recent_display_filter_entries"
+#define GUI_FILEOPEN_DIR_KEY "fileopen_directory"
+#define GUI_ASK_UNSAVED_KEY "ask_unsaved"
+#define GUI_WEBBROWSER_KEY "webbrowser"
+#define GUI_FIND_WRAP_KEY "find_wrap"
+#define GUI_USE_PREF_SAVE_KEY "use_pref_save"
+#define GUI_SHOW_VERSION_KEY "show_version"
static const enum_val_t scrollbar_placement_vals[] _U_ = {
{ "FALSE", "Left", FALSE },
diff --git a/gtk/prefs_layout.c b/gtk/prefs_layout.c
index 30da6b2891..3dbe8f1f79 100644
--- a/gtk/prefs_layout.c
+++ b/gtk/prefs_layout.c
@@ -252,10 +252,11 @@ layout_defaults_cb (GtkWidget * w _U_, gpointer data _U_)
#define HEX_DUMP_HIGHLIGHT_STYLE_KEY "hex_dump_highlight_style"
#define FILTER_TOOLBAR_PLACEMENT_KEY "filter_toolbar_show_in_statusbar"
#define GUI_TOOLBAR_STYLE_KEY "toolbar_style"
+#define GUI_FILTER_TOOLBAR_STYLE_KEY "filter_toolbar_style"
#define GUI_WINDOW_TITLE_KEY "window_title"
-#define GUI_TABLE_ROWS 5
+#define GUI_TABLE_ROWS 6
static const enum_val_t scrollbar_placement_vals[] = {
{ "FALSE", "Left", FALSE },
@@ -293,11 +294,12 @@ layout_prefs_show(void)
GtkWidget *default_vb, *default_bt;
GtkWidget *main_tb, *hbox;
GtkWidget *scrollbar_om;
- GtkWidget *altern_colors_om;
- GtkWidget *highlight_style_om;
- GtkWidget *toolbar_style_om;
- GtkWidget *filter_toolbar_placement_om;
- GtkWidget *window_title_te;
+ GtkWidget *altern_colors_om;
+ GtkWidget *highlight_style_om;
+ GtkWidget *toolbar_style_om;
+ GtkWidget *filter_toolbar_style_om;
+ GtkWidget *filter_toolbar_placement_om;
+ GtkWidget *window_title_te;
GtkTooltips *tooltips = gtk_tooltips_new();
@@ -414,6 +416,13 @@ layout_prefs_show(void)
toolbar_style_vals, prefs.gui_toolbar_main_style);
g_object_set_data(G_OBJECT(main_vb), GUI_TOOLBAR_STYLE_KEY, toolbar_style_om);
+ /* Filter toolbar prefs */
+ filter_toolbar_style_om = create_preference_option_menu(main_tb, pos++,
+ "Filter toolbar style:",
+ "Select the style in which the filter toolbar will be displayed.",
+ toolbar_style_vals, prefs.gui_toolbar_filter_style);
+ g_object_set_data(G_OBJECT(main_vb), GUI_FILTER_TOOLBAR_STYLE_KEY, filter_toolbar_style_om);
+
/* Placement of Filter toolbar */
filter_toolbar_placement_om = create_preference_option_menu(main_tb, pos++,
"Filter toolbar placement:",
@@ -465,6 +474,8 @@ layout_prefs_fetch(GtkWidget *w)
g_object_get_data(G_OBJECT(w), HEX_DUMP_HIGHLIGHT_STYLE_KEY), highlight_style_vals);
prefs.gui_toolbar_main_style = fetch_enum_value(
g_object_get_data(G_OBJECT(w), GUI_TOOLBAR_STYLE_KEY), toolbar_style_vals);
+ prefs.gui_toolbar_filter_style = fetch_enum_value(
+ g_object_get_data(G_OBJECT(w), GUI_FILTER_TOOLBAR_STYLE_KEY), toolbar_style_vals);
g_free(prefs.gui_window_title);
prefs.gui_window_title = g_strdup(gtk_entry_get_text(