diff options
Diffstat (limited to 'my-evolution')
-rw-r--r-- | my-evolution/ChangeLog | 46 | ||||
-rw-r--r-- | my-evolution/Makefile.am | 4 | ||||
-rw-r--r-- | my-evolution/e-summary-offline-handler.c | 5 | ||||
-rw-r--r-- | my-evolution/e-summary-rdf.c | 166 | ||||
-rw-r--r-- | my-evolution/e-summary-tasks.c | 22 | ||||
-rw-r--r-- | my-evolution/e-summary-weather.c | 153 | ||||
-rw-r--r-- | my-evolution/e-summary.c | 156 | ||||
-rw-r--r-- | my-evolution/main.c | 2 | ||||
-rw-r--r-- | my-evolution/weather.h | 7 |
9 files changed, 221 insertions, 340 deletions
diff --git a/my-evolution/ChangeLog b/my-evolution/ChangeLog index c1f2b9fe8f..28a5bc57c7 100644 --- a/my-evolution/ChangeLog +++ b/my-evolution/ChangeLog @@ -1,3 +1,49 @@ +2002-01-04 Iain Holmes <iain@ximian.com> + + * e-summary-weather.c (message_finished): Made the Weather message + more verbose, and say which station data could not be retrieved for. + +2002-01-03 Iain Holmes <iain@ximian.com> + + * Makefile.am: Use SOUP_CFLAGS and SOUP_LIBS + + * e-summary-rdf.c: Include soup.h + (close_callback): Remove. + (message_finished): Generate the cache and other stuff and redraw. + (read_callback): Remove. + (open_callback): Remove. + (e_summary_rdf_update): Replace gnome-vfs with Soup stuff. + (e_summary_rdf_count): Replace gnome-vfs with soup. + (rdf_free): ditto + (e_summary_rdf_set_online): Ditto + + * e-summary-weather.c: Include soup.h + (close_callback): Remove. + (message_finished): Parse all the downloaded html. + (read_callback): Remove. + (open_callback): Remove. + (e_summary_weather_update): Use soup instead of gnome-vfs + (weather_free): Ditto. + (e_summary_weather_count): Ditto. + (e_summary_weather_add): ditto; + (e_summary_weather_set_online): Ditto. + + * e-summary.c (close_callback): Remove. + (read_callback): Remove. + (open_callback): Remove. + (e_read_file_with_length): Read a file. + (e_summary_url_requested): Create the images cache. Load the image + with e_read_file_with_length instead of gnome-vfs. + + * main.c (main): Remove gnome_vfs_init. + + * weather.h: Replace gnome-vfs stuff. + +2002-01-03 Iain Holmes <iain@ximian.com> + + * e-summary-offline-handler.c (impl_prepareForOffline): Create an + empty list if the summary == NULL. Fixes bug 18025 + 2001-12-20 Ettore Perazzoli <ettore@ximian.com> [Fixes #17377, Evolution doesn't work on multi-depth displays.] diff --git a/my-evolution/Makefile.am b/my-evolution/Makefile.am index 1213ac79f2..6e057d9493 100644 --- a/my-evolution/Makefile.am +++ b/my-evolution/Makefile.am @@ -13,6 +13,7 @@ INCLUDES = \ $(GTKHTML_CFLAGS) \ $(BONOBO_CONF_CFLAGS) \ $(BONOBO_GNOME_CFLAGS) \ + $(SOUP_CFLAGS) \ -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ -DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \ -DEVOLUTION_DATADIR=\""$(datadir)"\" \ @@ -69,9 +70,10 @@ evolution_executive_summary_LDADD = \ $(top_builddir)/libversit/libversit.la \ $(top_builddir)/libical/src/libical/libical-evolution.la \ $(top_builddir)/libwombat/libwombat.la \ - $(BONOBO_VFS_GNOME_LIBS) \ + $(BONOBO_GNOME_LIBS) \ $(BONOBO_CONF_LIBS) \ $(EXTRA_GNOME_LIBS) \ + $(SOUP_LIBS) \ -lgal \ $(GTKHTML_LIBS) diff --git a/my-evolution/e-summary-offline-handler.c b/my-evolution/e-summary-offline-handler.c index 90f45e9ced..d03bf0eb32 100644 --- a/my-evolution/e-summary-offline-handler.c +++ b/my-evolution/e-summary-offline-handler.c @@ -100,6 +100,11 @@ impl_prepareForOffline (PortableServer_Servant servant, if (priv->summary != NULL) { *active_connection_list = e_summary_offline_handler_create_connection_list (priv->summary); + } else { + *active_connection_list = GNOME_Evolution_ConnectionList__alloc (); + (*active_connection_list)->_length = 0; + (*active_connection_list)->_maximum = 0; + (*active_connection_list)->_buffer = CORBA_sequence_GNOME_Evolution_Connection_allocbuf (0); } } diff --git a/my-evolution/e-summary-rdf.c b/my-evolution/e-summary-rdf.c index 015f75246e..1fe6d33003 100644 --- a/my-evolution/e-summary-rdf.c +++ b/my-evolution/e-summary-rdf.c @@ -33,8 +33,12 @@ #include <libgnome/gnome-defs.h> #include <libgnome/gnome-i18n.h> + + #include <gal/widgets/e-unicode.h> -#include <libgnomevfs/gnome-vfs.h> + +#include <libsoup/soup.h> + #include "e-summary.h" struct _ESummaryRDF { @@ -49,14 +53,14 @@ struct _ESummaryRDF { typedef struct _RDF { char *uri; char *html; - GnomeVFSAsyncHandle *handle; - GString *string; - char *buffer; xmlDocPtr cache; ESummary *summary; gboolean shown; + + /* Soup stuff */ + SoupMessage *message; } RDF; int xmlSubstituteEntitiesDefaultValue = 1; @@ -314,120 +318,35 @@ display_doc (RDF *r) } static void -close_callback (GnomeVFSAsyncHandle *handle, - GnomeVFSResult result, - RDF *r) +message_finished (SoupMessage *msg, + gpointer userdata) { - ESummary *summary; - char *xml; xmlDocPtr doc; + RDF *r = (RDF *) userdata; - summary = r->summary; - if (summary->rdf->connection->callback) { - ESummaryConnection *connection = summary->rdf->connection; - connection->callback (summary, connection->callback_closure); - } + if (SOUP_MESSAGE_IS_ERROR (msg)) { + g_warning ("Message failed: %d\n%s", msg->errorcode, + msg->errorphrase); + r->cache = NULL; + r->message = NULL; - if (r->handle == NULL) { - g_free (r->buffer); - r->buffer = NULL; - g_string_free (r->string, TRUE); - r->string = NULL; + display_doc (r); return; } - r->handle = NULL; - g_free (r->buffer); - r->buffer = NULL; - xml = r->string->str; - g_string_free (r->string, FALSE); - r->string = NULL; - if (r->cache != NULL) { xmlFreeDoc (r->cache); r->cache = NULL; } - doc = xmlParseMemory (xml, strlen (xml)); -#if 0 - if (doc == NULL) { - g_free (r->html); - r->html = g_strdup ("<b>Error parsing XML</b>"); - - e_summary_draw (r->summary); - g_free (xml); - return; - } -#endif - g_free (xml); + doc = xmlParseMemory (msg->response.body, msg->response.length); r->cache = doc; + r->message = NULL; - /* Draw it */ + /* Display it */ display_doc (r); } -static void -read_callback (GnomeVFSAsyncHandle *handle, - GnomeVFSResult result, - gpointer buffer, - GnomeVFSFileSize bytes_requested, - GnomeVFSFileSize bytes_read, - RDF *r) -{ - if (result != GNOME_VFS_OK && result != GNOME_VFS_ERROR_EOF) { - char *str; - - g_free (r->html); - str = g_strdup_printf ("<b>%s:</b><br>%s", _("Error downloading RDF"), - r->uri); - r->html = e_utf8_from_locale_string (str); - - g_free (str); - - e_summary_draw (r->summary); - r->handle = NULL; - gnome_vfs_async_close (handle, - (GnomeVFSAsyncCloseCallback) close_callback, r); - return; - } - - if (bytes_read == 0) { - gnome_vfs_async_close (handle, - (GnomeVFSAsyncCloseCallback) close_callback, r); - } else { - *((char *) buffer + bytes_read) = 0; - g_string_append (r->string, (const char *) buffer); - gnome_vfs_async_read (handle, buffer, 4095, - (GnomeVFSAsyncReadCallback) read_callback, r); - } -} - -static void -open_callback (GnomeVFSAsyncHandle *handle, - GnomeVFSResult result, - RDF *r) -{ - if (result != GNOME_VFS_OK) { - char *str; - - r->handle = NULL; - g_free (r->html); - str = g_strdup_printf ("<b>%s:</b><br>%s", _("Error downloading RDF"), - r->uri); - r->html = e_utf8_from_locale_string (str); - g_free (str); - - display_doc (r); - return; - } - - r->string = g_string_new (""); - r->buffer = g_new (char, 4096); - - gnome_vfs_async_read (handle, r->buffer, 4095, - (GnomeVFSAsyncReadCallback) read_callback, r); -} - gboolean e_summary_rdf_update (ESummary *summary) { @@ -439,27 +358,23 @@ e_summary_rdf_update (ESummary *summary) } for (r = summary->rdf->rdfs; r; r = r->next) { + SoupContext *context; RDF *rdf = r->data; - if (rdf->handle) { - gnome_vfs_async_cancel (rdf->handle); - rdf->handle = NULL; + if (rdf->message) { + soup_message_cancel (rdf->message); } - if (rdf->buffer) { - g_free (rdf->buffer); - rdf->buffer = NULL; - } - - if (rdf->string) { - g_string_free (rdf->string, TRUE); - rdf->string = NULL; + context = soup_context_get (rdf->uri); + if (context == NULL) { + g_warning ("Invalid URL: %s", rdf->uri); + soup_context_unref (context); + continue; } - g_warning ("Opening %s", rdf->uri); - gnome_vfs_async_open (&rdf->handle, rdf->uri, - GNOME_VFS_OPEN_READ, - (GnomeVFSAsyncOpenCallback) open_callback, rdf); + rdf->message = soup_message_new (context, SOUP_METHOD_GET); + soup_context_unref (context); + soup_message_queue (rdf->message, message_finished, rdf); } return TRUE; @@ -510,7 +425,7 @@ e_summary_rdf_count (ESummary *summary, for (p = rdf->rdfs; p; p = p->next) { RDF *r = p->data; - if (r->handle != NULL) { + if (r->message != NULL) { count++; } } @@ -541,7 +456,7 @@ e_summary_rdf_add (ESummary *summary, for (p = rdf->rdfs; p; p = p->next) { RDF *r = p->data; - if (r->handle != NULL) { + if (r->message != NULL) { ESummaryConnectionData *d; d = make_connection (r); @@ -556,17 +471,12 @@ static void rdf_free (RDF *r) { /* Stop the download */ - if (r->handle) { - gnome_vfs_async_cancel (r->handle); + if (r->message) { + soup_message_cancel (r->message); } g_free (r->uri); g_free (r->html); - g_free (r->buffer); - - if (r->string) { - g_string_free (r->string, TRUE); - } if (r->cache) { xmlFreeDoc (r->cache); @@ -599,9 +509,9 @@ e_summary_rdf_set_online (ESummary *summary, RDF *r; r = p->data; - if (r->handle) { - gnome_vfs_async_cancel (r->handle); - r->handle = NULL; + if (r->message) { + soup_message_cancel (r->message); + r->message = NULL; } } diff --git a/my-evolution/e-summary-tasks.c b/my-evolution/e-summary-tasks.c index a8c32b1db7..6bcc65d2b7 100644 --- a/my-evolution/e-summary-tasks.c +++ b/my-evolution/e-summary-tasks.c @@ -136,8 +136,8 @@ sort_uids (gconstpointer a, CalComponent *comp_a, *comp_b; CalClient *client = user_data; CalClientGetStatus status; - CalComponentDateTime start_a, start_b; - int retval; + int real_a = 0, real_b = 0; + int *pri_a, *pri_b; /* a after b then return > 0 */ @@ -149,20 +149,13 @@ sort_uids (gconstpointer a, if (status != CAL_CLIENT_GET_SUCCESS) return 1; - cal_component_get_dtstart (comp_a, &start_a); - cal_component_get_dtstart (comp_b, &start_b); + pri_a = &real_a; + pri_b = &real_b; - if (start_a.value == NULL || start_b.value == NULL) { - /* Try to do something reasonable if one or more of our .values is NULL */ - retval = (start_a.value ? 1 : 0) - (start_b.value ? 1 : 0); - } else { - retval = icaltime_compare (*start_a.value, *start_b.value); - } - - cal_component_free_datetime (&start_a); - cal_component_free_datetime (&start_b); + cal_component_get_priority (comp_a, &pri_a); + cal_component_get_priority (comp_b, &pri_b); - return retval; + return *pri_a - *pri_b; } static GList * @@ -258,6 +251,7 @@ generate_html (gpointer data) } else { char *s; + uids = cal_list_sort (uids, sort_uids, tasks->client); string = g_string_new ("<dl><dt><img src=\"myevo-post-it.png\" align=\"middle\" " "alt=\"\" width=\"48\" height=\"48\"> <b><a href=\"evolution:/local/Tasks\">"); s = e_utf8_from_locale_string (_("Tasks")); diff --git a/my-evolution/e-summary-weather.c b/my-evolution/e-summary-weather.c index 2787989277..e16d2fc8e4 100644 --- a/my-evolution/e-summary-weather.c +++ b/my-evolution/e-summary-weather.c @@ -34,7 +34,6 @@ #include <gal/widgets/e-unicode.h> -#include <libgnomevfs/gnome-vfs.h> #include "e-summary.h" #include "e-summary-weather.h" #include "weather.h" @@ -251,10 +250,10 @@ parse_metar (const char *metar, } static void -close_callback (GnomeVFSAsyncHandle *handle, - GnomeVFSResult result, - Weather *w) +message_finished (SoupMessage *msg, + gpointer userdata) { + Weather *w = (Weather *) userdata; ESummary *summary; char *html, *metar, *end; char *search_str; @@ -265,27 +264,39 @@ close_callback (GnomeVFSAsyncHandle *handle, connection->callback (summary, connection->callback_closure); } - if (w->handle == NULL) { - g_free (w->buffer); - w->buffer = NULL; - g_string_free (w->string, TRUE); - w->string = NULL; + if (SOUP_MESSAGE_IS_ERROR (msg)) { + GString *string; + ESummaryWeatherLocation *location; + + g_warning ("Message failed: %d\n%s", msg->errorcode, + msg->errorphrase); + w->message = NULL; + + location = g_hash_table_lookup (locations_hash, w->location); + + string = g_string_new ("<br><b>There was an error downloading data for "); + if (location == NULL) { + g_string_append (string, w->location); + } else { + g_string_append (string, location->name); + } + + g_string_append (string, "</b><br>"); + w->html = e_utf8_from_locale_string (string->str); + g_string_free (string, TRUE); + + e_summary_draw (w->summary); return; } - w->handle = NULL; - g_free (w->buffer); - w->buffer = NULL; - html = w->string->str; - g_string_free (w->string, FALSE); - w->string = NULL; + html = g_strdup (msg->response.body); + w->message = NULL; /* Find the metar data */ search_str = g_strdup_printf ("\n%s", w->location); metar = strstr (html, search_str); if (metar == NULL) { g_free (search_str); - g_free (html); return; } @@ -293,77 +304,15 @@ close_callback (GnomeVFSAsyncHandle *handle, end = strchr (metar, '\n'); if (end == NULL) { g_free (search_str); - g_free (html); return; } *end = '\0'; parse_metar (metar, w); - g_free (html); g_free (search_str); return; } -static void -read_callback (GnomeVFSAsyncHandle *handle, - GnomeVFSResult result, - gpointer buffer, - GnomeVFSFileSize bytes_requested, - GnomeVFSFileSize bytes_read, - Weather *w) -{ - if (result != GNOME_VFS_OK && result != GNOME_VFS_ERROR_EOF) { - if (w->summary->weather->errorshown == FALSE) { - w->html = g_strdup ("<dd><b>An error occurred while downloading weather data</b></dd>"); - w->summary->weather->errorshown = TRUE; - } else { - w->html = g_strdup ("<dd> </dd>"); - } - - e_summary_draw (w->summary); - w->handle = NULL; - gnome_vfs_async_close (handle, - (GnomeVFSAsyncCloseCallback) close_callback, w); - return; - } - - if (bytes_read == 0) { - gnome_vfs_async_close (handle, - (GnomeVFSAsyncCloseCallback) close_callback, w); - } else { - *((char *) buffer + bytes_read) = 0; - g_string_append (w->string, (const char *) buffer); - gnome_vfs_async_read (handle, buffer, 4095, - (GnomeVFSAsyncReadCallback) read_callback, w); - } -} - -static void -open_callback (GnomeVFSAsyncHandle *handle, - GnomeVFSResult result, - Weather *w) -{ - if (result != GNOME_VFS_OK) { - if (w->summary->weather->errorshown == FALSE) { - w->html = e_utf8_from_locale_string (_("<dd><b>The weather server could not be contacted</b></dd>")); - - w->summary->weather->errorshown = TRUE; - } else { - w->html = g_strdup ("<dd> </dd>"); - } - - w->handle = NULL; - e_summary_draw (w->summary); - return; - } - - w->string = g_string_new (""); - w->buffer = g_new (char, 4096); - - gnome_vfs_async_read (handle, w->buffer, 4095, - (GnomeVFSAsyncReadCallback) read_callback, w); -} - gboolean e_summary_weather_update (ESummary *summary) { @@ -376,26 +325,28 @@ e_summary_weather_update (ESummary *summary) summary->weather->errorshown = FALSE; for (w = summary->weather->weathers; w; w = w->next) { + SoupContext *context; char *uri; Weather *weather = w->data; - if (weather->handle != NULL) { - gnome_vfs_async_cancel (weather->handle); - weather->handle = NULL; - } - if (weather->string) { - g_string_free (weather->string, TRUE); - weather->string = NULL; - } - if (weather->buffer) { - g_free (weather->buffer); - weather->buffer = NULL; + if (weather->message != NULL) { + soup_message_cancel (weather->message); + weather->message = NULL; } uri = g_strdup_printf ("http://weather.noaa.gov/cgi-bin/mgetmetar.pl?cccc=%s", weather->location); + context = soup_context_get (uri); + if (context == NULL) { + g_warning ("Invalid URL: %s", uri); + soup_context_unref (context); + g_free (uri); + continue; + } + + weather->message = soup_message_new (context, SOUP_METHOD_GET); + soup_context_unref (context); + soup_message_queue (weather->message, message_finished, weather); - gnome_vfs_async_open (&weather->handle, uri, GNOME_VFS_OPEN_READ, - (GnomeVFSAsyncOpenCallback) open_callback, weather); g_free (uri); } @@ -407,14 +358,8 @@ weather_free (Weather *w) { g_return_if_fail (w != NULL); - if (w->handle != NULL) { - gnome_vfs_async_cancel (w->handle); - } - if (w->string) { - g_string_free (w->string, TRUE); - } - if (w->buffer) { - g_free (w->buffer); + if (w->message != NULL) { + soup_message_cancel (w->message); } g_free (w->location); @@ -541,7 +486,7 @@ e_summary_weather_count (ESummary *summary, for (p = weather->weathers; p; p = p->next) { Weather *w = p->data; - if (w->handle != NULL) { + if (w->message != NULL) { count++; } } @@ -572,7 +517,7 @@ e_summary_weather_add (ESummary *summary, for (p = weather->weathers; p; p = p->next) { Weather *w = p->data; - if (w->handle != NULL) { + if (w->message != NULL) { ESummaryConnectionData *d; d = make_connection (w); @@ -607,9 +552,9 @@ e_summary_weather_set_online (ESummary *summary, Weather *w; w = p->data; - if (w->handle) { - gnome_vfs_async_cancel (w->handle); - w->handle = NULL; + if (w->message) { + soup_message_cancel (w->message); + w->message = NULL; } } diff --git a/my-evolution/e-summary.c b/my-evolution/e-summary.c index f03caa338d..2e70e74821 100644 --- a/my-evolution/e-summary.c +++ b/my-evolution/e-summary.c @@ -24,6 +24,12 @@ #include <config.h> #endif +#include <stdio.h> +#include <errno.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <fcntl.h> + #include <glib.h> #include <libgnome/gnome-defs.h> #include <libgnome/gnome-i18n.h> @@ -34,8 +40,6 @@ #include <gtkhtml/htmlengine.h> #include <gtkhtml/htmlselection.h> -#include <libgnomevfs/gnome-vfs.h> - #include <gal/util/e-util.h> #include <gal/widgets/e-gui-utils.h> #include <gal/widgets/e-unicode.h> @@ -77,13 +81,6 @@ struct _ESummaryMailFolderInfo { int unread; }; -typedef struct _DownloadInfo { - GtkHTMLStream *stream; - char *uri; - char *buffer, *ptr; - guint32 bufsize; -} DownloadInfo; - struct _ESummaryPrivate { GNOME_Evolution_Shell shell; GNOME_Evolution_ShellView shell_view_interface; @@ -290,74 +287,6 @@ struct _imgcache { }; static void -close_callback (GnomeVFSAsyncHandle *handle, - GnomeVFSResult result, - gpointer data) -{ - DownloadInfo *info = data; - struct _imgcache *img; - - if (images_cache == NULL) { - images_cache = g_hash_table_new (g_str_hash, g_str_equal); - } - - img = g_new (struct _imgcache, 1); - img->buffer = info->buffer; - img->bufsize = info->bufsize; - - g_hash_table_insert (images_cache, info->uri, img); - 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, - gpointer buffer, - GnomeVFSFileSize bytes_requested, - GnomeVFSFileSize bytes_read, - gpointer data) -{ - DownloadInfo *info = data; - - if (result != GNOME_VFS_OK && result != GNOME_VFS_ERROR_EOF) { - gtk_html_stream_close (info->stream, GTK_HTML_STREAM_ERROR); - gnome_vfs_async_close (handle, close_callback, info); - } else if (bytes_read == 0) { - gtk_html_stream_write (info->stream, info->buffer, info->bufsize); - gtk_html_stream_close (info->stream, GTK_HTML_STREAM_OK); - gnome_vfs_async_close (handle, close_callback, info); - } else { - 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); - } -} - -static void -open_callback (GnomeVFSAsyncHandle *handle, - GnomeVFSResult result, - DownloadInfo *info) -{ - if (result != GNOME_VFS_OK) { - gtk_html_stream_close (info->stream, GTK_HTML_STREAM_ERROR); - g_free (info->uri); - g_free (info); - return; - } - - info->bufsize = 4096; - info->buffer = info->ptr = g_new (char, info->bufsize); - gnome_vfs_async_read (handle, info->buffer, 4095, read_callback, info); -} - -static void e_summary_url_clicked (GtkHTML *html, const char *url, ESummary *summary) @@ -387,6 +316,52 @@ e_summary_url_clicked (GtkHTML *html, protocol_listener->listener (summary, url, protocol_listener->closure); } +static char * +e_read_file_with_length (const char *filename, + size_t *length) +{ + int fd, ret; + struct stat stat_buf; + char *buf; + size_t bytes_read, size; + + g_return_val_if_fail (filename != NULL, NULL); + + fd = open (filename, O_RDONLY); + g_return_val_if_fail (fd != -1, NULL); + + fstat (fd, &stat_buf); + size = stat_buf.st_size; + buf = g_new (char, size + 1); + + bytes_read = 0; + while (bytes_read < size) { + ssize_t rc; + + rc = read (fd, buf + bytes_read, size - bytes_read); + if (rc < 0) { + if (errno != EINTR) { + close (fd); + g_free (buf); + + return NULL; + } + } else if (rc == 0) { + break; + } else { + bytes_read += rc; + } + } + + buf[bytes_read] = '\0'; + + if (length) { + *length = bytes_read; + } + + return buf; +} + static void e_summary_url_requested (GtkHTML *html, const char *url, @@ -394,8 +369,6 @@ e_summary_url_requested (GtkHTML *html, ESummary *summary) { char *filename; - GnomeVFSAsyncHandle *handle; - DownloadInfo *info; struct _imgcache *img = NULL; if (strncasecmp (url, "file:", 5) == 0) { @@ -414,19 +387,28 @@ e_summary_url_requested (GtkHTML *html, if (images_cache != NULL) { img = g_hash_table_lookup (images_cache, filename); + } else { + images_cache = g_hash_table_new (g_str_hash, g_str_equal); } if (img == NULL) { - info = g_new (DownloadInfo, 1); - info->stream = stream; - info->uri = filename; + size_t length; + char *contents; - gnome_vfs_async_open (&handle, filename, GNOME_VFS_OPEN_READ, - (GnomeVFSAsyncOpenCallback) open_callback, info); - } else { - gtk_html_stream_write (stream, img->buffer, img->bufsize); - gtk_html_stream_close (stream, GTK_HTML_STREAM_OK); + contents = e_read_file_with_length (filename, &length); + if (contents == NULL) { + return; + } + + img = g_new (struct _imgcache, 1); + img->buffer = contents; + img->bufsize = length; + + g_hash_table_insert (images_cache, g_strdup (filename), img); } + + gtk_html_stream_write (stream, img->buffer, img->bufsize); + gtk_html_stream_close (stream, GTK_HTML_STREAM_OK); } static void diff --git a/my-evolution/main.c b/my-evolution/main.c index 107b0919b8..04e3c925cd 100644 --- a/my-evolution/main.c +++ b/my-evolution/main.c @@ -43,7 +43,6 @@ #include <gconf/gconf.h> #endif -#include <libgnomevfs/gnome-vfs.h> #include <glade/glade.h> #include "component-factory.h" @@ -72,7 +71,6 @@ main (int argc, #endif glade_gnome_init (); - gnome_vfs_init (); gtk_widget_push_visual (gdk_rgb_get_visual ()); gtk_widget_push_colormap (gdk_rgb_get_cmap ()); diff --git a/my-evolution/weather.h b/my-evolution/weather.h index cd04c9621f..196b9a8017 100644 --- a/my-evolution/weather.h +++ b/my-evolution/weather.h @@ -25,14 +25,13 @@ #include "e-summary-weather.h" -#include <libgnomevfs/gnome-vfs.h> +#include <libsoup/soup.h> typedef struct _Weather { char *location; char *html; - GnomeVFSAsyncHandle *handle; - GString *string; - char *buffer; + + SoupMessage *message; ESummary *summary; |