From 586ad18159fd55e14839f04e3da409561a51a9c3 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Fri, 28 Sep 2018 17:30:41 -0700 Subject: Get rid of the printing preferences. They're no longer used by any of the printing code; mark them as obsolete. Change-Id: Iceaf14f48f1bd35757a9a158a5348f6202b90fc7 Reviewed-on: https://code.wireshark.org/review/29911 Reviewed-by: Guy Harris --- epan/prefs.c | 83 ++++++++++++-------------------------------- epan/prefs.h | 7 ---- ui/qt/models/pref_models.cpp | 5 --- 3 files changed, 23 insertions(+), 72 deletions(-) diff --git a/epan/prefs.c b/epan/prefs.c index 39d560bda5..a7680389a0 100644 --- a/epan/prefs.c +++ b/epan/prefs.c @@ -2257,23 +2257,6 @@ prefs_pref_foreach(module_t *module, pref_cb callback, gpointer user_data) return 0; } -static const enum_val_t print_format_vals[] = { - { "text", "Plain Text", PR_FMT_TEXT }, - { "postscript", "Postscript", PR_FMT_PS }, - { NULL, NULL, 0 } -}; - -static const enum_val_t print_dest_vals[] = { -#ifdef _WIN32 - /* "PR_DEST_CMD" means "to printer" on Windows */ - { "command", "Printer", PR_DEST_CMD }, -#else - { "command", "Command", PR_DEST_CMD }, -#endif - { "file", "File", PR_DEST_FILE }, - { NULL, NULL, 0 } -}; - static const enum_val_t st_sort_col_vals[] = { { "name", "Node name (topic/item)", ST_SORT_COL_NAME }, { "count", "Item count", ST_SORT_COL_COUNT }, @@ -3494,27 +3477,15 @@ prefs_register_modules(void) oid_pref_init(nameres_module); maxmind_db_pref_init(nameres_module); - /* Printing */ + /* Printing + * None of these have any effect; we keep them as obsolete preferences + * in order to avoid errors when reading older preference files. + */ printing = prefs_register_module(NULL, "print", "Printing", - "Printing", NULL, TRUE); - - prefs_register_enum_preference(printing, "format", - "Format", "Can be one of \"text\" or \"postscript\"", - &prefs.pr_format, print_format_vals, TRUE); - - prefs_register_enum_preference(printing, "destination", - "Print to", "Can be one of \"command\" or \"file\"", - &prefs.pr_dest, print_dest_vals, TRUE); - -#ifndef _WIN32 - register_string_like_preference(printing, "command", "Command", - "Output gets piped to this command when the destination is set to \"command\"", - &prefs.pr_cmd, PREF_STRING, NULL, TRUE); -#endif - - register_string_like_preference(printing, "file", "File", - "This is the file that gets written to when the destination is set to \"file\"", - &prefs.pr_file, PREF_SAVE_FILENAME, NULL, TRUE); + "Printing", NULL, FALSE); + prefs_register_obsolete_preference(printing, "format"); + prefs_register_obsolete_preference(printing, "command"); + prefs_register_obsolete_preference(printing, "file"); /* Codecs */ codecs_module = prefs_register_module(NULL, "codecs", "Codecs", @@ -3970,13 +3941,6 @@ pre_init_prefs(void) "Protocol", "%p", "Length", "%L", "Info", "%i"}; - prefs.pr_format = PR_FMT_TEXT; - prefs.pr_dest = PR_DEST_CMD; - g_free(prefs.pr_file); - prefs.pr_file = g_strdup("wireshark.out"); - g_free(prefs.pr_cmd); - prefs.pr_cmd = g_strdup("lpr"); - prefs.gui_expert_composite_eyecandy = FALSE; prefs.gui_ptree_line_style = 0; prefs.gui_ptree_expander_style = 1; @@ -4479,26 +4443,25 @@ read_prefs_file(const char *pf_path, FILE *pf, break; case PREFS_SET_NO_SUCH_PREF: - /* - * If "print.command" silently ignore it because it's valid - * on non-Win32 platforms. - */ - if (strcmp(cur_var->str, "print.command") != 0) - g_warning ("No such preference \"%s\" at line %d of\n%s %s", - cur_var->str, pline, pf_path, hint); + g_warning ("No such preference \"%s\" at line %d of\n%s %s", + cur_var->str, pline, pf_path, hint); prefs.unknown_prefs = TRUE; break; case PREFS_SET_OBSOLETE: - if (strcmp(cur_var->str, "print.command") != 0) - /* If an attempt is made to save the preferences, a popup warning will be - displayed stating that obsolete prefs have been detected and the user will - be given the opportunity to save these prefs under a different profile name. - The prefs in question need to be listed in the console window so that the - user can make an informed choice. - */ - g_warning ("Obsolete preference \"%s\" at line %d of\n%s %s", - cur_var->str, pline, pf_path, hint); + /* + * If an attempt is made to save the + * preferences, a popup warning will be + * displayed stating that obsolete prefs + * have been detected and the user will + * be given the opportunity to save these + * prefs under a different profile name. + * The prefs in question need to be listed + * in the console window so that the + * user can make an informed choice. + */ + g_warning ("Obsolete preference \"%s\" at line %d of\n%s %s", + cur_var->str, pline, pf_path, hint); prefs.unknown_prefs = TRUE; break; } diff --git a/epan/prefs.h b/epan/prefs.h index a52f75fb23..b66711a604 100644 --- a/epan/prefs.h +++ b/epan/prefs.h @@ -24,9 +24,6 @@ extern "C" { #include "ws_symbol_export.h" -#define PR_DEST_CMD 0 -#define PR_DEST_FILE 1 - #define DEF_WIDTH 750 #define DEF_HEIGHT 550 @@ -139,10 +136,6 @@ typedef enum { } software_update_channel_e; typedef struct _e_prefs { - gint pr_format; - gint pr_dest; - gchar *pr_file; - gchar *pr_cmd; GList *col_list; gint num_cols; color_t st_client_fg, st_client_bg, st_server_fg, st_server_bg; diff --git a/ui/qt/models/pref_models.cpp b/ui/qt/models/pref_models.cpp index 4b1cf1a8ff..bee5b5b3c6 100644 --- a/ui/qt/models/pref_models.cpp +++ b/ui/qt/models/pref_models.cpp @@ -292,11 +292,6 @@ fill_prefs(module_t *module, gpointer root_ptr) void PrefsModel::populate() { - // Printing prefs don't apply here. - module_t *print_module = prefs_find_module("print"); - if (print_module) - print_module->use_gui = FALSE; - //Since "expert" is really a pseudo protocol, it shouldn't be //categorized with other "real" protocols when it comes to //preferences. Since it's just a UAT, don't bury it in -- cgit v1.2.3