summaryrefslogtreecommitdiff
path: root/ui/gtk
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
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')
-rw-r--r--ui/gtk/capture_file_dlg.c14
-rw-r--r--ui/gtk/export_object_dlg.c2
-rw-r--r--ui/gtk/export_sslkeys.c5
-rw-r--r--ui/gtk/file_dlg.c22
-rw-r--r--ui/gtk/file_dlg.h8
-rw-r--r--ui/gtk/firewall_dlg.c12
-rw-r--r--ui/gtk/follow_stream.c14
-rw-r--r--ui/gtk/graph_analysis.c150
-rw-r--r--ui/gtk/graph_analysis.h1
-rw-r--r--ui/gtk/packet_panes.c3
-rw-r--r--ui/gtk/pixmap_save.c10
11 files changed, 81 insertions, 160 deletions
diff --git a/ui/gtk/capture_file_dlg.c b/ui/gtk/capture_file_dlg.c
index e56b762364..c85e4c3027 100644
--- a/ui/gtk/capture_file_dlg.c
+++ b/ui/gtk/capture_file_dlg.c
@@ -493,6 +493,7 @@ gtk_open_file(GtkWidget *w, GString *file_name, GString *display_filter)
return FALSE;
file_open_w = file_selection_new("Wireshark: Open Capture File",
+ GTK_WINDOW(top_level),
FILE_SELECTION_OPEN);
/* it's annoying, that the file chooser dialog is already shown here,
so we cannot use the correct gtk_window_set_default_size() to resize it */
@@ -760,7 +761,8 @@ gtk_merge_file(GtkWidget *w, GString *file_name, GString *display_filter, int *m
/* Default to saving all packets, in the file's current format. */
file_merge_w = file_selection_new("Wireshark: Merge with Capture File",
- FILE_SELECTION_OPEN);
+ GTK_WINDOW(top_level),
+ FILE_SELECTION_OPEN);
/* it's annoying, that the file chooser dialog is already shown here,
so we cannot use the correct gtk_window_set_default_size() to resize it */
gtk_widget_set_size_request(file_merge_w, DEF_WIDTH, DEF_HEIGHT);
@@ -1664,9 +1666,8 @@ gtk_save_as_file(GtkWidget *w _U_, capture_file *cf, GString *file_name, int *fi
/* build the file selection */
file_save_as_w = file_selection_new("Wireshark: Save Capture File As",
+ GTK_WINDOW(top_level),
FILE_SELECTION_SAVE);
- gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(file_save_as_w),
- TRUE);
/* Container for each row of widgets */
@@ -1928,9 +1929,8 @@ gtk_export_specified_packets_file(GtkWidget *w _U_, GString *file_name, int *fil
/* build the file selection */
file_export_specified_packets_w = file_selection_new("Wireshark: Export Specified Packets",
+ GTK_WINDOW(top_level),
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 */
@@ -2160,6 +2160,7 @@ file_color_import_cmd_cb(GtkWidget *color_filters, gpointer filter_list _U_)
activate it (i.e., it doesn't cause us to try to open the file). */
file_color_import_w = file_selection_new("Wireshark: Import Color Filters",
+ GTK_WINDOW(top_level),
FILE_SELECTION_OPEN);
/* Container for each row of widgets */
@@ -2253,9 +2254,8 @@ file_color_export_cmd_cb(GtkWidget *w _U_, gpointer filter_list)
color_selected = FALSE;
file_color_export_w = file_selection_new("Wireshark: Export Color Filters",
+ GTK_WINDOW(top_level),
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);
diff --git a/ui/gtk/export_object_dlg.c b/ui/gtk/export_object_dlg.c
index 14fd23ff9f..87f04c64c5 100644
--- a/ui/gtk/export_object_dlg.c
+++ b/ui/gtk/export_object_dlg.c
@@ -170,6 +170,7 @@ eo_save_clicked_cb(GtkWidget *widget _U_, gpointer arg)
}
save_as_w = file_selection_new("Wireshark: Save Object As ...",
+ GTK_WINDOW(object_list->dlg),
FILE_SELECTION_SAVE);
gtk_window_set_transient_for(GTK_WINDOW(save_as_w),
@@ -207,6 +208,7 @@ eo_save_all_clicked_cb(GtkWidget *widget _U_, gpointer arg)
int count = 0;
save_in_w = file_selection_new("Wireshark: Save All Objects In ...",
+ GTK_WINDOW(object_list->dlg),
FILE_SELECTION_CREATE_FOLDER);
gtk_window_set_transient_for(GTK_WINDOW(save_in_w),
diff --git a/ui/gtk/export_sslkeys.c b/ui/gtk/export_sslkeys.c
index 2d1c302e56..67a9db9924 100644
--- a/ui/gtk/export_sslkeys.c
+++ b/ui/gtk/export_sslkeys.c
@@ -180,8 +180,9 @@ savesslkeys_cb(GtkWidget * w _U_, gpointer data _U_)
/*
* Build the dialog box we need.
*/
- savesslkeys_dlg = file_selection_new("Wireshark: Export SSL Session Keys", FILE_SELECTION_SAVE);
- gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(savesslkeys_dlg), TRUE);
+ savesslkeys_dlg = file_selection_new("Wireshark: Export SSL Session Keys",
+ GTK_WINDOW(top_level),
+ FILE_SELECTION_SAVE);
/* label */
label = g_strdup_printf("Will save %u SSL Session %s to specified file.",
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);
diff --git a/ui/gtk/file_dlg.h b/ui/gtk/file_dlg.h
index 0b217400cf..d2659d04b8 100644
--- a/ui/gtk/file_dlg.h
+++ b/ui/gtk/file_dlg.h
@@ -60,14 +60,16 @@ typedef enum {
FILE_SELECTION_CREATE_FOLDER /**< browse for a dir. to save in */
} file_selection_action_t;
-/** Create a file selection dialog box window that belongs to Wireshark's
- * main window. See window_new() for usage.
+/** Create a file selection dialog box window that belongs to a top-level
+ * window. See window_new() for usage.
*
* @param title the title for the new file selection dialog
+ * @param parent the top-level window
* @param action the desired action
* @return the newly created file selection dialog
*/
-extern GtkWidget *file_selection_new(const gchar *title, file_selection_action_t action);
+extern GtkWidget *file_selection_new(const gchar *title, GtkWindow *parent,
+ file_selection_action_t action);
/** Set the current folder for a file selection dialog.
*
diff --git a/ui/gtk/firewall_dlg.c b/ui/gtk/firewall_dlg.c
index 01acb01926..167751f3e6 100644
--- a/ui/gtk/firewall_dlg.c
+++ b/ui/gtk/firewall_dlg.c
@@ -679,20 +679,14 @@ firewall_copy_cmd_cb(GtkWidget *w _U_, gpointer data)
static void
firewall_save_as_cmd_cb(GtkWidget *w _U_, gpointer data)
{
- GtkWidget *new_win;
+ GtkWidget *caller = gtk_widget_get_toplevel(w);
+ GtkWidget *new_win;
rule_info_t *rule_info = (rule_info_t *)data;
-#if 0 /* XXX: GtkFileChooserDialog/gtk_dialog_run currently being used is effectively modal so this is not req'd */
- if (rule_info->firewall_save_as_w != NULL) {
- /* There's already a dialog box; reactivate it. */
- reactivate_window(rule_info->firewall_save_as_w);
- return;
- }
-#endif
new_win = file_selection_new("Wireshark: Save Firewall ACL Rule",
+ GTK_WINDOW(caller),
FILE_SELECTION_SAVE);
rule_info->firewall_save_as_w = new_win;
- gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(new_win), TRUE);
/* Tuck away the rule_info object into the window */
g_object_set_data(G_OBJECT(new_win), WS_RULE_INFO_KEY, rule_info);
diff --git a/ui/gtk/follow_stream.c b/ui/gtk/follow_stream.c
index 41969e8760..f6c7905a7e 100644
--- a/ui/gtk/follow_stream.c
+++ b/ui/gtk/follow_stream.c
@@ -524,22 +524,16 @@ follow_print_stream(GtkWidget * w _U_, gpointer data)
*/
static void
-follow_save_as_cmd_cb(GtkWidget *w _U_, gpointer data)
+follow_save_as_cmd_cb(GtkWidget *w, gpointer data)
{
- GtkWidget *new_win;
+ GtkWidget *caller = gtk_widget_get_toplevel(w);
+ GtkWidget *new_win;
follow_info_t *follow_info = (follow_info_t *)data;
-#if 0 /* XXX: GtkFileChooserDialog/gtk_dialog_run currently being used is effectively modal so this is not req'd */
- if (follow_info->follow_save_as_w != NULL) {
- /* There's already a dialog box; reactivate it. */
- reactivate_window(follow_info->follow_save_as_w);
- return;
- }
-#endif
new_win = file_selection_new("Wireshark: Save Follow Stream As",
+ GTK_WINDOW(caller),
FILE_SELECTION_SAVE);
follow_info->follow_save_as_w = new_win;
- gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(new_win), TRUE);
/* Tuck away the follow_info object into the window */
g_object_set_data(G_OBJECT(new_win), E_FOLLOW_INFO_KEY, follow_info);
diff --git a/ui/gtk/graph_analysis.c b/ui/gtk/graph_analysis.c
index 4339390c77..9521803cb4 100644
--- a/ui/gtk/graph_analysis.c
+++ b/ui/gtk/graph_analysis.c
@@ -71,8 +71,6 @@
/****************************************************************************/
-static GtkWidget *save_to_file_w = NULL;
-
#define MAX_LABEL 50
#define MAX_COMMENT 100
#define ITEM_HEIGHT 20
@@ -295,7 +293,8 @@ static void overwrite (GString *gstr, char *text_to_insert, guint32 p1, guint32
}
/****************************************************************************/
-static gboolean dialog_graph_dump_to_file(graph_analysis_data_t *user_data)
+static gboolean
+dialog_graph_dump_to_file(char *pathname, graph_analysis_data_t *user_data)
{
guint32 i, first_node, display_items, display_nodes;
guint32 start_position, end_position, item_width, header_length;
@@ -312,9 +311,9 @@ static gboolean dialog_graph_dump_to_file(graph_analysis_data_t *user_data)
FILE *of;
- of = ws_fopen(user_data->dlg.save_file, "w");
+ of = ws_fopen(pathname, "w");
if (of==NULL) {
- open_failure_alert_box(user_data->dlg.save_file, errno, TRUE);
+ open_failure_alert_box(pathname, errno, TRUE);
return FALSE;
}
@@ -517,81 +516,30 @@ exit:
}
/****************************************************************************/
-static void save_to_file_destroy_cb(GtkWidget *win _U_, gpointer user_data _U_)
-{
- /* Note that we no longer have a Save to file dialog box. */
- save_to_file_w = NULL;
-}
-
-/****************************************************************************/
/* save in a file */
-/* first an auxiliary function in case we need an overwrite confirmation dialog */
-
-static void overwrite_existing_file_cb(gpointer dialog _U_, gint btn, gpointer user_data)
+static char *
+gtk_save_graph_as_plain_text_file(graph_analysis_data_t *user_data)
{
- switch (btn) {
- case(ESD_BTN_YES):
- /* overwrite the file*/
- dialog_graph_dump_to_file((graph_analysis_data_t *)user_data);
- break;
- case(ESD_BTN_NO):
- break;
- default:
- g_assert_not_reached();
- }
-}
+ GtkWidget *save_to_file_w;
+ char *pathname;
-/* and then the save in a file dialog itself */
-
-static gboolean save_to_file_ok_cb(GtkWidget *ok_bt _U_, gpointer user_data)
-{
- FILE *file_test;
- graph_analysis_data_t *user_data_p = (graph_analysis_data_t *)user_data;
-
- user_data_p->dlg.save_file = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(save_to_file_w));
-
- /* Perhaps the user specified a directory instead of a file.
- Check whether they did. */
- if (test_for_directory(user_data_p->dlg.save_file) == EISDIR) {
- /* It's a directory - set the file selection box to display it. */
- set_last_open_dir(user_data_p->dlg.save_file);
- file_selection_set_current_folder(save_to_file_w, get_last_open_dir());
- gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(save_to_file_w), "");
- g_free(user_data_p->dlg.save_file);
- return FALSE; /* run the dialog again */
+ save_to_file_w = file_selection_new("Wireshark: Save graph to plain text file",
+ GTK_WINDOW(user_data->dlg.window),
+ FILE_SELECTION_SAVE);
+ gtk_dialog_set_default_response(GTK_DIALOG(save_to_file_w),
+ GTK_RESPONSE_ACCEPT);
+
+ pathname = file_selection_run(save_to_file_w);
+ if (pathname == NULL) {
+ /* User cancelled or closed the dialog. */
+ return NULL;
}
- /* GtkFileChooserDialog/gtk_dialog_run is currently being used. */
- /* So: Trying to leave the graph_analysis window up if graph_dump */
- /* fails doesn't work well. */
- /* (See comment under on_save_bt_clicked) */
- /* */
- /* As a work-around: */
- /* We'll always destroy the window. */
-
- /* check whether the file exists */
- file_test = ws_fopen(user_data_p->dlg.save_file, "r");
- if (file_test!=NULL) {
- gpointer dialog;
- dialog = simple_dialog(ESD_TYPE_CONFIRMATION, ESD_BTNS_YES_NO,
- "%sFile: \"%s\" already exists!%s\n\n"
- "Do you want to overwrite it?",
- simple_dialog_primary_start(), user_data_p->dlg.save_file, simple_dialog_primary_end());
- simple_dialog_set_cb(dialog, overwrite_existing_file_cb, user_data);
- fclose(file_test);
- return TRUE;
- }
+ /* We've crosed the Rubicon; get rid of the dialog box. */
+ window_destroy(save_to_file_w);
- else{
- if (!dialog_graph_dump_to_file((graph_analysis_data_t *)user_data)) {
- /* Couldn't open the file ? */
- g_free(user_data_p->dlg.save_file);
- return TRUE;
- }
- }
- g_free(user_data_p->dlg.save_file);
- return TRUE;
+ return pathname;
}
/****************************************************************************/
@@ -599,46 +547,26 @@ static void
on_save_bt_clicked (GtkWidget *button _U_,
graph_analysis_data_t *user_data)
{
-#if 0 /* XXX: GtkFileChooserDialog/gtk_dialog_run currently being used is effectively modal so this is not req'd */
- if (save_to_file_w != NULL) {
- /* There's already a Save to file dialog box; reactivate it. */
- reactivate_window(save_to_file_w);
- return;
- }
-#endif
- save_to_file_w =
- gtk_file_chooser_dialog_new("Wireshark: Save graph to plain text file",
- GTK_WINDOW(user_data->dlg.window),
- GTK_FILE_CHOOSER_ACTION_SAVE,
- GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- NULL);
-
- g_signal_connect(save_to_file_w, "delete_event", G_CALLBACK(window_delete_event_cb), NULL);
- g_signal_connect(save_to_file_w, "destroy", G_CALLBACK(save_to_file_destroy_cb), NULL);
-
- gtk_widget_show(save_to_file_w);
- window_present(save_to_file_w);
-
- /* "Run" the GtkFileChooserDialog. */
- /* Upon exit: If "Accept" run the OK callback. */
- /* If the OK callback returns with a FALSE status, re-run the dialog.*/
- /* Destroy the window. */
- /* XXX: If the OK callback pops up an alert box (eg: for an error) it *must* */
- /* return with a TRUE status so that the dialog window will be destroyed. */
- /* Trying to re-run the dialog after popping up an alert box will not work */
- /* since the user will not be able to dismiss the alert box. */
- /* The (somewhat unfriendly) effect: the user must re-invoke the */
- /* GtkFileChooserDialog whenever the OK callback pops up an alert box. */
- /* */
- /* ToDo: use GtkFileChooserWidget in a dialog window instead of */
- /* GtkFileChooserDialog. */
- while (gtk_dialog_run(GTK_DIALOG(save_to_file_w)) == GTK_RESPONSE_ACCEPT) {
- if (save_to_file_ok_cb(NULL, user_data)) {
- break; /* we're done */
+ char *pathname;
+
+ /*
+ * Loop until the user either selects a file or gives up.
+ */
+ for (;;) {
+ pathname = gtk_save_graph_as_plain_text_file(user_data);
+ if (pathname == NULL) {
+ /* User gave up. */
+ break;
+ }
+ if (dialog_graph_dump_to_file(pathname, user_data)) {
+ /* We succeeded. */
+ g_free(pathname);
+ break;
}
+ /* Dump failed; let the user select another file
+ or give up. */
+ g_free(pathname);
}
- window_destroy(save_to_file_w);
}
/****************************************************************************/
diff --git a/ui/gtk/graph_analysis.h b/ui/gtk/graph_analysis.h
index 44b810e547..7ae458874e 100644
--- a/ui/gtk/graph_analysis.h
+++ b/ui/gtk/graph_analysis.h
@@ -108,7 +108,6 @@ typedef struct _graph_analysis_dialog_data_t {
guint32 selected_item; /**< the selected item */
display_items_t items[NUM_DISPLAY_ITEMS];
guint32 left_x_border;
- char *save_file;
char *title; /**< Graph analysis window's title */
} graph_analysis_dialog_data_t;
diff --git a/ui/gtk/packet_panes.c b/ui/gtk/packet_panes.c
index 213b225e8e..2c1f18fd4a 100644
--- a/ui/gtk/packet_panes.c
+++ b/ui/gtk/packet_panes.c
@@ -827,8 +827,7 @@ savehex_cb(GtkWidget * w _U_, gpointer data _U_)
/*
* Build the dialog box we need.
*/
- savehex_dlg = file_selection_new("Wireshark: Export Selected Packet Bytes", FILE_SELECTION_SAVE);
- gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(savehex_dlg), TRUE);
+ savehex_dlg = file_selection_new("Wireshark: Export Selected Packet Bytes", GTK_WINDOW(top_level), FILE_SELECTION_SAVE);
/* label */
label = g_strdup_printf("Will save %u %s of raw binary data to specified file.",
diff --git a/ui/gtk/pixmap_save.c b/ui/gtk/pixmap_save.c
index a2fdecce2b..9122b7b127 100644
--- a/ui/gtk/pixmap_save.c
+++ b/ui/gtk/pixmap_save.c
@@ -58,7 +58,7 @@ pixmap_save_cb(GtkWidget *w, gpointer pixmap_ptr _U_)
GdkPixbufFormat *pixbuf_format;
GtkWidget *main_vb, *save_as_type_hb, *type_lb, *type_cm;
GSList *file_formats,*ffp;
- GdkWindow *parent;
+ GtkWidget *parent;
gchar *format_name;
guint format_index = 0;
@@ -84,9 +84,10 @@ pixmap_save_cb(GtkWidget *w, gpointer pixmap_ptr _U_)
return;
}
+ parent = gtk_widget_get_toplevel(w);
save_as_w = file_selection_new("Wireshark: Save Graph As ...",
+ GTK_WINDOW(parent),
FILE_SELECTION_SAVE);
- gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(save_as_w), TRUE);
/* Container for each row of widgets */
main_vb = ws_gtk_box_new(GTK_ORIENTATION_VERTICAL, 0, FALSE);
@@ -111,7 +112,7 @@ pixmap_save_cb(GtkWidget *w, gpointer pixmap_ptr _U_)
pixbuf_format = (GdkPixbufFormat *)ffp->data;
if (gdk_pixbuf_format_is_writable(pixbuf_format)) {
format_name = gdk_pixbuf_format_get_name(pixbuf_format);
- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(type_cm),
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT(type_cm),
format_name);
if (!(g_ascii_strcasecmp(format_name, "png")))
default_index = format_index;
@@ -126,8 +127,7 @@ pixmap_save_cb(GtkWidget *w, gpointer pixmap_ptr _U_)
gtk_widget_show(save_as_w);
window_present(save_as_w);
- parent = gtk_widget_get_parent_window(w);
- gdk_window_set_transient_for(gtk_widget_get_window(save_as_w), parent);
+ gtk_window_set_transient_for(GTK_WINDOW(save_as_w), GTK_WINDOW(parent));
/*
* Loop until the user either selects a file or gives up.