comparison src/gtkconv.c @ 9670:ed3bbf36de75

[gaim-migrate @ 10522] (10:17:53) datallah: http://www.butfer.com/gaim-patches/dnd_robustness+multiple_file_fix.patch should fix 1003589 and also make us support DND of multiple files to transfer - also makes us not try to transfer directories committer: Tailor Script <tailor@pidgin.im>
author Luke Schierer <lschiere@pidgin.im>
date Thu, 05 Aug 2004 14:17:03 +0000
parents bc2079a32fd9
children 906949cd7a1e
comparison
equal deleted inserted replaced
9669:287d900e2c03 9670:ed3bbf36de75
4418 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); 4418 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t);
4419 } 4419 }
4420 else if (sd->target == gdk_atom_intern("text/uri-list", FALSE)) { 4420 else if (sd->target == gdk_atom_intern("text/uri-list", FALSE)) {
4421 if (!g_ascii_strncasecmp(sd->data, "file://", 7)) { 4421 if (!g_ascii_strncasecmp(sd->data, "file://", 7)) {
4422 GError *converr = NULL; 4422 GError *converr = NULL;
4423 GList *tmp;
4424 GList *files = gaim_uri_list_extract_filenames(sd->data);
4425 for(tmp = files; tmp != NULL ; tmp = g_list_next(tmp)) {
4426 gchar *filename = tmp->data;
4427 /* XXX - Make ft API support creating a transfer with more than one file */
4428 if (g_file_test(filename, G_FILE_TEST_EXISTS)
4429 && !g_file_test(filename, G_FILE_TEST_IS_DIR)
4430 && gaim_conversation_get_type(conv) == GAIM_CONV_IM) {
4431 serv_send_file(gaim_conversation_get_gc(conv), gaim_conversation_get_name(conv), filename);
4432 }
4433 g_free(filename);
4434 }
4435 g_list_free(files);
4423 gchar *file; 4436 gchar *file;
4424 if(!(file = g_filename_from_uri(sd->data, NULL, &converr))) {
4425 gaim_debug(GAIM_DEBUG_ERROR, "conv dnd", "%s\n",
4426 (converr ? converr->message :
4427 "g_filename_from_uri error"));
4428 g_error_free(converr);
4429 return;
4430 }
4431 file = g_strchomp(file);
4432 /* XXX - Handle dragging more than one file. Make ft API support creating a transfer with more than one file */
4433 /* XXX - Attempt to load this file into gdk_pixbuf, or otherwise determine if it is an image. If it is, offer 4437 /* XXX - Attempt to load this file into gdk_pixbuf, or otherwise determine if it is an image. If it is, offer
4434 * the choice of a) sending this file b) inserting this file as an IM image or c) setting this file as a custom 4438 * the choice of a) sending this file b) inserting this file as an IM image or c) setting this file as a custom
4435 * buddy icon for this buddy */ 4439 * buddy icon for this buddy */
4436 if (gaim_conversation_get_type(conv) == GAIM_CONV_IM)
4437 serv_send_file(gaim_conversation_get_gc(conv), gaim_conversation_get_name(conv), file);
4438 g_free(file); 4440 g_free(file);
4439 } 4441 }
4440 } 4442 }
4441 gtk_drag_finish(dc, FALSE, FALSE, t); 4443 gtk_drag_finish(dc, FALSE, FALSE, t);
4442 } 4444 }