diff options
author | Guy Harris <guy@alum.mit.edu> | 2017-04-08 18:59:17 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2017-04-09 02:00:37 +0000 |
commit | 23a7890b6a2133a559fc691c865e617c19b26a7a (patch) | |
tree | 86c981542f9270215e1010720e4ad2280cb814d8 /ui | |
parent | 92ebd6389203448168a2769fa473bbbad95ec159 (diff) | |
download | wireshark-23a7890b6a2133a559fc691c865e617c19b26a7a.tar.gz |
Pull the code to save enabled/disabled lists into libwireshark.
It's identical in the GTK+ and Qt UIs, and it should just be done in
libwireshark.
Rename some routines to just speak of enabled_and_disabled_lists, so we
don't have to say enabled_and_disabled_protos_and_heuristic_dissectors
or something such as that.
Clean up indentation.
Change-Id: Ief2e612d9e1b60d8d0123b6bd3409dce5faf6495
Reviewed-on: https://code.wireshark.org/review/20970
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'ui')
-rw-r--r-- | ui/gtk/main.c | 2 | ||||
-rw-r--r-- | ui/gtk/proto_dlg.c | 38 | ||||
-rw-r--r-- | ui/qt/enabled_protocols_dialog.cpp | 41 | ||||
-rw-r--r-- | ui/qt/wireshark_application.cpp | 2 |
4 files changed, 5 insertions, 78 deletions
diff --git a/ui/gtk/main.c b/ui/gtk/main.c index 50b3c4c42d..bfc3aac287 100644 --- a/ui/gtk/main.c +++ b/ui/gtk/main.c @@ -1975,7 +1975,7 @@ read_configuration_files(void) * Read the files that enable and disable protocols and heuristic * dissectors. */ - read_enabled_and_disabled_protos(); + read_enabled_and_disabled_lists(); return prefs_p; } diff --git a/ui/gtk/proto_dlg.c b/ui/gtk/proto_dlg.c index a9fedc305f..012e128be8 100644 --- a/ui/gtk/proto_dlg.c +++ b/ui/gtk/proto_dlg.c @@ -274,42 +274,8 @@ update_was_enabled(void) static void proto_write(gpointer parent_w _U_) { - char *pf_dir_path; - char *pf_path; - int pf_save_errno; - - /* Create the directory that holds personal configuration files, if - necessary. */ - if (create_persconffile_dir(&pf_dir_path) == -1) { - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, - "Can't create directory\n\"%s\"\nfor disabled protocols file: %s.", pf_dir_path, - g_strerror(errno)); - g_free(pf_dir_path); - } else { - save_disabled_protos_list(&pf_path, &pf_save_errno); - if (pf_path != NULL) { - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, - "Could not save to your disabled protocols file\n\"%s\": %s.", - pf_path, g_strerror(pf_save_errno)); - g_free(pf_path); - } - - save_enabled_protos_list(&pf_path, &pf_save_errno); - if (pf_path != NULL) { - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, - "Could not save to your enabled protocols file\n\"%s\": %s.", - pf_path, g_strerror(pf_save_errno)); - g_free(pf_path); - } - - save_disabled_heur_dissector_list(&pf_path, &pf_save_errno); - if (pf_path != NULL) { - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, - "Could not save to your disabled heuristic protocol file\n\"%s\": %s.", - pf_path, g_strerror(pf_save_errno)); - g_free(pf_path); - } - } + /* Save the current state of the enabled/disabled lists. */ + save_enabled_and_disabled_lists(); } static void diff --git a/ui/qt/enabled_protocols_dialog.cpp b/ui/qt/enabled_protocols_dialog.cpp index f6f891374c..1f1703f051 100644 --- a/ui/qt/enabled_protocols_dialog.cpp +++ b/ui/qt/enabled_protocols_dialog.cpp @@ -261,46 +261,7 @@ bool EnabledProtocolsDialog::applyChanges() void EnabledProtocolsDialog::writeChanges() { - char *pf_dir_path; - char *pf_path; - int pf_save_errno; - - /* Create the directory that holds personal configuration files, if necessary. */ - if (create_persconffile_dir(&pf_dir_path) == -1) { - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, - "Can't create directory\n\"%s\"\nfor disabled protocols file: %s.", pf_dir_path, - g_strerror(errno)); - g_free(pf_dir_path); - } - else - { - save_disabled_protos_list(&pf_path, &pf_save_errno); - if (pf_path != NULL) - { - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, - "Could not save to your disabled protocols file\n\"%s\": %s.", - pf_path, g_strerror(pf_save_errno)); - g_free(pf_path); - } - - save_enabled_protos_list(&pf_path, &pf_save_errno); - if (pf_path != NULL) - { - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, - "Could not save to your enabled protocols file\n\"%s\": %s.", - pf_path, g_strerror(pf_save_errno)); - g_free(pf_path); - } - - save_disabled_heur_dissector_list(&pf_path, &pf_save_errno); - if (pf_path != NULL) - { - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, - "Could not save to your disabled heuristic protocol file\n\"%s\": %s.", - pf_path, g_strerror(pf_save_errno)); - g_free(pf_path); - } - } + save_enabled_and_disabled_lists(); } void EnabledProtocolsDialog::on_search_line_edit__textChanged(const QString &search_re) diff --git a/ui/qt/wireshark_application.cpp b/ui/qt/wireshark_application.cpp index a2637adf9b..f1ef200574 100644 --- a/ui/qt/wireshark_application.cpp +++ b/ui/qt/wireshark_application.cpp @@ -1175,7 +1175,7 @@ _e_prefs *WiresharkApplication::readConfigurationFiles(bool reset) * Read the files that enable and disable protocols and heuristic * dissectors. */ - read_enabled_and_disabled_protos(); + read_enabled_and_disabled_lists(); return prefs_p; } |