Mercurial > pidgin
changeset 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 | 767a8f0c5740 |
children | d4634f26ef9b |
files | src/gtkaccount.c |
diffstat | 1 files changed, 14 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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) {