diff options
Diffstat (limited to 'ui/recent.c')
-rw-r--r-- | ui/recent.c | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/ui/recent.c b/ui/recent.c index 35ec2785f6..11a6f96008 100644 --- a/ui/recent.c +++ b/ui/recent.c @@ -44,6 +44,7 @@ #define RECENT_GUI_SECONDS_FORMAT "gui.seconds_format" #define RECENT_GUI_ZOOM_LEVEL "gui.zoom_level" #define RECENT_GUI_BYTES_VIEW "gui.bytes_view" +#define RECENT_GUI_BYTES_ENCODING "gui.bytes_encoding" #define RECENT_GUI_GEOMETRY_MAIN_X "gui.geometry_main_x" #define RECENT_GUI_GEOMETRY_MAIN_Y "gui.geometry_main_y" #define RECENT_GUI_GTK_GEOMETRY_MAIN_X "gui.gtk.geometry_main_x" @@ -108,6 +109,19 @@ static const value_string ts_seconds_values[] = { { 0, NULL } }; +static const value_string bytes_view_type_values[] = { + { BYTES_HEX, "HEX" }, + { BYTES_BITS, "BITS" }, + { 0, NULL } +}; + +static const value_string bytes_encoding_type_values[] = { + { BYTES_ENC_FROM_PACKET, "FROM_PACKET" }, + { BYTES_ENC_ASCII, "ASCII" }, + { BYTES_ENC_EBCDIC, "EBCDIC" }, + { 0, NULL } +}; + static void free_col_width_data(gpointer data, gpointer user_data _U_) { @@ -824,11 +838,14 @@ write_profile_recent(void) fprintf(rf, RECENT_GUI_ZOOM_LEVEL ": %d\n", recent.gui_zoom_level); - fprintf(rf, "\n# Bytes view.\n"); - fprintf(rf, "# A decimal number.\n"); - fprintf(rf, RECENT_GUI_BYTES_VIEW ": %d\n", + write_recent_enum(rf, "Bytes view display type", + RECENT_GUI_BYTES_VIEW, bytes_view_type_values, recent.gui_bytes_view); + write_recent_enum(rf, "Bytes view text encoding", + RECENT_GUI_BYTES_ENCODING, bytes_encoding_type_values, + recent.gui_bytes_encoding); + fprintf(rf, "\n# Main window upper (or leftmost) pane size.\n"); fprintf(rf, "# Decimal number.\n"); if (recent.gui_geometry_main_upper_pane != 0) { @@ -1027,10 +1044,11 @@ read_set_recent_pair_static(gchar *key, const gchar *value, return PREFS_SET_SYNTAX_ERR; /* number was bad */ recent.gui_zoom_level = (gint)num; } else if (strcmp(key, RECENT_GUI_BYTES_VIEW) == 0) { - num = strtol(value, &p, 0); - if (p == value || *p != '\0') - return PREFS_SET_SYNTAX_ERR; /* number was bad */ - recent.gui_bytes_view = (bytes_view_type)num; + recent.gui_bytes_view = + (bytes_view_type)str_to_val(value, bytes_view_type_values, BYTES_HEX); + } else if (strcmp(key, RECENT_GUI_BYTES_ENCODING) == 0) { + recent.gui_bytes_encoding = + (bytes_encoding_type)str_to_val(value, bytes_encoding_type_values, BYTES_ENC_FROM_PACKET); } else if (strcmp(key, RECENT_GUI_GEOMETRY_MAIN_MAXIMIZED) == 0) { parse_recent_boolean(value, &recent.gui_geometry_main_maximized); } else if (strcmp(key, RECENT_GUI_GEOMETRY_MAIN_UPPER_PANE) == 0) { @@ -1284,6 +1302,7 @@ recent_read_profile_static(char **rf_path_return, int *rf_errno_return) recent.gui_seconds_format = TS_SECONDS_DEFAULT; recent.gui_zoom_level = 0; recent.gui_bytes_view = BYTES_HEX; + recent.gui_bytes_encoding = BYTES_ENC_FROM_PACKET; /* pane size of zero will autodetect */ recent.gui_geometry_main_upper_pane = 0; |