changeset 18411:3849776d0f71

Fix some crashes resulting from rejecting file-transfer requests.
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sun, 01 Jul 2007 17:05:16 +0000
parents 719f73b9a593
children 304036f17274
files finch/gntrequest.c
diffstat 1 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/finch/gntrequest.c	Sun Jul 01 15:57:42 2007 +0000
+++ b/finch/gntrequest.c	Sun Jul 01 17:05:16 2007 +0000
@@ -582,7 +582,7 @@
 }
 
 static void
-file_cancel_cb(GntWidget *wid, gpointer fq)
+file_cancel_cb(gpointer fq, GntWidget *wid)
 {
 	PurpleGntFileRequest *data = fq;
 	if (data->cbs[1] != NULL)
@@ -592,7 +592,7 @@
 }
 
 static void
-file_ok_cb(GntWidget *wid, gpointer fq)
+file_ok_cb(gpointer fq, GntWidget *widget)
 {
 	PurpleGntFileRequest *data = fq;
 	char *file = gnt_file_sel_get_selected_file(GNT_FILE_SEL(data->dialog));
@@ -639,13 +639,19 @@
 
 	if (savedialog)
 		gnt_file_sel_set_suggested_filename(sel, filename);
+
 	g_signal_connect(G_OBJECT(sel->cancel), "activate",
+			G_CALLBACK(action_performed), window);
+	g_signal_connect(G_OBJECT(sel->select), "activate",
+			G_CALLBACK(action_performed), window);
+	g_signal_connect_swapped(G_OBJECT(sel->cancel), "activate",
 			G_CALLBACK(file_cancel_cb), data);
-	g_signal_connect(G_OBJECT(sel->select), "activate",
+	g_signal_connect_swapped(G_OBJECT(sel->select), "activate",
 			G_CALLBACK(file_ok_cb), data);
-	g_signal_connect_swapped(G_OBJECT(window), "destroy",
-			G_CALLBACK(file_request_destroy), data);
 
+	setup_default_callback(window, file_cancel_cb, data);
+	g_object_set_data_full(G_OBJECT(window), "filerequestdata", data,
+			(GDestroyNotify)file_request_destroy);
 	gnt_widget_show(window);
 
 	return window;