diff options
Diffstat (limited to 'epan')
-rw-r--r-- | epan/prefs.c | 31 | ||||
-rw-r--r-- | epan/prefs.h | 12 |
2 files changed, 29 insertions, 14 deletions
diff --git a/epan/prefs.c b/epan/prefs.c index d7265bc5cc..33fa427150 100644 --- a/epan/prefs.c +++ b/epan/prefs.c @@ -98,6 +98,9 @@ static const gchar *gui_hex_dump_highlight_style_text[] = static const gchar *gui_console_open_text[] = { "NEVER", "AUTOMATIC", "ALWAYS", NULL }; +static const gchar *gui_version_placement_text[] = + { "WELCOME", "TITLE", "BOTH", "NEITHER", NULL }; + static const gchar *gui_fileopen_style_text[] = { "LAST_OPENED", "SPECIFIED", NULL }; @@ -1519,7 +1522,7 @@ init_prefs(void) prefs.gui_webbrowser = g_strdup(HTML_VIEWER " %s"); prefs.gui_window_title = g_strdup(""); prefs.gui_start_title = g_strdup("The World's Most Popular Network Protocol Analyzer"); - prefs.gui_version_in_start_page = TRUE; + prefs.gui_version_placement = version_both; prefs.gui_auto_scroll_on_expand = FALSE; prefs.gui_auto_scroll_percentage = 0; prefs.gui_layout_type = layout_type_5; @@ -2206,7 +2209,7 @@ prefs_capture_device_monitor_mode(const char *name) #define PRS_GUI_WEBBROWSER "gui.webbrowser" #define PRS_GUI_WINDOW_TITLE "gui.window_title" #define PRS_GUI_START_TITLE "gui.start_title" -#define PRS_GUI_VERSION_IN_START_PAGE "gui.version_in_start_page" +#define PRS_GUI_VERSION_PLACEMENT "gui.version_placement" #define PRS_GUI_AUTO_SCROLL "gui.auto_scroll_on_expand" #define PRS_GUI_AUTO_SCROLL_PERCENTAGE "gui.auto_scroll_percentage" #define PRS_GUI_LAYOUT_TYPE "gui.layout_type" @@ -2628,11 +2631,12 @@ set_pref(gchar *pref_name, gchar *value, void *private_data _U_, } else if (strcmp(pref_name, PRS_GUI_START_TITLE) == 0) { g_free(prefs.gui_start_title); prefs.gui_start_title = g_strdup(value); - } else if (strcmp(pref_name, PRS_GUI_VERSION_IN_START_PAGE) == 0) { - if (g_ascii_strcasecmp(value, "true") == 0) { - prefs.gui_version_in_start_page = TRUE; - } else { - prefs.gui_version_in_start_page = FALSE; + } else if (strcmp(pref_name, PRS_GUI_VERSION_PLACEMENT) == 0) { + prefs.gui_version_placement = strtoul(value, NULL, 10); + if (prefs.gui_version_placement > version_neither) { + /* XXX - report an error? It's not a syntax error - we'd need to + add a way of reporting a *semantic* error. */ + prefs.gui_version_placement = version_welcome_only; } } else if (strcmp(pref_name, PRS_GUI_AUTO_SCROLL) == 0) { if (g_ascii_strcasecmp(value, "true") == 0) { @@ -3475,12 +3479,13 @@ write_prefs(char **pf_path_return) fprintf(pf, PRS_GUI_START_TITLE ": %s\n", prefs.gui_start_title); - fprintf(pf, "\n# Show version in the start page and main screen's title bar.\n"); - fprintf(pf, "# TRUE or FALSE (case-insensitive).\n"); - if (prefs.gui_version_in_start_page == default_prefs.gui_version_in_start_page) + + fprintf(pf, "\n# Show version in the start page and/or main screen's title bar.\n"); + fprintf(pf, "# One of: WELCOME, TITLE, BOTH, NEITHER\n"); + if (prefs.gui_version_placement == default_prefs.gui_version_placement) fprintf(pf, "#"); - fprintf(pf, PRS_GUI_VERSION_IN_START_PAGE ": %s\n", - prefs.gui_version_in_start_page == TRUE ? "TRUE" : "FALSE"); + fprintf(pf, PRS_GUI_VERSION_PLACEMENT ": %s\n", + gui_version_placement_text[prefs.gui_version_placement]); fprintf(pf, "\n# Automatically scroll the recently expanded item.\n"); fprintf(pf, "# TRUE or FALSE (case-insensitive).\n"); @@ -3848,7 +3853,7 @@ copy_prefs(e_prefs *dest, e_prefs *src) dest->gui_webbrowser = g_strdup(src->gui_webbrowser); dest->gui_window_title = g_strdup(src->gui_window_title); dest->gui_start_title = g_strdup(src->gui_start_title); - dest->gui_version_in_start_page = src->gui_version_in_start_page; + dest->gui_version_placement = src->gui_version_placement; dest->console_log_level = src->console_log_level; /* values for the capture dialog box */ dest->capture_device = g_strdup(src->capture_device); diff --git a/epan/prefs.h b/epan/prefs.h index b7ea7d8025..0520b830e9 100644 --- a/epan/prefs.h +++ b/epan/prefs.h @@ -103,6 +103,16 @@ typedef enum { console_open_always } console_open_e; +/* + * Places version information will show up + */ +typedef enum { + version_welcome_only, + version_title_only, + version_both, + version_neither +} version_info_e; + typedef struct _e_prefs { gint pr_format; @@ -146,7 +156,7 @@ typedef struct _e_prefs { gchar *gui_webbrowser; gchar *gui_window_title; gchar *gui_start_title; - gboolean gui_version_in_start_page; + version_info_e gui_version_placement; gboolean gui_auto_scroll_on_expand; guint gui_auto_scroll_percentage; layout_type_e gui_layout_type; |