comparison src/gtkaccount.c @ 9705:9124c0ddc434

[gaim-migrate @ 10565] From nosnilmot: When setting an icon for your account... 1) When saving the icon to the cache directory, create the directory if it does not exist 2) Only save the icon if it is in a savable format committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sat, 07 Aug 2004 22:54:27 +0000
parents 5c6f4f0acb8b
children 4d05b6e9e9cd
comparison
equal deleted inserted replaced
9704:767a8f0c5740 9705:9124c0ddc434
571 g_free(random); 571 g_free(random);
572 gaim_debug_error("buddyicon", "Could not open icon for conversion: %s\n", error->message); 572 gaim_debug_error("buddyicon", "Could not open icon for conversion: %s\n", error->message);
573 g_error_free(error); 573 g_error_free(error);
574 return NULL; 574 return NULL;
575 } 575 }
576
577 if (!g_file_test(dirname, G_FILE_TEST_IS_DIR)) {
578 gaim_debug_info("buddyicon", "Creating icon cache directory.\n");
579
580 if (mkdir(dirname, S_IRUSR | S_IWUSR | S_IXUSR) < 0) {
581 gaim_debug_error("buddyicon",
582 "Unable to create directory %s: %s\n",
583 dirname, strerror(errno));
584 return NULL;
585 }
586 }
587
576 for (i = 0; prpl_formats[i]; i++) { 588 for (i = 0; prpl_formats[i]; i++) {
577 gaim_debug_info("buddyicon", "Converting buddy icon to %s as %s\n", prpl_formats[i], filename); 589 gaim_debug_info("buddyicon", "Converting buddy icon to %s as %s\n", prpl_formats[i], filename);
578 /* The gdk-pixbuf documentation is wrong. gdk_pixbuf_save returns TRUE if it was successful, 590 /* The gdk-pixbuf documentation is wrong. gdk_pixbuf_save returns TRUE if it was successful,
579 * FALSE if an error was set. */ 591 * FALSE if an error was set. */
580 if (gdk_pixbuf_save (pixbuf, filename, prpl_formats[i], &error, NULL) == TRUE) 592 if (gdk_pixbuf_format_is_writable(format) &&
593 gdk_pixbuf_save(pixbuf, filename, prpl_formats[i], &error, NULL) == TRUE)
581 break; 594 break;
582 } 595 }
583 if (!error) { 596 if (!error) {
584 g_free(random); 597 g_free(random);
585 g_object_unref(G_OBJECT(pixbuf)); 598 g_object_unref(G_OBJECT(pixbuf));