diff options
author | Guy Harris <guy@alum.mit.edu> | 2012-06-19 19:20:47 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2012-06-19 19:20:47 +0000 |
commit | 475b8d9bcd6f975cf4a891e7cb53f6d55b0c8ca2 (patch) | |
tree | f97ccb7672858e9fa3f9c613dd6532e189076706 /ui/gtk/capture_file_dlg.c | |
parent | 6ba80adfed2ac4e2d9768ed16e3f1efc39d481c4 (diff) |
The GTK+ file chooser already *includes* UI code to ask the user whether
they want to overwrite an existing file; just use that. (The Win32 file
chooser also does that itself.) Just do UI for "do you want to
overwrite this {user-immutable,unwritable} file?".
svn path=/trunk/; revision=43381
Diffstat (limited to 'ui/gtk/capture_file_dlg.c')
-rw-r--r-- | ui/gtk/capture_file_dlg.c | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/ui/gtk/capture_file_dlg.c b/ui/gtk/capture_file_dlg.c index 28858d6e9b..84068fe142 100644 --- a/ui/gtk/capture_file_dlg.c +++ b/ui/gtk/capture_file_dlg.c @@ -1258,8 +1258,10 @@ do_file_save_as(capture_file *cf) /* Default to saving in the file's current format. */ /* build the file selection */ - file_save_as_w = file_selection_new ("Wireshark: Save Capture File As", - FILE_SELECTION_SAVE); + file_save_as_w = file_selection_new("Wireshark: Save Capture File As", + FILE_SELECTION_SAVE); + gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(file_save_as_w), + TRUE); /* Container for each row of widgets */ @@ -1318,10 +1320,9 @@ do_file_save_as(capture_file *cf) continue; } - /* If the file exists, ask the user whether they want to overwrite it - and, if so and it's user-immutable or not writable, whether they - want to override that. */ - if (!file_target_exist_ui(file_save_as_w, cf_name)) { + /* If the file exists and it's user-immutable or not writable, + ask the user whether they want to override that. */ + if (!file_target_unwritable_ui(file_save_as_w, cf_name)) { /* They don't. Let them try another file name or cancel. */ g_free(cf_name); continue; @@ -1434,8 +1435,10 @@ file_export_specified_packets_cmd_cb(GtkWidget *widget _U_, gpointer data _U_) range.include_dependents = TRUE; /* build the file selection */ - file_export_specified_packets_w = file_selection_new ("Wireshark: Export Specified Packets", - FILE_SELECTION_SAVE); + file_export_specified_packets_w = file_selection_new("Wireshark: Export Specified Packets", + FILE_SELECTION_SAVE); + gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(file_export_specified_packets_w), + TRUE); /* Container for each row of widgets */ @@ -1542,10 +1545,9 @@ file_export_specified_packets_cmd_cb(GtkWidget *widget _U_, gpointer data _U_) continue; } - /* If the file exists, ask the user whether they want to overwrite it - and, if so and it's user-immutable or not writable, whether they - want to override that. */ - if (!file_target_exist_ui(file_export_specified_packets_w, cf_name)) { + /* If the file exists and it's user-immutable or not writable, + ask the user whether they want to override that. */ + if (!file_target_unwritable_ui(file_export_specified_packets_w, cf_name)) { /* They don't. Let them try another file name or cancel. */ g_free(cf_name); continue; @@ -1788,6 +1790,8 @@ file_color_export_cmd_cb(GtkWidget *w _U_, gpointer filter_list) file_color_export_w = file_selection_new("Wireshark: Export Color Filters", FILE_SELECTION_SAVE); + gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(file_color_export_w), + TRUE); /* Container for each row of widgets */ main_vb = ws_gtk_box_new(GTK_ORIENTATION_VERTICAL, 3, FALSE); @@ -1833,10 +1837,9 @@ file_color_export_cmd_cb(GtkWidget *w _U_, gpointer filter_list) continue; } - /* If the file exists, ask the user whether they want to overwrite it - and, if so and it's user-immutable or not writable, whether they - want to override that. */ - if (!file_target_exist_ui(file_color_export_w, cf_name)) { + /* If the file exists and it's user-immutable or not writable, + ask the user whether they want to override that. */ + if (!file_target_unwritable_ui(file_color_export_w, cf_name)) { /* They don't. Let them try another file name or cancel. */ g_free(cf_name); continue; |