# HG changeset patch # User Mark Doliner # Date 1091919267 0 # Node ID 9124c0ddc434d35be18bf9d02a24b8fda868826a # Parent 767a8f0c5740d0e1df666f586c34286c658c4b24 [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 diff -r 767a8f0c5740 -r 9124c0ddc434 src/gtkaccount.c --- a/src/gtkaccount.c Sat Aug 07 22:31:36 2004 +0000 +++ b/src/gtkaccount.c Sat Aug 07 22:54:27 2004 +0000 @@ -573,11 +573,24 @@ g_error_free(error); return NULL; } + + if (!g_file_test(dirname, G_FILE_TEST_IS_DIR)) { + gaim_debug_info("buddyicon", "Creating icon cache directory.\n"); + + if (mkdir(dirname, S_IRUSR | S_IWUSR | S_IXUSR) < 0) { + gaim_debug_error("buddyicon", + "Unable to create directory %s: %s\n", + dirname, strerror(errno)); + return NULL; + } + } + for (i = 0; prpl_formats[i]; i++) { gaim_debug_info("buddyicon", "Converting buddy icon to %s as %s\n", prpl_formats[i], filename); /* The gdk-pixbuf documentation is wrong. gdk_pixbuf_save returns TRUE if it was successful, * FALSE if an error was set. */ - if (gdk_pixbuf_save (pixbuf, filename, prpl_formats[i], &error, NULL) == TRUE) + if (gdk_pixbuf_format_is_writable(format) && + gdk_pixbuf_save(pixbuf, filename, prpl_formats[i], &error, NULL) == TRUE) break; } if (!error) {