diff options
author | Iain Holmes <iain@src.gnome.org> | 2001-09-26 06:11:29 +0800 |
---|---|---|
committer | Iain Holmes <iain@src.gnome.org> | 2001-09-26 06:11:29 +0800 |
commit | c76e6322cf850d3e7a909ae1353bdde8b2911cac (patch) | |
tree | 90a9ce3cfc903297eae6bb1e053838a2d536da3a /my-evolution | |
parent | 19e03042e024e2e62acd69aa7005f1dfa9011754 (diff) | |
download | gsoc2013-evolution-c76e6322cf850d3e7a909ae1353bdde8b2911cac.tar gsoc2013-evolution-c76e6322cf850d3e7a909ae1353bdde8b2911cac.tar.gz gsoc2013-evolution-c76e6322cf850d3e7a909ae1353bdde8b2911cac.tar.bz2 gsoc2013-evolution-c76e6322cf850d3e7a909ae1353bdde8b2911cac.tar.lz gsoc2013-evolution-c76e6322cf850d3e7a909ae1353bdde8b2911cac.tar.xz gsoc2013-evolution-c76e6322cf850d3e7a909ae1353bdde8b2911cac.tar.zst gsoc2013-evolution-c76e6322cf850d3e7a909ae1353bdde8b2911cac.zip |
Warnings Create an image cache USe task.png
Warnings
Create an image cache
USe task.png
svn path=/trunk/; revision=13128
Diffstat (limited to 'my-evolution')
-rw-r--r-- | my-evolution/ChangeLog | 10 | ||||
-rw-r--r-- | my-evolution/e-summary-calendar.c | 2 | ||||
-rw-r--r-- | my-evolution/e-summary-preferences.c | 8 | ||||
-rw-r--r-- | my-evolution/e-summary-preferences.h | 12 | ||||
-rw-r--r-- | my-evolution/e-summary-tasks.c | 9 | ||||
-rw-r--r-- | my-evolution/e-summary.c | 62 | ||||
-rw-r--r-- | my-evolution/e-summary.h | 71 |
7 files changed, 117 insertions, 57 deletions
diff --git a/my-evolution/ChangeLog b/my-evolution/ChangeLog index dad02ffafe..750002aa72 100644 --- a/my-evolution/ChangeLog +++ b/my-evolution/ChangeLog @@ -1,3 +1,13 @@ +2001-09-25 Iain Holmes <iain@ximian.com> + + * Misc warnings cleanups. + + * e-summary.c (e_summary_url_requested): Check in the cache for the + image before spawning a new thread to download it. + (close_callback): Create a cache first time, add images to it. + + * e-summary-tasks.c (generate_html): Use task.png + 2001-09-21 Dan Winship <danw@ximian.com> * e-summary-weather.c (weather_make_html): Add missing diff --git a/my-evolution/e-summary-calendar.c b/my-evolution/e-summary-calendar.c index acb975ed33..f32e197e8a 100644 --- a/my-evolution/e-summary-calendar.c +++ b/my-evolution/e-summary-calendar.c @@ -360,7 +360,7 @@ e_summary_calendar_protocol (ESummary *summary, CORBA_exception_init (&ev); factory = oaf_activate_from_id ("OAFIID:GNOME_Evolution_Calendar_CompEditorFactory", 0, NULL, &ev); if (BONOBO_EX (&ev)) { - g_message ("%d: Could not activate the component editor factory (%s)", __FUNCTION__, + g_message ("%s: Could not activate the component editor factory (%s)", __FUNCTION__, CORBA_exception_id (&ev)); CORBA_exception_free (&ev); return; diff --git a/my-evolution/e-summary-preferences.c b/my-evolution/e-summary-preferences.c index e1832d20f7..708221fd6c 100644 --- a/my-evolution/e-summary-preferences.c +++ b/my-evolution/e-summary-preferences.c @@ -1407,9 +1407,11 @@ property_box_destroy_cb (GtkObject *object, } void -e_summary_configure (GtkWidget *widget, - ESummary *summary) +e_summary_configure (BonoboUIComponent *component, + gpointer userdata, + const char *cname) { + ESummary *summary = userdata; PropertyData *pd; if (summary->prefs_window != NULL) { @@ -1433,7 +1435,7 @@ e_summary_configure (GtkWidget *widget, g_return_if_fail (pd->xml != NULL); pd->box = GNOME_PROPERTY_BOX (glade_xml_get_widget (pd->xml, "dialog1")); - summary->prefs_window = pd->box; + summary->prefs_window = GTK_WIDGET (pd->box); gtk_window_set_title (GTK_WINDOW (pd->box), _("Summary Settings")); if (make_property_dialog (pd) == FALSE) { diff --git a/my-evolution/e-summary-preferences.h b/my-evolution/e-summary-preferences.h index b271e0c55c..0ce3715931 100644 --- a/my-evolution/e-summary-preferences.h +++ b/my-evolution/e-summary-preferences.h @@ -6,10 +6,18 @@ * Authors: Iain Holmes <iain@ximian.com> */ +#ifndef __E_SUMMARY_PREFERENCES_H__ +#define __E_SUMMARY_PREFERENCES_H__ + +#include <bonobo/bonobo-ui-component.h> + gboolean e_summary_preferences_restore (ESummaryPrefs *prefs); void e_summary_preferences_save (ESummaryPrefs *prefs); void e_summary_preferences_free (ESummaryPrefs *prefs); ESummaryPrefs *e_summary_preferences_copy (ESummaryPrefs *prefs); -void e_summary_configure (GtkWidget *widget, - ESummary *summary); +void e_summary_configure (BonoboUIComponent *component, + gpointer userdata, + const char *cname); void e_summary_preferences_init (ESummary *summary); + +#endif diff --git a/my-evolution/e-summary-tasks.c b/my-evolution/e-summary-tasks.c index 18e92b86fe..1fe44371eb 100644 --- a/my-evolution/e-summary-tasks.c +++ b/my-evolution/e-summary-tasks.c @@ -19,6 +19,7 @@ #include <cal-util/timeutil.h> #include <bonobo/bonobo-exception.h> +#include <bonobo/bonobo-object.h> #include <liboaf/liboaf.h> struct _ESummaryTasks { @@ -249,7 +250,7 @@ generate_html (gpointer data) cal_component_get_completed (comp, &completed); if (completed == NULL) { - tmp = g_strdup_printf ("<img align=\"middle\" src=\"task.xpm\" " + tmp = g_strdup_printf ("<img align=\"middle\" src=\"task.png\" " "alt=\"\" width=\"16\" height=\"16\">   " "<font size=\"-1\"><a href=\"tasks:/%s\">%s</a></font><br>", uid, text.value ? text.value : _("(No Description)")); @@ -261,11 +262,11 @@ generate_html (gpointer data) text.value); #endif cal_component_free_icaltimetype (completed); - gtk_object_unref (comp); + gtk_object_unref (GTK_OBJECT (comp)); continue; } - gtk_object_unref (comp); + gtk_object_unref (GTK_OBJECT (comp)); g_string_append (string, tmp); g_free (tmp); } @@ -321,7 +322,7 @@ e_summary_tasks_protocol (ESummary *summary, CORBA_exception_init (&ev); factory = oaf_activate_from_id ("OAFIID:GNOME_Evolution_Calendar_CompEditorFactory", 0, NULL, &ev); if (BONOBO_EX (&ev)) { - g_message ("%d: Could not activate the component editor factory (%s)", __FUNCTION__, + g_message ("%s: Could not activate the component editor factory (%s)", __FUNCTION__, CORBA_exception_id (&ev)); CORBA_exception_free (&ev); return; diff --git a/my-evolution/e-summary.c b/my-evolution/e-summary.c index 5c2f8feabd..0ea9e7cde1 100644 --- a/my-evolution/e-summary.c +++ b/my-evolution/e-summary.c @@ -29,6 +29,7 @@ #include <bonobo/bonobo-listener.h> #include <bonobo/bonobo-exception.h> #include <bonobo/bonobo-moniker-util.h> +#include <bonobo/bonobo-ui-component.h> #include <bonobo-conf/bonobo-config-database.h> #include <libgnome/gnome-paper.h> @@ -88,6 +89,7 @@ typedef struct _ProtocolListener { void *closure; } ProtocolListener; +static GHashTable *images_cache = NULL; static void free_protocol (gpointer key, gpointer value, gpointer user_data) @@ -245,18 +247,36 @@ e_pixmap_file (const char *filename) g_free (edir); /* Fall back to the gnome_pixmap_file */ - return gnome_pixmap_file (filename); + ret = gnome_pixmap_file (filename); + if (ret == NULL) { + g_warning ("Could not find pixmap for %s", filename); + } + + return ret; } +struct _imgcache { + char *buffer; + int bufsize; +}; + 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_free (info->uri); - g_free (info->buffer); + g_hash_table_insert (images_cache, info->uri, img); g_free (info); } @@ -279,7 +299,7 @@ read_callback (GnomeVFSAsyncHandle *handle, 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->ptr - info->buffer); + 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 { @@ -347,6 +367,7 @@ e_summary_url_requested (GtkHTML *html, char *filename; GnomeVFSAsyncHandle *handle; DownloadInfo *info; + struct _imgcache *img = NULL; if (strncasecmp (url, "file:", 5) == 0) { url += 5; @@ -362,12 +383,21 @@ e_summary_url_requested (GtkHTML *html, return; } - info = g_new (DownloadInfo, 1); - info->stream = stream; - info->uri = filename; + if (images_cache != NULL) { + img = g_hash_table_lookup (images_cache, filename); + } + + if (img == NULL) { + info = g_new (DownloadInfo, 1); + info->stream = stream; + info->uri = filename; - gnome_vfs_async_open (&handle, filename, GNOME_VFS_OPEN_READ, - (GnomeVFSAsyncOpenCallback) open_callback, info); + 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); + } } static void @@ -563,9 +593,12 @@ do_summary_print (ESummary *summary, } void -e_summary_print (GtkWidget *widget, - ESummary *summary) +e_summary_print (BonoboUIComponent *component, + gpointer userdata, + const char *cname) { + ESummary *summary = userdata; + do_summary_print (summary, FALSE); } @@ -686,9 +719,12 @@ e_summary_reconfigure (ESummary *summary) } void -e_summary_reload (GtkWidget *widget, - ESummary *summary) +e_summary_reload (BonoboUIComponent *component, + gpointer userdata, + const char *cname) { + ESummary *summary = userdata; + e_summary_reconfigure (summary); } diff --git a/my-evolution/e-summary.h b/my-evolution/e-summary.h index 70ddbc3dd9..6bb012f75e 100644 --- a/my-evolution/e-summary.h +++ b/my-evolution/e-summary.h @@ -10,6 +10,7 @@ #define _E_SUMMARY_H__ #include <gtk/gtkvbox.h> +#include <bonobo/bonobo-ui-component.h> #include "e-summary-type.h" #include "e-summary-mail.h" #include "e-summary-calendar.h" @@ -111,39 +112,41 @@ struct _ESummaryClass { }; -GtkType e_summary_get_type (void); -GtkWidget *e_summary_new (const GNOME_Evolution_Shell shell); - -void e_summary_print (GtkWidget *widget, - ESummary *summary); -void e_summary_reload (GtkWidget *widget, - ESummary *summary); -void e_summary_draw (ESummary *summary); -void e_summary_change_current_view (ESummary *summary, - const char *uri); - -void e_summary_set_message (ESummary *summary, - const char *message, - gboolean busy); -void e_summary_unset_message (ESummary *summary); - -void e_summary_add_protocol_listener (ESummary *summary, - const char *protocol, - ESummaryProtocolListener listener, - void *closure); - -void e_summary_reconfigure (ESummary *summary); - -int e_summary_count_connections (ESummary *summary); -GList *e_summary_add_connections (ESummary *summary); -void e_summary_set_online (ESummary *summary, - GNOME_Evolution_OfflineProgressListener listener, - gboolean online, - ESummaryOnlineCallback callback, - void *closure); -void e_summary_add_online_connection (ESummary *summary, - ESummaryConnection *connection); -void e_summary_remove_online_connection (ESummary *summary, - ESummaryConnection *connection); +GtkType e_summary_get_type (void); +GtkWidget *e_summary_new (const GNOME_Evolution_Shell shell); + +void e_summary_print (BonoboUIComponent *component, + gpointer user_data, + const char *cname); +void e_summary_reload (BonoboUIComponent *component, + gpointer user_data, + const char *cname); +void e_summary_draw (ESummary *summary); +void e_summary_change_current_view (ESummary *summary, + const char *uri); + +void e_summary_set_message (ESummary *summary, + const char *message, + gboolean busy); +void e_summary_unset_message (ESummary *summary); + +void e_summary_add_protocol_listener (ESummary *summary, + const char *protocol, + ESummaryProtocolListener listener, + void *closure); + +void e_summary_reconfigure (ESummary *summary); + +int e_summary_count_connections (ESummary *summary); +GList *e_summary_add_connections (ESummary *summary); +void e_summary_set_online (ESummary *summary, + GNOME_Evolution_OfflineProgressListener listener, + gboolean online, + ESummaryOnlineCallback callback, + void *closure); +void e_summary_add_online_connection (ESummary *summary, + ESummaryConnection *connection); +void e_summary_remove_online_connection (ESummary *summary, + ESummaryConnection *connection); #endif |