summaryrefslogtreecommitdiff
path: root/ui/gtk/file_dlg.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2013-05-14 21:53:57 +0000
committerGuy Harris <guy@alum.mit.edu>2013-05-14 21:53:57 +0000
commit89afc91ccfd137785840d9ced9ec1929e6a13a5b (patch)
treedc9b39f072b5df6440a12c570dbab907c46cc974 /ui/gtk/file_dlg.c
parent732380177904489e2d45d1b418080e0187b71d11 (diff)
downloadwireshark-89afc91ccfd137785840d9ced9ec1929e6a13a5b.tar.gz
Give file_selection_new() an argument to specify the parent window of
the file selection dialog. Call gtk_file_chooser_set_do_overwrite_confirmation() in file_selection_new() for FILE_SELECTION_SAVE file selection dialogs, rather than doing it in the individual callers of file_selection_new(). Use gtk_dialog_set_alternative_button_order() in file_selection_new() to set the alternative button order, rather than using #ifdefs. Use file_selection_new() and file_selection_run() in the graph analysis code. (We should clean up other code that uses file_selection_new() to use file_selection_run(), and clean up other code that uses gtk_file_chooser_dialog_new() to use file_selection_new() and file_selection_run().) svn path=/trunk/; revision=49308
Diffstat (limited to 'ui/gtk/file_dlg.c')
-rw-r--r--ui/gtk/file_dlg.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/ui/gtk/file_dlg.c b/ui/gtk/file_dlg.c
index 60c033a068..35224936aa 100644
--- a/ui/gtk/file_dlg.c
+++ b/ui/gtk/file_dlg.c
@@ -66,10 +66,11 @@ static void file_selection_browse_destroy_cb(GtkWidget *win, GtkWidget* file_te)
/* Keys ... */
#define E_FS_CALLER_PTR_KEY "fs_caller_ptr"
-/* Create a file selection dialog box window that belongs to Wireshark's
- main window. */
+/* Create a file selection dialog box window that belongs to a top-level
+ window. */
GtkWidget *
-file_selection_new(const gchar *title, file_selection_action_t action)
+file_selection_new(const gchar *title, GtkWindow *parent,
+ file_selection_action_t action)
{
GtkWidget *win;
GtkFileChooserAction gtk_action;
@@ -111,15 +112,16 @@ file_selection_new(const gchar *title, file_selection_action_t action)
ok_button_text = NULL;
break;
}
- win = gtk_file_chooser_dialog_new(title, GTK_WINDOW(top_level), gtk_action,
-#ifndef _WIN32
+ win = gtk_file_chooser_dialog_new(title, parent, gtk_action,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
ok_button_text, GTK_RESPONSE_ACCEPT,
-#else
- ok_button_text, GTK_RESPONSE_ACCEPT,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-#endif
NULL);
+ gtk_dialog_set_alternative_button_order(GTK_DIALOG(win),
+ GTK_RESPONSE_ACCEPT,
+ GTK_RESPONSE_CANCEL,
+ -1);
+ if (action == FILE_SELECTION_SAVE)
+ gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(win), TRUE);
/* If we've opened a file before, start out by showing the files in the directory
in which that file resided. */
@@ -397,7 +399,7 @@ file_selection_browse(GtkWidget *file_bt, GtkWidget *file_te, const char *label,
GtkWidget *fs;
gchar *f_name;
- fs = file_selection_new(label, action);
+ fs = file_selection_new(label, GTK_WINDOW(caller), action);
g_object_set_data(G_OBJECT(fs), PRINT_FILE_TE_KEY, file_te);