forked from osmocom/wireshark
In order to reduce the height of the Preference dialog moving several items from the User Interface page to the Layout page.
svn path=/trunk/; revision=17444
This commit is contained in:
parent
2808928c90
commit
fc662e5261
179
gtk/gui_prefs.c
179
gtk/gui_prefs.c
|
@ -56,18 +56,8 @@ static gint fileopen_preview_changed_cb(GtkWidget *myentry _U_, GdkEvent *event,
|
|||
static void fileopen_selected_cb(GtkWidget *mybutton_rb _U_, gpointer parent_w);
|
||||
static gint recent_files_count_changed_cb(GtkWidget *recent_files_entry _U_,
|
||||
GdkEvent *event _U_, gpointer parent_w);
|
||||
|
||||
#define SCROLLBAR_PLACEMENT_KEY "scrollbar_placement"
|
||||
#define PLIST_SEL_BROWSE_KEY "plist_sel_browse"
|
||||
#define PTREE_SEL_BROWSE_KEY "ptree_sel_browse"
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
#define PTREE_LINE_STYLE_KEY "ptree_line_style"
|
||||
#define PTREE_EXPANDER_STYLE_KEY "ptree_expander_style"
|
||||
#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"
|
||||
#define GEOMETRY_MAXIMIZED_KEY "geometry_maximized"
|
||||
|
@ -80,9 +70,6 @@ static gint recent_files_count_changed_cb(GtkWidget *recent_files_entry _U_,
|
|||
#define GUI_ASK_UNSAVED_KEY "ask_unsaved"
|
||||
#define GUI_WEBBROWSER_KEY "webbrowser"
|
||||
#define GUI_FIND_WRAP_KEY "find_wrap"
|
||||
#define GUI_WINDOW_TITLE_KEY "window_title"
|
||||
|
||||
#define GUI_TOOLBAR_STYLE_KEY "toolbar_style"
|
||||
|
||||
static const enum_val_t scrollbar_placement_vals[] = {
|
||||
{ "FALSE", "Left", FALSE },
|
||||
|
@ -174,32 +161,27 @@ static char recent_files_count_max_str[128] = "";
|
|||
static char open_file_preview_str[128] = "";
|
||||
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
#define GUI_TABLE_ROWS 11
|
||||
#define GUI_TABLE_ROWS 5
|
||||
#else
|
||||
#define GUI_TABLE_ROWS 10
|
||||
#define GUI_TABLE_ROWS 4
|
||||
#endif
|
||||
|
||||
GtkWidget*
|
||||
gui_prefs_show(void)
|
||||
{
|
||||
GtkWidget *main_tb, *main_vb, *hbox;
|
||||
GtkWidget *scrollbar_om, *plist_browse_om;
|
||||
GtkWidget *ptree_browse_om, *highlight_style_om;
|
||||
GtkWidget *main_tb, *main_vb;
|
||||
GtkWidget *plist_browse_om;
|
||||
GtkWidget *ptree_browse_om;
|
||||
#ifdef _WIN32
|
||||
GtkWidget *console_open_om;
|
||||
#endif
|
||||
GtkWidget *fileopen_rb, *fileopen_dir_te, *fileopen_preview_te;
|
||||
GtkWidget *toolbar_style_om;
|
||||
GtkWidget *filter_toolbar_placement_om;
|
||||
GtkWidget *recent_files_count_max_te, *ask_unsaved_cb, *find_wrap_cb;
|
||||
GtkWidget *webbrowser_te;
|
||||
GtkWidget *window_title_te;
|
||||
GtkWidget *webbrowser_te;
|
||||
GtkWidget *save_position_cb, *save_size_cb, *save_maximized_cb;
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
GtkWidget *expander_style_om, *line_style_om;
|
||||
#else
|
||||
GtkWidget *altern_colors_om;
|
||||
#endif
|
||||
|
||||
GtkTooltips *tooltips = gtk_tooltips_new();
|
||||
|
||||
int pos = 0;
|
||||
char current_val_str[128];
|
||||
|
||||
|
@ -210,94 +192,54 @@ gui_prefs_show(void)
|
|||
main_vb = gtk_vbox_new(FALSE, 7);
|
||||
gtk_container_border_width( GTK_CONTAINER(main_vb), 5 );
|
||||
|
||||
/* Main horizontal box */
|
||||
/* XXX - Is there a better way to center the table? */
|
||||
hbox = gtk_hbox_new(FALSE, 7);
|
||||
gtk_box_pack_start (GTK_BOX(main_vb), hbox, TRUE, FALSE, 0);
|
||||
|
||||
/* Main table */
|
||||
main_tb = gtk_table_new(GUI_TABLE_ROWS, 2, FALSE);
|
||||
gtk_box_pack_start( GTK_BOX(hbox), main_tb, TRUE, FALSE, 0 );
|
||||
gtk_table_set_row_spacings( GTK_TABLE(main_tb), 10 );
|
||||
gtk_table_set_col_spacings( GTK_TABLE(main_tb), 15 );
|
||||
gtk_table_set_col_spacing( GTK_TABLE(main_tb), 0, 50 );
|
||||
|
||||
/* Scrollbar placement */
|
||||
scrollbar_om = create_preference_option_menu(main_tb, pos++,
|
||||
"Vertical scrollbar placement:", NULL, scrollbar_placement_vals,
|
||||
prefs.gui_scrollbar_on_right);
|
||||
OBJECT_SET_DATA(main_vb, SCROLLBAR_PLACEMENT_KEY, scrollbar_om);
|
||||
/* Main table */
|
||||
main_tb = gtk_table_new(GUI_TABLE_ROWS, 2, 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);
|
||||
|
||||
/* Packet list selection browseable */
|
||||
plist_browse_om = create_preference_option_menu(main_tb, pos++,
|
||||
"Packet list selection mode:", NULL, selection_mode_vals,
|
||||
prefs.gui_plist_sel_browse);
|
||||
gtk_tooltips_set_tip(tooltips, plist_browse_om, "Choose to browse "
|
||||
"or select a packet for detailed dissection.", NULL);
|
||||
OBJECT_SET_DATA(main_vb, PLIST_SEL_BROWSE_KEY, plist_browse_om);
|
||||
|
||||
/* Proto tree selection browseable */
|
||||
ptree_browse_om = create_preference_option_menu(main_tb, pos++,
|
||||
"Protocol tree selection mode:", NULL, selection_mode_vals,
|
||||
prefs.gui_ptree_sel_browse);
|
||||
gtk_tooltips_set_tip(tooltips, ptree_browse_om, "Choose to browse "
|
||||
"or select.", NULL);
|
||||
OBJECT_SET_DATA(main_vb, PTREE_SEL_BROWSE_KEY, ptree_browse_om);
|
||||
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
/* Tree line style */
|
||||
line_style_om = create_preference_option_menu(main_tb, pos++,
|
||||
"Tree line style:", NULL, line_style_vals,
|
||||
prefs.gui_ptree_line_style);
|
||||
OBJECT_SET_DATA(main_vb, PTREE_LINE_STYLE_KEY, line_style_om);
|
||||
|
||||
/* Tree expander style */
|
||||
expander_style_om = create_preference_option_menu(main_tb, pos++,
|
||||
"Tree expander style:", NULL, expander_style_vals,
|
||||
prefs.gui_ptree_expander_style);
|
||||
OBJECT_SET_DATA(main_vb, PTREE_EXPANDER_STYLE_KEY, expander_style_om);
|
||||
#else
|
||||
/* Alternating row colors in list and tree views */
|
||||
altern_colors_om = create_preference_option_menu(main_tb, pos++,
|
||||
"Alternating row colors in lists and trees:", NULL,
|
||||
altern_colors_vals, prefs.gui_altern_colors);
|
||||
OBJECT_SET_DATA(main_vb, ALTERN_COLORS_KEY, altern_colors_om);
|
||||
#endif
|
||||
|
||||
/* Hex Dump highlight style */
|
||||
highlight_style_om = create_preference_option_menu(main_tb, pos++,
|
||||
"Hex display highlight style:", NULL, highlight_style_vals,
|
||||
prefs.gui_hex_dump_highlight_style);
|
||||
OBJECT_SET_DATA(main_vb, HEX_DUMP_HIGHLIGHT_STYLE_KEY,
|
||||
highlight_style_om);
|
||||
|
||||
/* Toolbar prefs */
|
||||
toolbar_style_om = create_preference_option_menu(main_tb, pos++,
|
||||
"Toolbar style:", NULL, toolbar_style_vals,
|
||||
prefs.gui_toolbar_main_style);
|
||||
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);
|
||||
gtk_tooltips_set_tip(tooltips, save_position_cb, "Whether to save the "
|
||||
"position of the main window.", NULL);
|
||||
OBJECT_SET_DATA(main_vb, GEOMETRY_POSITION_KEY, save_position_cb);
|
||||
|
||||
save_size_cb = create_preference_check_button(main_tb, pos++,
|
||||
"Save window size:", NULL, prefs.gui_geometry_save_size);
|
||||
gtk_tooltips_set_tip(tooltips, save_size_cb, "Whether to save the "
|
||||
"size of the main window.", NULL);
|
||||
OBJECT_SET_DATA(main_vb, GEOMETRY_SIZE_KEY, save_size_cb);
|
||||
|
||||
save_maximized_cb = create_preference_check_button(main_tb, pos++,
|
||||
"Save maximized state:", NULL, prefs.gui_geometry_save_maximized);
|
||||
gtk_tooltips_set_tip(tooltips, save_maximized_cb, "Whether to save the "
|
||||
"maximed state of the main window.", NULL);
|
||||
OBJECT_SET_DATA(main_vb, GEOMETRY_MAXIMIZED_KEY, save_maximized_cb);
|
||||
|
||||
#ifdef _WIN32
|
||||
/* How the console window should be opened */
|
||||
console_open_om = create_preference_option_menu(main_tb, pos++,
|
||||
"Open a console window", NULL,
|
||||
gui_console_open_vals, prefs.gui_console_open);
|
||||
console_open_om = create_preference_option_menu(main_tb, pos++,
|
||||
"Open a console window", NULL, gui_console_open_vals,
|
||||
prefs.gui_console_open);
|
||||
gtk_tooltips_set_tip(tooltips, console_open_om, "Whether to save the "
|
||||
"maximed state of the main window.", NULL);
|
||||
OBJECT_SET_DATA(main_vb, GUI_CONSOLE_OPEN_KEY, console_open_om);
|
||||
#endif
|
||||
|
||||
|
@ -310,6 +252,8 @@ gui_prefs_show(void)
|
|||
/* Directory to default File Open dialog to */
|
||||
fileopen_dir_te = create_preference_entry(main_tb, pos++,
|
||||
"Directory:", NULL, prefs.gui_fileopen_dir);
|
||||
gtk_tooltips_set_tip(tooltips, fileopen_dir_te, "Directory to "
|
||||
"default File Open dialog to.", NULL);
|
||||
OBJECT_SET_DATA(main_vb, GUI_FILEOPEN_KEY, fileopen_rb);
|
||||
OBJECT_SET_DATA(main_vb, GUI_FILEOPEN_DIR_KEY, fileopen_dir_te);
|
||||
SIGNAL_CONNECT(fileopen_rb, "clicked", fileopen_selected_cb, main_vb);
|
||||
|
@ -321,6 +265,8 @@ gui_prefs_show(void)
|
|||
"\"File Open\" preview timeout:", "Timeout, until preview gives up scanning the capture file content.", open_file_preview_str);
|
||||
g_snprintf(current_val_str, 128, "%d", prefs.gui_fileopen_preview);
|
||||
gtk_entry_set_text(GTK_ENTRY(fileopen_preview_te), current_val_str);
|
||||
gtk_tooltips_set_tip(tooltips, fileopen_preview_te, "Set delay until file "
|
||||
"is read for preview data.", NULL);
|
||||
OBJECT_SET_DATA(main_vb, GUI_FILEOPEN_PREVIEW_KEY, fileopen_preview_te);
|
||||
SIGNAL_CONNECT(fileopen_preview_te, "focus_out_event", fileopen_preview_changed_cb, main_vb);
|
||||
|
||||
|
@ -329,34 +275,36 @@ gui_prefs_show(void)
|
|||
"\"Open Recent\" max. list entries:", "Maximum number of recent files", recent_files_count_max_str);
|
||||
g_snprintf(current_val_str, 128, "%d", prefs.gui_recent_files_count_max);
|
||||
gtk_entry_set_text(GTK_ENTRY(recent_files_count_max_te), current_val_str);
|
||||
gtk_tooltips_set_tip(tooltips, recent_files_count_max_te, "Number of entries "
|
||||
"in the recent_files list.", NULL);
|
||||
OBJECT_SET_DATA(main_vb, GUI_RECENT_FILES_COUNT_KEY, recent_files_count_max_te);
|
||||
SIGNAL_CONNECT(recent_files_count_max_te, "focus_out_event", recent_files_count_changed_cb, main_vb);
|
||||
|
||||
fileopen_selected_cb(NULL, main_vb);
|
||||
fileopen_selected_cb(NULL, main_vb);
|
||||
|
||||
/* ask for unsaved capture files? */
|
||||
/* ask for unsaved capture files? */
|
||||
ask_unsaved_cb = create_preference_check_button(main_tb, pos++,
|
||||
"Ask for unsaved capture files:", NULL, prefs.gui_ask_unsaved);
|
||||
gtk_tooltips_set_tip(tooltips, ask_unsaved_cb, "Whether a dialog should "
|
||||
"pop up in case of an unsaved capture file.", NULL);
|
||||
OBJECT_SET_DATA(main_vb, GUI_ASK_UNSAVED_KEY, ask_unsaved_cb);
|
||||
|
||||
/* do we want to wrap when searching for data? */
|
||||
/* do we want to wrap when searching for data? */
|
||||
find_wrap_cb = create_preference_check_button(main_tb, pos++,
|
||||
"Wrap to end/beginning of file during a find:", NULL, prefs.gui_find_wrap);
|
||||
gtk_tooltips_set_tip(tooltips, find_wrap_cb, "Whether a search should "
|
||||
"wrap in a capture file.", NULL);
|
||||
OBJECT_SET_DATA(main_vb, GUI_FIND_WRAP_KEY, find_wrap_cb);
|
||||
|
||||
/* Webbrowser */
|
||||
if (browser_needs_pref()) {
|
||||
if (browser_needs_pref()) {
|
||||
webbrowser_te = create_preference_entry(main_tb, pos++,
|
||||
"Web browser command:", NULL, prefs.gui_webbrowser);
|
||||
gtk_entry_set_text(GTK_ENTRY(webbrowser_te), prefs.gui_webbrowser);
|
||||
gtk_tooltips_set_tip(tooltips, webbrowser_te, "Command line to "
|
||||
"desired browser.", NULL);
|
||||
OBJECT_SET_DATA(main_vb, GUI_WEBBROWSER_KEY, webbrowser_te);
|
||||
}
|
||||
|
||||
/* Window title */
|
||||
window_title_te = create_preference_entry(main_tb, pos++,
|
||||
"Custom window title (prepended to existing titles):", NULL, prefs.gui_window_title);
|
||||
gtk_entry_set_text(GTK_ENTRY(window_title_te), prefs.gui_window_title);
|
||||
OBJECT_SET_DATA(main_vb, GUI_WINDOW_TITLE_KEY, window_title_te);
|
||||
}
|
||||
|
||||
/* Show 'em what we got */
|
||||
gtk_widget_show_all(main_vb);
|
||||
|
@ -414,33 +362,12 @@ fetch_enum_value(gpointer control, const enum_val_t *enumvals)
|
|||
void
|
||||
gui_prefs_fetch(GtkWidget *w)
|
||||
{
|
||||
prefs.gui_scrollbar_on_right = fetch_enum_value(
|
||||
OBJECT_GET_DATA(w, SCROLLBAR_PLACEMENT_KEY),
|
||||
scrollbar_placement_vals);
|
||||
prefs.gui_plist_sel_browse = fetch_enum_value(
|
||||
OBJECT_GET_DATA(w, PLIST_SEL_BROWSE_KEY), selection_mode_vals);
|
||||
prefs.gui_ptree_sel_browse = fetch_enum_value(
|
||||
OBJECT_GET_DATA(w, PTREE_SEL_BROWSE_KEY), selection_mode_vals);
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
prefs.gui_ptree_line_style = fetch_enum_value(
|
||||
OBJECT_GET_DATA(w, PTREE_LINE_STYLE_KEY), line_style_vals);
|
||||
prefs.gui_ptree_expander_style = fetch_enum_value(
|
||||
OBJECT_GET_DATA(w, PTREE_EXPANDER_STYLE_KEY), expander_style_vals);
|
||||
#else
|
||||
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);
|
||||
prefs.gui_toolbar_main_style = fetch_enum_value(
|
||||
OBJECT_GET_DATA(w, GUI_TOOLBAR_STYLE_KEY),
|
||||
toolbar_style_vals);
|
||||
prefs.gui_geometry_save_position =
|
||||
gtk_toggle_button_get_active(OBJECT_GET_DATA(w,
|
||||
GEOMETRY_POSITION_KEY));
|
||||
gtk_toggle_button_get_active(OBJECT_GET_DATA(w, GEOMETRY_POSITION_KEY));
|
||||
prefs.gui_geometry_save_size =
|
||||
gtk_toggle_button_get_active(OBJECT_GET_DATA(w, GEOMETRY_SIZE_KEY));
|
||||
prefs.gui_geometry_save_maximized =
|
||||
|
@ -451,7 +378,7 @@ gui_prefs_fetch(GtkWidget *w)
|
|||
#endif
|
||||
prefs.gui_fileopen_style = fetch_preference_radio_buttons_val(
|
||||
OBJECT_GET_DATA(w, GUI_FILEOPEN_KEY), gui_fileopen_vals);
|
||||
|
||||
|
||||
if (prefs.gui_fileopen_dir != NULL)
|
||||
g_free(prefs.gui_fileopen_dir);
|
||||
prefs.gui_fileopen_dir = g_strdup(gtk_entry_get_text(
|
||||
|
@ -462,18 +389,12 @@ gui_prefs_fetch(GtkWidget *w)
|
|||
|
||||
prefs.gui_find_wrap =
|
||||
gtk_toggle_button_get_active(OBJECT_GET_DATA(w, GUI_FIND_WRAP_KEY));
|
||||
|
||||
|
||||
if (browser_needs_pref()) {
|
||||
g_free(prefs.gui_webbrowser);
|
||||
prefs.gui_webbrowser = g_strdup(gtk_entry_get_text(
|
||||
GTK_ENTRY(OBJECT_GET_DATA(w, GUI_WEBBROWSER_KEY))));
|
||||
}
|
||||
|
||||
if (prefs.gui_window_title != NULL)
|
||||
g_free(prefs.gui_window_title);
|
||||
prefs.gui_window_title = g_strdup(gtk_entry_get_text(
|
||||
GTK_ENTRY(OBJECT_GET_DATA(w, GUI_WINDOW_TITLE_KEY))));
|
||||
|
||||
/*
|
||||
* XXX - we need to have a way to fetch the preferences into
|
||||
* local storage and only set the permanent preferences if there
|
||||
|
@ -543,7 +464,7 @@ gui_prefs_apply(GtkWidget *w _U_)
|
|||
packet_list_set_sel_browse(prefs.gui_plist_sel_browse);
|
||||
set_ptree_sel_browse_all(prefs.gui_ptree_sel_browse);
|
||||
set_tree_styles_all();
|
||||
main_widgets_rearrange();
|
||||
main_widgets_rearrange();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -32,10 +32,12 @@
|
|||
#include "layout_prefs.h"
|
||||
#include "gtkglobals.h"
|
||||
#include <epan/prefs.h>
|
||||
#include "prefs_dlg.h"
|
||||
#include "gui_utils.h"
|
||||
#include "main.h"
|
||||
#include "compat_macros.h"
|
||||
#include "dlg_utils.h"
|
||||
#include "../ui_util.h"
|
||||
|
||||
#include "../image/icon_layout_1.xpm"
|
||||
#include "../image/icon_layout_2.xpm"
|
||||
|
@ -48,7 +50,7 @@
|
|||
|
||||
|
||||
static void layout_validate_cb(GtkWidget *w _U_, gpointer data);
|
||||
|
||||
static gint fetch_enum_value(gpointer control, const enum_val_t *enumvals);
|
||||
|
||||
|
||||
typedef struct {
|
||||
|
@ -243,6 +245,70 @@ layout_defaults_cb (GtkWidget * w _U_, gpointer data _U_)
|
|||
layout_set(data, &default_layout);
|
||||
}
|
||||
|
||||
#define SCROLLBAR_PLACEMENT_KEY "scrollbar_placement"
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
#define PTREE_LINE_STYLE_KEY "ptree_line_style"
|
||||
#define PTREE_EXPANDER_STYLE_KEY "ptree_expander_style"
|
||||
#else
|
||||
#define ALTERN_COLORS_KEY "altern_colors"
|
||||
#endif
|
||||
#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_WINDOW_TITLE_KEY "window_title"
|
||||
|
||||
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
#define GUI_TABLE_ROWS 6
|
||||
#else
|
||||
#define GUI_TABLE_ROWS 5
|
||||
#endif
|
||||
|
||||
static const enum_val_t scrollbar_placement_vals[] = {
|
||||
{ "FALSE", "Left", FALSE },
|
||||
{ "TRUE", "Right", TRUE },
|
||||
{ NULL, NULL, 0 }
|
||||
};
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
static const enum_val_t line_style_vals[] = {
|
||||
{ "NONE", "None", 0 },
|
||||
{ "SOLID", "Solid", 1 },
|
||||
{ "DOTTED", "Dotted", 2 },
|
||||
{ "TABBED", "Tabbed", 3 },
|
||||
{ NULL, NULL, 0 }
|
||||
};
|
||||
|
||||
static const enum_val_t expander_style_vals[] = {
|
||||
{ "NONE", "None", 0 },
|
||||
{ "SQUARE", "Square", 1 },
|
||||
{ "TRIANGLE", "Triangle", 2 },
|
||||
{ "CIRCULAR", "Circular", 3 },
|
||||
{ NULL, NULL, 0 }
|
||||
};
|
||||
#else
|
||||
static const enum_val_t altern_colors_vals[] = {
|
||||
{ "FALSE", "No", FALSE },
|
||||
{ "TRUE", "Yes", TRUE },
|
||||
{ NULL, NULL, 0 }
|
||||
};
|
||||
#endif
|
||||
static const enum_val_t highlight_style_vals[] = {
|
||||
{ "FALSE", "Bold", FALSE },
|
||||
{ "TRUE", "Inverse", TRUE },
|
||||
{ NULL, NULL, 0 }
|
||||
};
|
||||
static const enum_val_t filter_toolbar_placement_vals[] = {
|
||||
{ "FALSE", "Below the main toolbar", FALSE },
|
||||
{ "TRUE", "Insert into statusbar", TRUE },
|
||||
{ NULL, NULL, 0 }
|
||||
};
|
||||
static const enum_val_t toolbar_style_vals[] = {
|
||||
{ "ICONS", "Icons only", TB_STYLE_ICONS },
|
||||
{ "TEXT", "Text only", TB_STYLE_TEXT },
|
||||
{ "BOTH", "Icons & Text", TB_STYLE_BOTH },
|
||||
{ NULL, NULL, 0 }
|
||||
};
|
||||
|
||||
|
||||
GtkWidget*
|
||||
layout_prefs_show(void)
|
||||
|
@ -250,17 +316,31 @@ layout_prefs_show(void)
|
|||
#if GTK_MAJOR_VERSION < 2
|
||||
GtkAccelGroup *accel_group;
|
||||
#endif
|
||||
GtkTooltips *tooltips;
|
||||
|
||||
GtkWidget *main_vb, *button_hb, *type_tb;
|
||||
GtkWidget *pane_fr, *pane_vb;
|
||||
GtkWidget *radio_hb, *radio_vb;
|
||||
GtkWidget *default_vb, *default_bt;
|
||||
GtkWidget *main_tb, *hbox;
|
||||
GtkWidget *scrollbar_om;
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
GtkWidget *expander_style_om, *line_style_om;
|
||||
#else
|
||||
GtkWidget *altern_colors_om;
|
||||
#endif
|
||||
GtkWidget *highlight_style_om;
|
||||
GtkWidget *toolbar_style_om;
|
||||
GtkWidget *filter_toolbar_placement_om;
|
||||
GtkWidget *window_title_te;
|
||||
|
||||
GtkTooltips *tooltips = gtk_tooltips_new();
|
||||
|
||||
const char ** inline_txt [LAYOUT_QTY] = {
|
||||
icon_layout_5_xpm, icon_layout_2_xpm, icon_layout_1_xpm,
|
||||
icon_layout_4_xpm, icon_layout_3_xpm, icon_layout_6_xpm };
|
||||
GtkWidget ** layout_type_buttons = g_malloc (sizeof(GtkWidget*) * LAYOUT_QTY);
|
||||
|
||||
int pos = 0;
|
||||
int i;
|
||||
|
||||
|
||||
|
@ -276,14 +356,21 @@ layout_prefs_show(void)
|
|||
/*gtk_window_add_accel_group(GTK_WINDOW(main_win), accel_group);*/
|
||||
#endif
|
||||
|
||||
/* Enable tooltips */
|
||||
tooltips = gtk_tooltips_new();
|
||||
/* pane frame */
|
||||
pane_fr = gtk_frame_new("Panes");
|
||||
gtk_box_pack_start(GTK_BOX(main_vb), pane_fr, FALSE, FALSE, 0);
|
||||
gtk_widget_show(pane_fr);
|
||||
|
||||
/* pane vertical box */
|
||||
pane_vb = gtk_vbox_new(FALSE, 7);
|
||||
gtk_container_set_border_width(GTK_CONTAINER(pane_vb), 5);
|
||||
gtk_container_add(GTK_CONTAINER(pane_fr), pane_vb);
|
||||
gtk_widget_show(pane_vb);
|
||||
|
||||
/* button hbox */
|
||||
button_hb = gtk_hbox_new(FALSE, 0);
|
||||
gtk_container_set_border_width(GTK_CONTAINER(button_hb), 6);
|
||||
gtk_box_pack_start (GTK_BOX(main_vb), button_hb, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX(pane_vb), button_hb, FALSE, FALSE, 0);
|
||||
|
||||
/* pane layout */
|
||||
for (i=0; i<LAYOUT_QTY; ++i)
|
||||
|
@ -304,7 +391,7 @@ layout_prefs_show(void)
|
|||
/* radio hbox */
|
||||
radio_hb = gtk_hbox_new(FALSE, 0);
|
||||
gtk_container_set_border_width(GTK_CONTAINER(radio_hb), 6);
|
||||
gtk_box_pack_start (GTK_BOX(main_vb), radio_hb, FALSE, FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX(pane_vb), radio_hb, FALSE, FALSE, 0);
|
||||
|
||||
radio_vb = layout_content_radio_vbox(main_vb, tooltips, 1, prefs.gui_layout_content_1);
|
||||
gtk_container_set_border_width(GTK_CONTAINER(radio_vb), 6);
|
||||
|
@ -322,18 +409,113 @@ layout_prefs_show(void)
|
|||
OBJECT_SET_DATA(main_vb, LAYOUT_CONTENT3_VB_KEY, radio_vb);
|
||||
|
||||
default_vb = gtk_vbox_new(FALSE, 0);
|
||||
default_bt = gtk_button_new_with_label("Defaults");
|
||||
gtk_tooltips_set_tip (tooltips, default_bt, "Reset the pane layout settings to default values.", NULL);
|
||||
default_bt = gtk_button_new_with_label("Default panes");
|
||||
gtk_tooltips_set_tip (tooltips, default_bt,
|
||||
"Reset the pane layout settings to default values.", NULL);
|
||||
SIGNAL_CONNECT(default_bt, "clicked", layout_defaults_cb, main_vb);
|
||||
gtk_box_pack_end(GTK_BOX(default_vb), default_bt, FALSE, FALSE, 0);
|
||||
gtk_box_pack_end(GTK_BOX(radio_hb), default_vb, FALSE, FALSE, 0);
|
||||
|
||||
/* Main horizontal box */
|
||||
/* XXX - Is there a better way to center the table? */
|
||||
hbox = gtk_hbox_new(FALSE, 7);
|
||||
gtk_box_pack_start (GTK_BOX(main_vb), hbox, TRUE, FALSE, 0);
|
||||
|
||||
/* Main table */
|
||||
main_tb = gtk_table_new(GUI_TABLE_ROWS, 2, FALSE);
|
||||
gtk_box_pack_start( GTK_BOX(hbox), 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 );
|
||||
|
||||
/* Scrollbar placement */
|
||||
scrollbar_om = create_preference_option_menu(main_tb, pos++,
|
||||
"Vertical scrollbar placement:", NULL, scrollbar_placement_vals,
|
||||
prefs.gui_scrollbar_on_right);
|
||||
gtk_tooltips_set_tip(tooltips, scrollbar_om,
|
||||
"Select where the vertical scrollbar "
|
||||
"will be displayed in the panes.", NULL);
|
||||
OBJECT_SET_DATA(main_vb, SCROLLBAR_PLACEMENT_KEY, scrollbar_om);
|
||||
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
/* Tree line style */
|
||||
line_style_om = create_preference_option_menu(main_tb, pos++,
|
||||
"Tree line style:", NULL, line_style_vals,
|
||||
prefs.gui_ptree_line_style);
|
||||
gtk_tooltips_set_tip(tooltips, line_style_om,
|
||||
"Select the style in which trees "
|
||||
"will be displayed in the packet "
|
||||
"detail pane.", NULL);
|
||||
OBJECT_SET_DATA(main_vb, PTREE_LINE_STYLE_KEY, line_style_om);
|
||||
|
||||
/* Tree expander style */
|
||||
expander_style_om = create_preference_option_menu(main_tb, pos++,
|
||||
"Tree expander style:", NULL, expander_style_vals,
|
||||
prefs.gui_ptree_expander_style);
|
||||
gtk_tooltips_set_tip(tooltips, expander_style_om,
|
||||
"Select the style in which the "
|
||||
"expander will be displayed in "
|
||||
"the panes displayed.", NULL);
|
||||
OBJECT_SET_DATA(main_vb, PTREE_EXPANDER_STYLE_KEY, expander_style_om);
|
||||
#else
|
||||
/* Alternating row colors in list and tree views */
|
||||
altern_colors_om = create_preference_option_menu(main_tb, pos++,
|
||||
"Alternating row colors in lists and trees:", NULL,
|
||||
altern_colors_vals, prefs.gui_altern_colors);
|
||||
gtk_tooltips_set_tip(tooltips, altern_colors_om,
|
||||
"Select whether or not the rows of "
|
||||
"lists and trees have alternating color.", NULL);
|
||||
OBJECT_SET_DATA(main_vb, ALTERN_COLORS_KEY, altern_colors_om);
|
||||
#endif
|
||||
|
||||
/* Hex Dump highlight style */
|
||||
highlight_style_om = create_preference_option_menu(main_tb, pos++,
|
||||
"Hex display highlight style:", NULL, highlight_style_vals,
|
||||
prefs.gui_hex_dump_highlight_style);
|
||||
gtk_tooltips_set_tip(tooltips, highlight_style_om,
|
||||
"Select the style in which the "
|
||||
"hex dump will be displayed.", NULL);
|
||||
OBJECT_SET_DATA(main_vb, HEX_DUMP_HIGHLIGHT_STYLE_KEY, highlight_style_om);
|
||||
|
||||
/* Toolbar prefs */
|
||||
toolbar_style_om = create_preference_option_menu(main_tb, pos++,
|
||||
"Toolbar style:", NULL, toolbar_style_vals,
|
||||
prefs.gui_toolbar_main_style);
|
||||
gtk_tooltips_set_tip(tooltips, toolbar_style_om,
|
||||
"Select the style in which the "
|
||||
"toolbar will be displayed.", NULL);
|
||||
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);
|
||||
gtk_tooltips_set_tip(tooltips, filter_toolbar_placement_om,
|
||||
"Select where the filter "
|
||||
"toolbar will be displayed." , NULL);
|
||||
OBJECT_SET_DATA(main_vb, FILTER_TOOLBAR_PLACEMENT_KEY, filter_toolbar_placement_om);
|
||||
|
||||
/* Window title */
|
||||
window_title_te = create_preference_entry(main_tb, pos++,
|
||||
"Custom window title (prepended to existing titles):",
|
||||
NULL, prefs.gui_window_title);
|
||||
gtk_entry_set_text(GTK_ENTRY(window_title_te), prefs.gui_window_title);
|
||||
gtk_tooltips_set_tip(tooltips, window_title_te,
|
||||
"Enter the text to be prepended to the "
|
||||
"window title.", NULL);
|
||||
OBJECT_SET_DATA(main_vb, GUI_WINDOW_TITLE_KEY, window_title_te);
|
||||
|
||||
/* Show 'em what we got */
|
||||
gtk_widget_show_all(main_vb);
|
||||
|
||||
return(main_vb);
|
||||
}
|
||||
|
||||
static gint
|
||||
fetch_enum_value(gpointer control, const enum_val_t *enumvals)
|
||||
{
|
||||
return fetch_preference_option_menu_val(GTK_WIDGET(control), enumvals);
|
||||
}
|
||||
|
||||
void
|
||||
layout_prefs_fetch(GtkWidget *w)
|
||||
{
|
||||
|
@ -345,11 +527,37 @@ layout_prefs_fetch(GtkWidget *w)
|
|||
prefs.gui_layout_content_1 = layout_fetched.content[0];
|
||||
prefs.gui_layout_content_2 = layout_fetched.content[1];
|
||||
prefs.gui_layout_content_3 = layout_fetched.content[2];
|
||||
|
||||
prefs.gui_scrollbar_on_right = fetch_enum_value(
|
||||
OBJECT_GET_DATA(w, SCROLLBAR_PLACEMENT_KEY),
|
||||
scrollbar_placement_vals);
|
||||
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
prefs.gui_ptree_line_style = fetch_enum_value(
|
||||
OBJECT_GET_DATA(w, PTREE_LINE_STYLE_KEY), line_style_vals);
|
||||
prefs.gui_ptree_expander_style = fetch_enum_value(
|
||||
OBJECT_GET_DATA(w, PTREE_EXPANDER_STYLE_KEY), expander_style_vals);
|
||||
#else
|
||||
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);
|
||||
prefs.gui_toolbar_main_style = fetch_enum_value(
|
||||
OBJECT_GET_DATA(w, GUI_TOOLBAR_STYLE_KEY), toolbar_style_vals);
|
||||
|
||||
if (prefs.gui_window_title != NULL)
|
||||
g_free(prefs.gui_window_title);
|
||||
prefs.gui_window_title = g_strdup(gtk_entry_get_text(
|
||||
GTK_ENTRY(OBJECT_GET_DATA(w, GUI_WINDOW_TITLE_KEY))));
|
||||
}
|
||||
|
||||
void
|
||||
layout_prefs_apply(GtkWidget *w _U_)
|
||||
{
|
||||
set_main_window_name("The Ethereal Network Analyzer");
|
||||
main_widgets_rearrange();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue