diff options
author | Dan Winship <danw@src.gnome.org> | 2001-09-20 02:15:57 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2001-09-20 02:15:57 +0800 |
commit | 982c014bffdcf15207e8a778689d1156ffc5161e (patch) | |
tree | 3b7cd46eae87313a65a85a3180bac11d9f4179d4 /my-evolution | |
parent | 27dd700efbc33945e59eab8f35c62a6444b334bd (diff) | |
download | gsoc2013-evolution-982c014bffdcf15207e8a778689d1156ffc5161e.tar.gz gsoc2013-evolution-982c014bffdcf15207e8a778689d1156ffc5161e.tar.zst gsoc2013-evolution-982c014bffdcf15207e8a778689d1156ffc5161e.zip |
Hack around gdkpixbuf lossage by not trying to display the images
* e-summary.c (read_callback, etc): Hack around gdkpixbuf lossage
by not trying to display the images incrementall. Instead, just
wait until we've read the whole file, then display it all at once.
Prevents garbage when rendering the icons.
svn path=/trunk/; revision=12982
Diffstat (limited to 'my-evolution')
-rw-r--r-- | my-evolution/ChangeLog | 7 | ||||
-rw-r--r-- | my-evolution/e-summary.c | 36 |
2 files changed, 25 insertions, 18 deletions
diff --git a/my-evolution/ChangeLog b/my-evolution/ChangeLog index d2d86d2436..2511007499 100644 --- a/my-evolution/ChangeLog +++ b/my-evolution/ChangeLog @@ -1,3 +1,10 @@ +2001-09-19 Dan Winship <danw@ximian.com> + + * e-summary.c (read_callback, etc): Hack around gdkpixbuf lossage + by not trying to display the images incrementall. Instead, just + wait until we've read the whole file, then display it all at once. + Prevents garbage when rendering the icons. + 2001-09-18 Iain Holmes <iain@ximian.com> * e-summary-preferences.c (weather_remove_clicked_cb): Select the next diff --git a/my-evolution/e-summary.c b/my-evolution/e-summary.c index 582926bf10..5c2f8feabd 100644 --- a/my-evolution/e-summary.c +++ b/my-evolution/e-summary.c @@ -65,9 +65,8 @@ struct _ESummaryMailFolderInfo { typedef struct _DownloadInfo { GtkHTMLStream *stream; char *uri; - char *buffer; - - gboolean error; + char *buffer, *ptr; + guint32 bufsize; } DownloadInfo; struct _ESummaryPrivate { @@ -256,17 +255,16 @@ close_callback (GnomeVFSAsyncHandle *handle, { DownloadInfo *info = data; - if (info->error) { - gtk_html_stream_close (info->stream, GTK_HTML_STREAM_ERROR); - } else { - gtk_html_stream_close (info->stream, GTK_HTML_STREAM_OK); - } - g_free (info->uri); g_free (info->buffer); g_free (info); } +/* The way this behaves is a workaround for ximian bug 10235: loading + * the image into gtkhtml progressively will result in garbage being + * drawn, so we wait until we've read the whole thing and then write + * it all at once. + */ static void read_callback (GnomeVFSAsyncHandle *handle, GnomeVFSResult result, @@ -278,16 +276,18 @@ read_callback (GnomeVFSAsyncHandle *handle, DownloadInfo *info = data; if (result != GNOME_VFS_OK && result != GNOME_VFS_ERROR_EOF) { - info->error = TRUE; + gtk_html_stream_close (info->stream, GTK_HTML_STREAM_ERROR); gnome_vfs_async_close (handle, close_callback, info); - } - - if (bytes_read == 0) { - info->error = FALSE; + } else if (bytes_read == 0) { + gtk_html_stream_write (info->stream, info->buffer, info->ptr - info->buffer); + gtk_html_stream_close (info->stream, GTK_HTML_STREAM_OK); gnome_vfs_async_close (handle, close_callback, info); } else { - gtk_html_stream_write (info->stream, buffer, bytes_read); - gnome_vfs_async_read (handle, buffer, 4095, read_callback, info); + bytes_read += info->ptr - info->buffer; + info->bufsize += 4096; + info->buffer = g_realloc (info->buffer, info->bufsize); + info->ptr = info->buffer + bytes_read; + gnome_vfs_async_read (handle, info->ptr, 4095, read_callback, info); } } @@ -303,7 +303,8 @@ open_callback (GnomeVFSAsyncHandle *handle, return; } - info->buffer = g_new (char, 4096); + info->bufsize = 4096; + info->buffer = info->ptr = g_new (char, info->bufsize); gnome_vfs_async_read (handle, info->buffer, 4095, read_callback, info); } @@ -364,7 +365,6 @@ e_summary_url_requested (GtkHTML *html, info = g_new (DownloadInfo, 1); info->stream = stream; info->uri = filename; - info->error = FALSE; gnome_vfs_async_open (&handle, filename, GNOME_VFS_OPEN_READ, (GnomeVFSAsyncOpenCallback) open_callback, info); |