comparison src/gtkft.c @ 8282:ab35a0bec13a

[gaim-migrate @ 9006] " This works around the crash on trying to send a file that's too big, by giving an error. It also makes Gaim not crash on canceling the send right there. It doesn't fix the crash on the server doing whatever it did to make us crash. Someone should send me a backtrace of trying to send say a 2meg file without this patch." --Tim Ringenbach committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Tue, 17 Feb 2004 18:45:25 +0000
parents fa6395637e2c
children ffa642240fc1
comparison
equal deleted inserted replaced
8281:98d8faecf5f1 8282:ab35a0bec13a
866 data = GAIM_GTKXFER(xfer); 866 data = GAIM_GTKXFER(xfer);
867 867
868 if (data == NULL) 868 if (data == NULL)
869 return; 869 return;
870 870
871 if (!data->in_list)
872 return;
871 873
872 if ((gaim_xfer_get_status(xfer) == GAIM_XFER_STATUS_CANCEL_LOCAL) && (dialog->auto_clear)) { 874 if ((gaim_xfer_get_status(xfer) == GAIM_XFER_STATUS_CANCEL_LOCAL) && (dialog->auto_clear)) {
873 gaim_gtkxfer_dialog_remove_xfer(dialog, xfer); 875 gaim_gtkxfer_dialog_remove_xfer(dialog, xfer);
874 return; 876 return;
875 } 877 }
1009 gaim_xfer_request_accepted(xfer, data->name); 1011 gaim_xfer_request_accepted(xfer, data->name);
1010 1012
1011 g_free(data->name); 1013 g_free(data->name);
1012 data->name = NULL; 1014 data->name = NULL;
1013 1015
1016 gaim_xfer_unref(xfer);
1014 return 0; 1017 return 0;
1015 } 1018 }
1016 1019
1017 static int 1020 static int
1018 dont_overwrite_cb(GaimXfer *xfer) 1021 dont_overwrite_cb(GaimXfer *xfer)
1040 xfer = (GaimXfer *)user_data; 1043 xfer = (GaimXfer *)user_data;
1041 data = GAIM_GTKXFER(xfer); 1044 data = GAIM_GTKXFER(xfer);
1042 1045
1043 name = gtk_file_selection_get_filename(GTK_FILE_SELECTION(data->filesel)); 1046 name = gtk_file_selection_get_filename(GTK_FILE_SELECTION(data->filesel));
1044 1047
1045 if (gaim_gtk_check_if_dir(name, GTK_FILE_SELECTION(data->filesel))) 1048 if (gaim_gtk_check_if_dir(name, GTK_FILE_SELECTION(data->filesel))) {
1049 gaim_xfer_unref(xfer);
1046 return; 1050 return;
1051 }
1047 1052
1048 if (stat(name, &st) != 0) { 1053 if (stat(name, &st) != 0) {
1049 /* File not found. */ 1054 /* File not found. */
1050 if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { 1055 if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) {
1051 gaim_xfer_request_accepted(xfer, g_strdup(name)); 1056 gaim_xfer_request_accepted(xfer, g_strdup(name));
1070 /* XXX */ 1075 /* XXX */
1071 gaim_xfer_request_denied(xfer); 1076 gaim_xfer_request_denied(xfer);
1072 } 1077 }
1073 else if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { 1078 else if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) {
1074 data->name = g_strdup(name); 1079 data->name = g_strdup(name);
1080 gaim_xfer_ref(xfer);
1075 1081
1076 gaim_request_yes_no(NULL, NULL, 1082 gaim_request_yes_no(NULL, NULL,
1077 _("That file already exists."), 1083 _("That file already exists."),
1078 _("Would you like to overwrite it?"), 1084 _("Would you like to overwrite it?"),
1079 1, xfer, 1085 1, xfer,
1085 } 1091 }
1086 } 1092 }
1087 1093
1088 gtk_widget_destroy(data->filesel); 1094 gtk_widget_destroy(data->filesel);
1089 data->filesel = NULL; 1095 data->filesel = NULL;
1096 gaim_xfer_unref(xfer);
1090 } 1097 }
1091 1098
1092 static int 1099 static int
1093 choose_file(GaimXfer *xfer) 1100 choose_file(GaimXfer *xfer)
1094 { 1101 {
1132 1139
1133 static int 1140 static int
1134 cancel_recv_cb(GaimXfer *xfer) 1141 cancel_recv_cb(GaimXfer *xfer)
1135 { 1142 {
1136 gaim_xfer_request_denied(xfer); 1143 gaim_xfer_request_denied(xfer);
1144 gaim_xfer_unref(xfer);
1137 1145
1138 return 0; 1146 return 0;
1139 } 1147 }
1140 1148
1141 static void 1149 static void
1161 } 1169 }
1162 1170
1163 static void 1171 static void
1164 gaim_gtkxfer_request_file(GaimXfer *xfer) 1172 gaim_gtkxfer_request_file(GaimXfer *xfer)
1165 { 1173 {
1174 gaim_xfer_ref(xfer);
1166 if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) 1175 if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE)
1167 gaim_gtkxfer_ask_recv(xfer); 1176 gaim_gtkxfer_ask_recv(xfer);
1168 else 1177 else
1169 choose_file(xfer); 1178 choose_file(xfer);
1170 } 1179 }