From Ian Schorr:
Add a preference to control whether the "File > Open" dialog box should start out in the last directory in which it looked - and save that in the preferences file across invocations - or should always start out in a user-specified directory, and add another preference to specify that directory. Write out section name comments into the preferences file. Clean up white space a bit. svn path=/trunk/; revision=8699
This commit is contained in:
parent
2956d71a7b
commit
ffa3ad8ef5
1
AUTHORS
1
AUTHORS
|
@ -1891,6 +1891,7 @@ And assorted fixes and enhancements by the people listed above and by:
|
|||
Gisle Vanem <giva [AT] bgnett.no>
|
||||
Ritchie <ritchie [AT] tipsybottle.com>
|
||||
Aki Immonen <aki.immonen [AT] golftalma.fi>
|
||||
Ian Schorr <ischorr [AT] comcast.net>
|
||||
|
||||
Alain Magloire <alainm[AT]rcsm.ece.mcgill.ca> was kind enough to
|
||||
give his permission to use his version of snprintf.c.
|
||||
|
|
|
@ -1170,6 +1170,20 @@ be saved when Ethereal exits, and used when Ethereal is started again.
|
|||
If this item is selected, the size of the main Ethereal window will
|
||||
be saved when Ethereal exits, and used when Ethereal is started again.
|
||||
|
||||
=item File Open Dialog Behavior
|
||||
|
||||
This item allows the user to select how Ethereal handles the listing
|
||||
of the "File Open" Dialog when opening trace files. "Remember Last
|
||||
Directory" causes Ethereal to automatically position the dialog in the
|
||||
directory of the most recently opened file, even between launches of Ethereal.
|
||||
"Always Open in Directory" allows the user to define a persistent directory
|
||||
that the dialog will always default to.
|
||||
|
||||
=item Directory:
|
||||
|
||||
Allows the user to specify a persistent File Open directory. Trailing
|
||||
slashes or backslashes will automatically be added.
|
||||
|
||||
=item Fonts
|
||||
|
||||
The "Font..." button lets you select the font to be used for most text.
|
||||
|
@ -2119,6 +2133,7 @@ B<http://www.ethereal.com>.
|
|||
Gisle Vanem <giva [AT] bgnett.no>
|
||||
Ritchie <ritchie [AT] tipsybottle.com>
|
||||
Aki Immonen <aki.immonen [AT] golftalma.fi>
|
||||
Ian Schorr <ischorr [AT] comcast.net>
|
||||
|
||||
Alain Magloire <alainm[AT]rcsm.ece.mcgill.ca> was kind enough to give his
|
||||
permission to use his version of snprintf.c.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* file_dlg.c
|
||||
* Dialog boxes for handling files
|
||||
*
|
||||
* $Id: file_dlg.c,v 1.61 2003/09/24 08:43:34 guy Exp $
|
||||
* $Id: file_dlg.c,v 1.62 2003/10/14 23:20:17 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -105,11 +105,34 @@ file_open_cmd_cb(GtkWidget *w, gpointer data _U_)
|
|||
gtk_window_add_accel_group(GTK_WINDOW(file_open_w), accel_group);
|
||||
#endif
|
||||
|
||||
/* If we've opened a file, start out by showing the files in the directory
|
||||
in which that file resided. */
|
||||
if (last_open_dir)
|
||||
gtk_file_selection_set_filename(GTK_FILE_SELECTION(file_open_w), last_open_dir);
|
||||
|
||||
/* If the user has specified that we should always start out in a
|
||||
specified directory, and has specified a directory that we should
|
||||
always look in instead of in that directory, start out
|
||||
by showing the files in that dir. */
|
||||
if (prefs.gui_fileopen_style == FO_STYLE_SPECIFIED &&
|
||||
prefs.gui_fileopen_dir[0] != '\0') {
|
||||
gtk_file_selection_set_filename(GTK_FILE_SELECTION(file_open_w),
|
||||
prefs.gui_fileopen_dir);
|
||||
}
|
||||
else {
|
||||
/* Otherwise, check to see if we've already opened a file.
|
||||
If so, start out by showing the files in the directory in which that
|
||||
file resided. Otherwise, if the user has specified that we should
|
||||
remember the last directory in which we opened a file, use the
|
||||
directory saved in the prefs file (if one was there). */
|
||||
if (last_open_dir) {
|
||||
gtk_file_selection_set_filename(GTK_FILE_SELECTION(file_open_w),
|
||||
last_open_dir);
|
||||
}
|
||||
else {
|
||||
if (prefs.gui_fileopen_style == FO_STYLE_LAST_OPENED &&
|
||||
prefs.gui_fileopen_remembered_dir != NULL) {
|
||||
gtk_file_selection_set_filename(GTK_FILE_SELECTION(file_open_w),
|
||||
prefs.gui_fileopen_remembered_dir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Container for each row of widgets */
|
||||
main_vb = gtk_vbox_new(FALSE, 3);
|
||||
gtk_container_border_width(GTK_CONTAINER(main_vb), 5);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* gui_prefs.c
|
||||
* Dialog box for GUI preferences
|
||||
*
|
||||
* $Id: gui_prefs.c,v 1.40 2003/09/02 18:27:50 gerald Exp $
|
||||
* $Id: gui_prefs.c,v 1.41 2003/10/14 23:20:17 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -28,6 +28,8 @@
|
|||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "color.h"
|
||||
#include "color_utils.h"
|
||||
#include "globals.h"
|
||||
|
@ -56,6 +58,8 @@ static void color_cancel_cb(GtkWidget *w, gpointer data);
|
|||
static gboolean color_delete_cb(GtkWidget *prefs_w, gpointer dummy);
|
||||
static void color_destroy_cb(GtkWidget *w, gpointer data);
|
||||
static void fetch_colors(void);
|
||||
static gint fileopen_dir_changed_cb(GtkWidget *myentry _U_, GdkEvent *event, gpointer parent_w);
|
||||
static void fileopen_selected_cb(GtkWidget *mybutton_rb _U_, gpointer parent_w);
|
||||
|
||||
#define SCROLLBAR_PLACEMENT_KEY "scrollbar_placement"
|
||||
#define PLIST_SEL_BROWSE_KEY "plist_sel_browse"
|
||||
|
@ -77,6 +81,9 @@ static void fetch_colors(void);
|
|||
#define COLOR_SAMPLE_PTR_KEY "color_sample_ptr"
|
||||
#define COLOR_SELECTION_PTR_KEY "color_selection_ptr"
|
||||
|
||||
#define GUI_FILEOPEN_KEY "fileopen_behavior"
|
||||
#define GUI_FILEOPEN_DIR_KEY "fileopen_directory"
|
||||
|
||||
static const enum_val_t scrollbar_placement_vals[] = {
|
||||
{ "Left", FALSE },
|
||||
{ "Right", TRUE },
|
||||
|
@ -119,6 +126,12 @@ static const enum_val_t highlight_style_vals[] = {
|
|||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
static const enum_val_t gui_fileopen_vals[] = {
|
||||
{ "Remember last directory", FO_STYLE_LAST_OPENED },
|
||||
{ "Always start in directory:", FO_STYLE_SPECIFIED },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
/* Set to FALSE initially; set to TRUE if the user ever hits "OK" on
|
||||
the "Colors..." dialog, so that we know that they (probably) changed
|
||||
colors, and therefore that the "apply" function needs to recolor
|
||||
|
@ -135,13 +148,15 @@ static gboolean font_changed;
|
|||
has been set to the name of the font the user selected. */
|
||||
static gchar *new_font_name;
|
||||
|
||||
#define GUI_TABLE_ROWS 8
|
||||
#define GUI_TABLE_ROWS 10
|
||||
|
||||
GtkWidget*
|
||||
gui_prefs_show(void)
|
||||
{
|
||||
GtkWidget *main_tb, *main_vb, *hbox, *font_bt, *color_bt;
|
||||
GtkWidget *scrollbar_om, *plist_browse_om;
|
||||
GtkWidget *ptree_browse_om, *highlight_style_om;
|
||||
GtkWidget *fileopen_rb, *fileopen_dir_te;
|
||||
GtkWidget *save_position_cb, *save_size_cb;
|
||||
#if GTK_MAJOR_VERSION < 2
|
||||
GtkWidget *expander_style_om, *line_style_om;
|
||||
|
@ -241,6 +256,20 @@ gui_prefs_show(void)
|
|||
#endif
|
||||
SIGNAL_CONNECT(color_bt, "clicked", color_browse_cb, NULL);
|
||||
gtk_table_attach_defaults( GTK_TABLE(main_tb), color_bt, 2, 3, 1, 2 );
|
||||
|
||||
/* Directory to default File Open dialog to */
|
||||
fileopen_dir_te = create_preference_entry(main_tb, 9, "Directory:", NULL,
|
||||
prefs.gui_fileopen_dir);
|
||||
OBJECT_SET_DATA(main_vb, GUI_FILEOPEN_DIR_KEY, fileopen_dir_te);
|
||||
SIGNAL_CONNECT(fileopen_dir_te, "focus-out-event", fileopen_dir_changed_cb, main_vb);
|
||||
|
||||
/* Allow user to select where they want the File Open dialog to open to by default */
|
||||
fileopen_rb = create_preference_radio_buttons(main_tb, 8, "File Open dialog behavior:",
|
||||
NULL, gui_fileopen_vals, prefs.gui_fileopen_style);
|
||||
SIGNAL_CONNECT(fileopen_rb, "clicked", fileopen_selected_cb, main_vb);
|
||||
OBJECT_SET_DATA(main_vb, GUI_FILEOPEN_KEY, fileopen_rb);
|
||||
|
||||
fileopen_selected_cb(NULL, main_vb);
|
||||
|
||||
/* Show 'em what we got */
|
||||
gtk_widget_show_all(main_vb);
|
||||
|
@ -455,6 +484,13 @@ gui_prefs_fetch(GtkWidget *w)
|
|||
GEOMETRY_POSITION_KEY));
|
||||
prefs.gui_geometry_save_size =
|
||||
gtk_toggle_button_get_active(OBJECT_GET_DATA(w, GEOMETRY_SIZE_KEY));
|
||||
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(
|
||||
GTK_ENTRY(OBJECT_GET_DATA(w, GUI_FILEOPEN_DIR_KEY))));
|
||||
|
||||
if (font_changed) {
|
||||
if (prefs.gui_font_name != NULL)
|
||||
|
@ -590,6 +626,40 @@ static color_info_t color_info[MAX_HANDLED_COL] = {
|
|||
|
||||
static GdkColor *curcolor = NULL;
|
||||
|
||||
static gint
|
||||
fileopen_dir_changed_cb(GtkWidget *fileopen_entry _U_, GdkEvent *event _U_, gpointer parent_w)
|
||||
{
|
||||
GtkWidget *fileopen_dir_te;
|
||||
char *lastchar;
|
||||
gint fileopen_dir_te_length;
|
||||
|
||||
fileopen_dir_te = (GtkWidget *)OBJECT_GET_DATA(parent_w, GUI_FILEOPEN_DIR_KEY);
|
||||
fileopen_dir_te_length = strlen(gtk_entry_get_text (GTK_ENTRY(fileopen_entry)));
|
||||
lastchar = gtk_editable_get_chars(GTK_EDITABLE(fileopen_entry), fileopen_dir_te_length-1, -1);
|
||||
if (strcmp(lastchar, G_DIR_SEPARATOR_S) != 0)
|
||||
gtk_entry_append_text(GTK_ENTRY(fileopen_entry), G_DIR_SEPARATOR_S);
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
fileopen_selected_cb(GtkWidget *mybutton_rb _U_, gpointer parent_w)
|
||||
{
|
||||
GtkWidget *fileopen_rb, *fileopen_dir_te;
|
||||
|
||||
fileopen_rb = (GtkWidget *)OBJECT_GET_DATA(parent_w, GUI_FILEOPEN_KEY);
|
||||
fileopen_dir_te = (GtkWidget *)OBJECT_GET_DATA(parent_w, GUI_FILEOPEN_DIR_KEY);
|
||||
|
||||
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(fileopen_rb)))
|
||||
{
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(fileopen_dir_te), TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(fileopen_dir_te), FALSE);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
color_browse_cb(GtkWidget *w, gpointer data _U_)
|
||||
{
|
||||
|
|
116
gtk/main.c
116
gtk/main.c
|
@ -1,6 +1,6 @@
|
|||
/* main.c
|
||||
*
|
||||
* $Id: main.c,v 1.321 2003/10/10 08:39:24 sahlberg Exp $
|
||||
* $Id: main.c,v 1.322 2003/10/14 23:20:17 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -145,6 +145,7 @@ static guint main_ctx, file_ctx, help_ctx;
|
|||
static GString *comp_info_str, *runtime_info_str;
|
||||
gchar *ethereal_path = NULL;
|
||||
gchar *last_open_dir = NULL;
|
||||
static gboolean updated_last_open_dir = FALSE;
|
||||
static gint root_x = G_MAXINT, root_y = G_MAXINT, top_width, top_height;
|
||||
static gboolean updated_geometry = FALSE;
|
||||
|
||||
|
@ -2468,46 +2469,77 @@ main(int argc, char *argv[])
|
|||
|
||||
gtk_main();
|
||||
|
||||
/* If our geometry has changed, save whatever elements of it we're
|
||||
supposed to change. */
|
||||
if (updated_geometry) {
|
||||
/* We've gotten an update, in the form of a configure_notify event.
|
||||
Re-read our saved preferences, and, if the geometry preferences
|
||||
differ from the current geometry, and we're supposed to save
|
||||
the current values of the changed geometry item (position or
|
||||
size), update the preference value and note that we will have
|
||||
to write the preferences out.
|
||||
|
||||
XXX - Move all of this into a separate function?
|
||||
|
||||
XXX - should GUI stuff such as this be in a separate file? */
|
||||
/* If the last opened directory, or our geometry, has changed, save
|
||||
whatever we're supposed to save. */
|
||||
if (updated_last_open_dir || updated_geometry) {
|
||||
/* Re-read our saved preferences. */
|
||||
prefs = read_prefs(&gpf_open_errno, &gpf_read_errno, &gpf_path,
|
||||
&pf_open_errno, &pf_read_errno, &pf_path);
|
||||
|
||||
if (pf_path == NULL) {
|
||||
/* We succeeded in reading the preferences. */
|
||||
if (prefs->gui_geometry_save_position) {
|
||||
if (prefs->gui_geometry_main_x != root_x) {
|
||||
prefs->gui_geometry_main_x = root_x;
|
||||
prefs_write_needed = TRUE;
|
||||
}
|
||||
if (prefs->gui_geometry_main_y != root_y) {
|
||||
prefs->gui_geometry_main_y = root_y;
|
||||
prefs_write_needed = TRUE;
|
||||
|
||||
if (updated_last_open_dir) {
|
||||
/* The pathname of the last directory in which we've opened
|
||||
a file has changed. If it changed from what's in the
|
||||
preferences file, and we're supposed to save it, update
|
||||
the preference value and note that we will have to write
|
||||
the preferences out. */
|
||||
if (prefs->gui_fileopen_style == FO_STYLE_LAST_OPENED) {
|
||||
/* Yes, we're supposed to save it.
|
||||
Has a file been opened since Ethereal was started? */
|
||||
if (last_open_dir != NULL) {
|
||||
/* Yes. Is the most recently navigated-to directory
|
||||
different from the saved directory? */
|
||||
if (prefs->gui_fileopen_remembered_dir == NULL ||
|
||||
strcmp(prefs->gui_fileopen_remembered_dir, last_open_dir) != 0) {
|
||||
/* Yes. */
|
||||
prefs->gui_fileopen_remembered_dir = last_open_dir;
|
||||
prefs_write_needed = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (prefs->gui_geometry_save_size) {
|
||||
if (prefs->gui_geometry_main_width != top_width) {
|
||||
prefs->gui_geometry_main_width = top_width;
|
||||
prefs_write_needed = TRUE;
|
||||
if (updated_geometry) {
|
||||
/* We got a geometry update, in the form of a configure_notify
|
||||
event, so the geometry has changed. If it changed from
|
||||
what's in the preferences file, and we're supposed to save
|
||||
the current values of the changed geometry item (position or
|
||||
size), update the preference value and note that we will have
|
||||
to write the preferences out.
|
||||
|
||||
XXX - should GUI stuff such as this be in a separate file? */
|
||||
if (prefs->gui_geometry_save_position) {
|
||||
if (prefs->gui_geometry_main_x != root_x) {
|
||||
prefs->gui_geometry_main_x = root_x;
|
||||
prefs_write_needed = TRUE;
|
||||
}
|
||||
if (prefs->gui_geometry_main_y != root_y) {
|
||||
prefs->gui_geometry_main_y = root_y;
|
||||
prefs_write_needed = TRUE;
|
||||
}
|
||||
}
|
||||
if (prefs->gui_geometry_main_height != top_height) {
|
||||
prefs->gui_geometry_main_height = top_height;
|
||||
prefs_write_needed = TRUE;
|
||||
|
||||
if (prefs->gui_geometry_save_size) {
|
||||
if (prefs->gui_geometry_main_width != top_width) {
|
||||
prefs->gui_geometry_main_width = top_width;
|
||||
prefs_write_needed = TRUE;
|
||||
}
|
||||
if (prefs->gui_geometry_main_height != top_height) {
|
||||
prefs->gui_geometry_main_height = top_height;
|
||||
prefs_write_needed = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Save the preferences if we need to do so.
|
||||
|
||||
XXX - this doesn't save the preferences if you don't have a
|
||||
preferences file. Forcibly writing a preferences file would
|
||||
save the current settings even if you haven't changed them,
|
||||
meaning that if the defaults change it won't affect you.
|
||||
Perhaps we need to keep track of what the *user* has changed,
|
||||
and only write out *those* preferences. */
|
||||
if (prefs_write_needed) {
|
||||
write_prefs(&pf_path);
|
||||
}
|
||||
|
@ -2959,22 +2991,30 @@ void
|
|||
set_last_open_dir(char *dirname)
|
||||
{
|
||||
int len;
|
||||
|
||||
if (last_open_dir) {
|
||||
g_free(last_open_dir);
|
||||
}
|
||||
gchar *new_last_open_dir;
|
||||
|
||||
if (dirname) {
|
||||
len = strlen(dirname);
|
||||
if (dirname[len-1] == G_DIR_SEPARATOR) {
|
||||
last_open_dir = g_strconcat(dirname, NULL);
|
||||
new_last_open_dir = g_strconcat(dirname, NULL);
|
||||
}
|
||||
else {
|
||||
last_open_dir = g_strconcat(dirname, G_DIR_SEPARATOR_S,
|
||||
NULL);
|
||||
new_last_open_dir = g_strconcat(dirname,
|
||||
G_DIR_SEPARATOR_S, NULL);
|
||||
}
|
||||
|
||||
if (last_open_dir == NULL ||
|
||||
strcmp(last_open_dir, new_last_open_dir) != 0)
|
||||
updated_last_open_dir = TRUE;
|
||||
}
|
||||
else {
|
||||
last_open_dir = NULL;
|
||||
new_last_open_dir = NULL;
|
||||
if (last_open_dir != NULL)
|
||||
updated_last_open_dir = TRUE;
|
||||
}
|
||||
|
||||
if (last_open_dir) {
|
||||
g_free(last_open_dir);
|
||||
}
|
||||
last_open_dir = new_last_open_dir;
|
||||
}
|
||||
|
|
124
prefs.c
124
prefs.c
|
@ -1,7 +1,7 @@
|
|||
/* prefs.c
|
||||
* Routines for handling preferences
|
||||
*
|
||||
* $Id: prefs.c,v 1.108 2003/10/02 21:06:11 guy Exp $
|
||||
* $Id: prefs.c,v 1.109 2003/10/14 23:20:15 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -87,6 +87,9 @@ gchar *gui_ptree_expander_style_text[] =
|
|||
gchar *gui_hex_dump_highlight_style_text[] =
|
||||
{ "BOLD", "INVERSE", NULL };
|
||||
|
||||
gchar *gui_fileopen_style_text[] =
|
||||
{ "LAST_OPENED", "SPECIFIED", NULL };
|
||||
|
||||
/*
|
||||
* List of all modules with preference settings.
|
||||
*/
|
||||
|
@ -973,6 +976,9 @@ read_prefs(int *gpf_errno_return, int *gpf_read_errno_return,
|
|||
prefs.gui_geometry_main_y = 20;
|
||||
prefs.gui_geometry_main_width = DEF_WIDTH;
|
||||
prefs.gui_geometry_main_height = -1;
|
||||
prefs.gui_fileopen_style = FO_STYLE_LAST_OPENED;
|
||||
prefs.gui_fileopen_dir = g_strdup("");
|
||||
prefs.gui_fileopen_remembered_dir = NULL;
|
||||
|
||||
/* set the default values for the capture dialog box */
|
||||
prefs.capture_device = NULL;
|
||||
|
@ -1232,31 +1238,34 @@ prefs_set_pref(char *prefarg)
|
|||
return ret;
|
||||
}
|
||||
|
||||
#define PRS_PRINT_FMT "print.format"
|
||||
#define PRS_PRINT_DEST "print.destination"
|
||||
#define PRS_PRINT_FILE "print.file"
|
||||
#define PRS_PRINT_CMD "print.command"
|
||||
#define PRS_COL_FMT "column.format"
|
||||
#define PRS_STREAM_CL_FG "stream.client.fg"
|
||||
#define PRS_STREAM_CL_BG "stream.client.bg"
|
||||
#define PRS_STREAM_SR_FG "stream.server.fg"
|
||||
#define PRS_STREAM_SR_BG "stream.server.bg"
|
||||
#define PRS_GUI_SCROLLBAR_ON_RIGHT "gui.scrollbar_on_right"
|
||||
#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_PTREE_LINE_STYLE "gui.protocol_tree_line_style"
|
||||
#define PRS_GUI_PTREE_EXPANDER_STYLE "gui.protocol_tree_expander_style"
|
||||
#define PRS_PRINT_FMT "print.format"
|
||||
#define PRS_PRINT_DEST "print.destination"
|
||||
#define PRS_PRINT_FILE "print.file"
|
||||
#define PRS_PRINT_CMD "print.command"
|
||||
#define PRS_COL_FMT "column.format"
|
||||
#define PRS_STREAM_CL_FG "stream.client.fg"
|
||||
#define PRS_STREAM_CL_BG "stream.client.bg"
|
||||
#define PRS_STREAM_SR_FG "stream.server.fg"
|
||||
#define PRS_STREAM_SR_BG "stream.server.bg"
|
||||
#define PRS_GUI_SCROLLBAR_ON_RIGHT "gui.scrollbar_on_right"
|
||||
#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_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"
|
||||
#define PRS_GUI_FONT_NAME "gui.font_name"
|
||||
#define PRS_GUI_MARKED_FG "gui.marked_frame.fg"
|
||||
#define PRS_GUI_MARKED_BG "gui.marked_frame.bg"
|
||||
#define PRS_GUI_GEOMETRY_SAVE_POSITION "gui.geometry.save.position"
|
||||
#define PRS_GUI_GEOMETRY_SAVE_SIZE "gui.geometry.save.size"
|
||||
#define PRS_GUI_GEOMETRY_MAIN_X "gui.geometry.main.x"
|
||||
#define PRS_GUI_GEOMETRY_MAIN_Y "gui.geometry.main.y"
|
||||
#define PRS_GUI_GEOMETRY_MAIN_WIDTH "gui.geometry.main.width"
|
||||
#define PRS_GUI_GEOMETRY_MAIN_HEIGHT "gui.geometry.main.height"
|
||||
#define PRS_GUI_FONT_NAME "gui.font_name"
|
||||
#define PRS_GUI_MARKED_FG "gui.marked_frame.fg"
|
||||
#define PRS_GUI_MARKED_BG "gui.marked_frame.bg"
|
||||
#define PRS_GUI_FILEOPEN_STYLE "gui.fileopen.style"
|
||||
#define PRS_GUI_FILEOPEN_DIR "gui.fileopen.dir"
|
||||
#define PRS_GUI_FILEOPEN_REMEMBERED_DIR "gui.fileopen.remembered_dir"
|
||||
#define PRS_GUI_GEOMETRY_SAVE_POSITION "gui.geometry.save.position"
|
||||
#define PRS_GUI_GEOMETRY_SAVE_SIZE "gui.geometry.save.size"
|
||||
#define PRS_GUI_GEOMETRY_MAIN_X "gui.geometry.main.x"
|
||||
#define PRS_GUI_GEOMETRY_MAIN_Y "gui.geometry.main.y"
|
||||
#define PRS_GUI_GEOMETRY_MAIN_WIDTH "gui.geometry.main.width"
|
||||
#define PRS_GUI_GEOMETRY_MAIN_HEIGHT "gui.geometry.main.height"
|
||||
|
||||
/*
|
||||
* This applies to more than just captures, so it's not "capture.name_resolve";
|
||||
|
@ -1482,18 +1491,18 @@ set_pref(gchar *pref_name, gchar *value)
|
|||
prefs.gui_altern_colors = FALSE;
|
||||
}
|
||||
} else if (strcmp(pref_name, PRS_GUI_PTREE_LINE_STYLE) == 0) {
|
||||
prefs.gui_ptree_line_style =
|
||||
find_index_from_string_array(value, gui_ptree_line_style_text, 0);
|
||||
prefs.gui_ptree_line_style =
|
||||
find_index_from_string_array(value, gui_ptree_line_style_text, 0);
|
||||
} 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);
|
||||
prefs.gui_ptree_expander_style =
|
||||
find_index_from_string_array(value, gui_ptree_expander_style_text, 1);
|
||||
} 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);
|
||||
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_FONT_NAME) == 0) {
|
||||
if (prefs.gui_font_name != NULL)
|
||||
g_free(prefs.gui_font_name);
|
||||
prefs.gui_font_name = g_strdup(value);
|
||||
if (prefs.gui_font_name != NULL)
|
||||
g_free(prefs.gui_font_name);
|
||||
prefs.gui_font_name = g_strdup(value);
|
||||
} else if (strcmp(pref_name, PRS_GUI_MARKED_FG) == 0) {
|
||||
cval = strtoul(value, NULL, 16);
|
||||
prefs.gui_marked_fg.pixel = 0;
|
||||
|
@ -1528,6 +1537,18 @@ set_pref(gchar *pref_name, gchar *value)
|
|||
prefs.gui_geometry_main_width = strtol(value, NULL, 10);
|
||||
} else if (strcmp(pref_name, PRS_GUI_GEOMETRY_MAIN_HEIGHT) == 0) {
|
||||
prefs.gui_geometry_main_height = strtol(value, NULL, 10);
|
||||
} else if (strcmp(pref_name, PRS_GUI_FILEOPEN_STYLE) == 0) {
|
||||
prefs.gui_fileopen_style =
|
||||
find_index_from_string_array(value, gui_fileopen_style_text,
|
||||
FO_STYLE_LAST_OPENED);
|
||||
} else if (strcmp(pref_name, PRS_GUI_FILEOPEN_DIR) == 0) {
|
||||
if (prefs.gui_fileopen_dir != NULL)
|
||||
g_free(prefs.gui_fileopen_dir);
|
||||
prefs.gui_fileopen_dir = g_strdup(value);
|
||||
} else if (strcmp(pref_name, PRS_GUI_FILEOPEN_REMEMBERED_DIR) == 0) {
|
||||
if (prefs.gui_fileopen_remembered_dir != NULL)
|
||||
g_free(prefs.gui_fileopen_remembered_dir);
|
||||
prefs.gui_fileopen_remembered_dir = g_strdup(value);
|
||||
|
||||
/* handle the capture options */
|
||||
} else if (strcmp(pref_name, PRS_CAP_DEVICE) == 0) {
|
||||
|
@ -1968,6 +1989,8 @@ write_prefs(char **pf_path_return)
|
|||
"is set to \"command\"\n"
|
||||
"%s: %s\n", PRS_PRINT_CMD, prefs.pr_cmd);
|
||||
|
||||
fprintf (pf, "\n######## Columns ########\n");
|
||||
|
||||
clp = prefs.col_list;
|
||||
col_l = NULL;
|
||||
while (clp) {
|
||||
|
@ -1984,6 +2007,8 @@ write_prefs(char **pf_path_return)
|
|||
we just referred to them. */
|
||||
g_list_free(col_l);
|
||||
|
||||
fprintf (pf, "\n######## TCP Stream Window ########\n");
|
||||
|
||||
fprintf (pf, "\n# TCP stream window color preferences.\n");
|
||||
fprintf (pf, "# Each value is a six digit hexadecimal color value in the form rrggbb.\n");
|
||||
fprintf (pf, "%s: %02x%02x%02x\n", PRS_STREAM_CL_FG,
|
||||
|
@ -2003,6 +2028,8 @@ write_prefs(char **pf_path_return)
|
|||
(prefs.st_server_bg.green * 255 / 65535),
|
||||
(prefs.st_server_bg.blue * 255 / 65535));
|
||||
|
||||
fprintf (pf, "\n######## User Interface ########\n");
|
||||
|
||||
fprintf(pf, "\n# Vertical scrollbars should be on right side?\n");
|
||||
fprintf(pf, "# TRUE or FALSE (case-insensitive).\n");
|
||||
fprintf(pf, PRS_GUI_SCROLLBAR_ON_RIGHT ": %s\n",
|
||||
|
@ -2061,6 +2088,23 @@ write_prefs(char **pf_path_return)
|
|||
fprintf(pf, "# TRUE or FALSE (case-insensitive).\n");
|
||||
fprintf(pf, PRS_GUI_GEOMETRY_SAVE_SIZE ": %s\n",
|
||||
prefs.gui_geometry_save_size == TRUE ? "TRUE" : "FALSE");
|
||||
|
||||
fprintf(pf, "\n# Where to start the File Open dialog box.\n");
|
||||
fprintf(pf, "# One of: LAST_OPENED, SPECIFIED\n");
|
||||
fprintf (pf, PRS_GUI_FILEOPEN_STYLE ": %s\n",
|
||||
gui_fileopen_style_text[prefs.gui_fileopen_style]);
|
||||
|
||||
if (prefs.gui_fileopen_dir != NULL) {
|
||||
fprintf(pf, "\n# Directory to start in when opening File Open dialog.\n");
|
||||
fprintf(pf, PRS_GUI_FILEOPEN_DIR ": %s\n",
|
||||
prefs.gui_fileopen_dir);
|
||||
}
|
||||
|
||||
if (prefs.gui_fileopen_remembered_dir != NULL) {
|
||||
fprintf(pf, "\n# Last directory navigated to in File Open dialog.\n");
|
||||
fprintf(pf, PRS_GUI_FILEOPEN_REMEMBERED_DIR ": %s\n",
|
||||
prefs.gui_fileopen_remembered_dir);
|
||||
}
|
||||
|
||||
fprintf(pf, "\n# Main window geometry.\n");
|
||||
fprintf(pf, "# Decimal integers.\n");
|
||||
|
@ -2071,6 +2115,8 @@ write_prefs(char **pf_path_return)
|
|||
fprintf(pf, PRS_GUI_GEOMETRY_MAIN_HEIGHT ": %d\n",
|
||||
prefs.gui_geometry_main_height);
|
||||
|
||||
fprintf(pf, "\n####### Name Resolution ########\n");
|
||||
|
||||
fprintf(pf, "\n# Resolve addresses to names?\n");
|
||||
fprintf(pf, "# TRUE or FALSE (case-insensitive), or a list of address types to resolve.\n");
|
||||
fprintf(pf, PRS_NAME_RESOLVE ": %s\n",
|
||||
|
@ -2082,6 +2128,8 @@ write_prefs(char **pf_path_return)
|
|||
prefs.name_resolve_concurrency);
|
||||
|
||||
/* write the capture options */
|
||||
fprintf(pf, "\n####### Capture Options ########\n");
|
||||
|
||||
if (prefs.capture_device != NULL) {
|
||||
fprintf(pf, "\n# Default capture device\n");
|
||||
fprintf(pf, PRS_CAP_DEVICE ": %s\n", prefs.capture_device);
|
||||
|
@ -2194,6 +2242,14 @@ free_prefs(e_prefs *pr)
|
|||
g_free(pr->gui_font_name);
|
||||
pr->gui_font_name = NULL;
|
||||
}
|
||||
if (pr->gui_fileopen_dir != NULL) {
|
||||
g_free(pr->gui_fileopen_dir);
|
||||
pr->gui_fileopen_dir = NULL;
|
||||
}
|
||||
if (pr->gui_fileopen_dir != NULL) {
|
||||
g_free(pr->gui_fileopen_remembered_dir);
|
||||
pr->gui_fileopen_remembered_dir = NULL;
|
||||
}
|
||||
if (pr->capture_device != NULL) {
|
||||
g_free(pr->capture_device);
|
||||
pr->capture_device = NULL;
|
||||
|
|
11
prefs.h
11
prefs.h
|
@ -1,7 +1,7 @@
|
|||
/* prefs.h
|
||||
* Definitions for preference handling routines
|
||||
*
|
||||
* $Id: prefs.h,v 1.47 2003/10/02 21:06:11 guy Exp $
|
||||
* $Id: prefs.h,v 1.48 2003/10/14 23:20:16 guy Exp $
|
||||
*
|
||||
* Ethereal - Network traffic analyzer
|
||||
* By Gerald Combs <gerald@ethereal.com>
|
||||
|
@ -46,6 +46,12 @@
|
|||
*/
|
||||
char string_to_name_resolve(char *string, guint32 *name_resolve);
|
||||
|
||||
/*
|
||||
* Modes for the starting directory in File Open dialogs.
|
||||
*/
|
||||
#define FO_STYLE_LAST_OPENED 0 /* start in last directory we looked at */
|
||||
#define FO_STYLE_SPECIFIED 1 /* start in specified directory */
|
||||
|
||||
typedef struct _e_prefs {
|
||||
gint pr_format;
|
||||
gint pr_dest;
|
||||
|
@ -70,6 +76,9 @@ typedef struct _e_prefs {
|
|||
gint gui_geometry_main_y;
|
||||
gint gui_geometry_main_width;
|
||||
gint gui_geometry_main_height;
|
||||
gint gui_fileopen_style;
|
||||
gchar *gui_fileopen_dir;
|
||||
gchar *gui_fileopen_remembered_dir;
|
||||
guint32 name_resolve;
|
||||
gint name_resolve_concurrency;
|
||||
gchar *capture_device;
|
||||
|
|
Loading…
Reference in New Issue