changeset 5169:71927464a1db

[gaim-migrate @ 5533] I needed to do this for getfile. Basically, I added a new ui operation for when a new xfer is created. The ui operation creates the needed ui data. Previously it was done when the file was choosen, but with getfile, when sending files to other peeps there isn't a "save file" or "choose file to send" dialog. Ya catch my drift? committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Fri, 18 Apr 2003 21:01:38 +0000
parents 0f31d00d2501
children 13ffa9ae4282
files src/ft.c src/ft.h src/gtkft.c
diffstat 3 files changed, 19 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/ft.c	Fri Apr 18 19:48:42 2003 +0000
+++ b/src/ft.c	Fri Apr 18 21:01:38 2003 +0000
@@ -41,6 +41,7 @@
 			  const char *who)
 {
 	struct gaim_xfer *xfer;
+	struct gaim_xfer_ui_ops *ui_ops;
 
 	if (account == NULL || type == GAIM_XFER_UNKNOWN || who == NULL)
 		return NULL;
@@ -52,6 +53,11 @@
 	xfer->who     = g_strdup(who);
 	xfer->ui_ops  = gaim_get_xfer_ui_ops();
 
+	ui_ops = gaim_xfer_get_ui_ops(xfer);
+
+	if (ui_ops != NULL && ui_ops->new != NULL)
+		ui_ops->new(xfer);
+
 	return xfer;
 }
 
--- a/src/ft.h	Fri Apr 18 19:48:42 2003 +0000
+++ b/src/ft.h	Fri Apr 18 21:01:38 2003 +0000
@@ -47,6 +47,7 @@
  */
 struct gaim_xfer_ui_ops
 {
+	void (*new)(struct gaim_xfer *xfer);
 	void (*destroy)(struct gaim_xfer *xfer);
 	void (*request_file)(struct gaim_xfer *xfer);
 	void (*ask_cancel)(struct gaim_xfer *xfer);
--- a/src/gtkft.c	Fri Apr 18 19:48:42 2003 +0000
+++ b/src/gtkft.c	Fri Apr 18 21:01:38 2003 +0000
@@ -917,6 +917,16 @@
  * File Transfer UI Ops
  **************************************************************************/
 static void
+gaim_gtkxfer_new(struct gaim_xfer *xfer)
+{
+	struct gaim_gtkxfer_ui_data *data;
+
+	/* This is where we're setting xfer->ui_data for the first time. */
+	data = g_malloc0(sizeof(struct gaim_gtkxfer_ui_data));
+	xfer->ui_data = data;
+}
+
+static void
 gaim_gtkxfer_destroy(struct gaim_xfer *xfer)
 {
 	gaim_gtkxfer_dialog_remove_xfer(xfer_dialog, xfer);
@@ -1037,12 +1047,9 @@
 	char *cur_dir, *init_str;
 	struct gaim_gtkxfer_ui_data *data;
 
+	data = GAIM_GTKXFER(xfer);
 	cur_dir = g_get_current_dir();
 
-	/* This is where we're setting xfer->ui_data for the first time. */
-	data = g_malloc0(sizeof(struct gaim_gtkxfer_ui_data));
-	xfer->ui_data = data;
-
 	if (gaim_xfer_get_type(xfer) == GAIM_XFER_SEND)
 		data->filesel = gtk_file_selection_new(_("Gaim - Open..."));
 	else
@@ -1158,6 +1165,7 @@
 
 struct gaim_xfer_ui_ops ops =
 {
+	gaim_gtkxfer_new,
 	gaim_gtkxfer_destroy,
 	gaim_gtkxfer_request_file,
 	gaim_gtkxfer_ask_cancel,