diff options
author | Guy Harris <guy@alum.mit.edu> | 2017-04-09 02:01:05 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2017-04-09 17:57:52 +0000 |
commit | 7d5ce06cbe35f3f818695c87e5b0f42172ee3784 (patch) | |
tree | b1819216afd831302cc94af54187122a2efdd4d8 /ui/gtk | |
parent | 1abbb503e4242f56921b7ee950f185711e9f85c0 (diff) |
Pull the error reporting into {read,save}_filter_list.
Change-Id: I4d9582661f2f1728d400eeb2a1b1dea98f32ce7f
Reviewed-on: https://code.wireshark.org/review/20982
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'ui/gtk')
-rw-r--r-- | ui/gtk/filter_dlg.c | 35 | ||||
-rw-r--r-- | ui/gtk/main.c | 18 |
2 files changed, 7 insertions, 46 deletions
diff --git a/ui/gtk/filter_dlg.c b/ui/gtk/filter_dlg.c index 7604f078e7..cf699d8467 100644 --- a/ui/gtk/filter_dlg.c +++ b/ui/gtk/filter_dlg.c @@ -798,49 +798,24 @@ filter_apply(GtkWidget *main_w, gboolean destroy) static void filter_dlg_save(filter_list_type_t list_type) { - char *pf_dir_path; - char *f_path; - int f_save_errno; - const char *filter_type; - switch (list_type) { case CFILTER_EDITED_LIST: - filter_type = "capture"; - list_type = CFILTER_LIST; - copy_filter_list(CFILTER_LIST, CFILTER_EDITED_LIST); + list_type = CFILTER_LIST; + copy_filter_list(CFILTER_LIST, CFILTER_EDITED_LIST); break; case DFILTER_EDITED_LIST: - filter_type = "display"; - list_type = DFILTER_LIST; - copy_filter_list(DFILTER_LIST, DFILTER_EDITED_LIST); + list_type = DFILTER_LIST; + copy_filter_list(DFILTER_LIST, DFILTER_EDITED_LIST); break; default: g_assert_not_reached(); - filter_type = NULL; break; } - /* 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 filter files: %s.", - pf_dir_path, g_strerror(errno)); - g_free(pf_dir_path); - return; - } - - save_filter_list(list_type, &f_path, &f_save_errno); - if (f_path != NULL) { - /* We had an error saving the filter. */ - simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, - "Could not save to your %s filter file\n\"%s\": %s.", - filter_type, f_path, g_strerror(f_save_errno)); - g_free(f_path); - } + save_filter_list(list_type); } diff --git a/ui/gtk/main.c b/ui/gtk/main.c index 2e0d53a6f7..1516fbadce 100644 --- a/ui/gtk/main.c +++ b/ui/gtk/main.c @@ -1905,8 +1905,6 @@ get_wireshark_runtime_info(GString *str) static e_prefs * read_configuration_files(void) { - int cf_open_errno, df_open_errno; - char *cf_path, *df_path; e_prefs *prefs_p; /* load the decode as entries of this profile */ @@ -1923,22 +1921,10 @@ read_configuration_files(void) #endif /* Read the capture filter file. */ - read_filter_list(CFILTER_LIST, &cf_path, &cf_open_errno); - if (cf_path != NULL) { - simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK, - "Could not open your capture filter file\n\"%s\": %s.", - cf_path, g_strerror(cf_open_errno)); - g_free(cf_path); - } + read_filter_list(CFILTER_LIST); /* Read the display filter file. */ - read_filter_list(DFILTER_LIST, &df_path, &df_open_errno); - if (df_path != NULL) { - simple_dialog(ESD_TYPE_WARN, ESD_BTN_OK, - "Could not open your display filter file\n\"%s\": %s.", - df_path, g_strerror(df_open_errno)); - g_free(df_path); - } + read_filter_list(DFILTER_LIST); /* * Read the files that enable and disable protocols and heuristic |