aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog12
-rw-r--r--mail/Makefile.am4
-rw-r--r--mail/mail-display.c6
-rw-r--r--mail/mail-format.c11
-rw-r--r--mail/mail-identify.c27
5 files changed, 48 insertions, 12 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 37c2b689de..afad2df65b 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,15 @@
+2000-07-05 Dan Winship <danw@helixcode.com>
+
+ * mail-identify.c (mail_identify_mime_part): Use the gnomevfs
+ sniff buffer interface to try to identify the MIME type when
+ everything else fails.
+
+ * mail-display.c (on_object_requested):
+ * mail-format.c (lookup_handler, handle_undisplayable,
+ handle_audio): s/gnome_mime/gnome_vfs_mime/
+
+ * Makefile.am: Add gnomevfs stuff
+
2000-07-03 Ettore Perazzoli <ettore@helixcode.com>
* component-factory.c (create_folder): Get rid of a compiler
diff --git a/mail/Makefile.am b/mail/Makefile.am
index 6c5b4f1623..dce2a11a03 100644
--- a/mail/Makefile.am
+++ b/mail/Makefile.am
@@ -12,6 +12,7 @@ INCLUDES = \
-I$(top_builddir)/shell \
-I$(top_srcdir)/shell \
$(BONOBO_HTML_GNOME_CFLAGS) \
+ $(GNOME_VFS_CFLAGS) \
-DEVOLUTION_VERSION=\""$(VERSION)"\" \
-DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
-DEVOLUTION_ICONSDIR=\""$(iconsdir)"\" \
@@ -66,7 +67,8 @@ evolution_mail_LDADD = \
$(top_builddir)/e-util/libeutil.la \
$(top_builddir)/libibex/libibex.la \
$(top_builddir)/filter/libfilter.la \
- $(BONOBO_HTML_GNOME_LIBS) \
+ $(BONOBO_VFS_GNOME_LIBS) \
+ $(GTKHTML_LIBS) \
$(THREADS_LIBS) \
$(UNICODE_LIBS)
diff --git a/mail/mail-display.c b/mail/mail-display.c
index cdd701ea4b..06a319372a 100644
--- a/mail/mail-display.c
+++ b/mail/mail-display.c
@@ -22,6 +22,7 @@
#include <bonobo.h>
#include <libgnorba/gnorba.h>
#include <bonobo/bonobo-stream-memory.h>
+#include <libgnomevfs/gnome-vfs-mime-info.h>
#define PARENT_TYPE (gtk_vbox_get_type ())
@@ -207,12 +208,13 @@ on_object_requested (GtkHTML *html, GtkHTMLEmbedded *eb, gpointer data)
g_return_val_if_fail (CAMEL_IS_MEDIUM (medium), FALSE);
wrapper = camel_medium_get_content_object (medium);
- goad_id = gnome_mime_get_value (eb->type, "bonobo-goad-id");
+ goad_id = gnome_vfs_mime_get_value (eb->type, "bonobo-goad-id");
if (!goad_id) {
char *main_type =
g_strndup (eb->type, strcspn (eb->type, "/"));
- goad_id = gnome_mime_get_value (main_type, "bonobo-goad-id");
+ goad_id = gnome_vfs_mime_get_value (main_type,
+ "bonobo-goad-id");
g_free (main_type);
}
if (!goad_id)
diff --git a/mail/mail-format.c b/mail/mail-format.c
index e2fef22180..909eced8ca 100644
--- a/mail/mail-format.c
+++ b/mail/mail-format.c
@@ -29,6 +29,7 @@
#include "e-util/e-html-utils.h"
#include "e-util/e-setup.h" /*for evolution_dir*/
#include <libgnome/libgnome.h>
+#include <libgnomevfs/gnome-vfs-mime-info.h>
#include <ctype.h> /* for isprint */
#include <string.h> /* for strstr */
@@ -268,9 +269,9 @@ lookup_handler (const char *mime_type, gboolean *generic)
return handler_function;
}
- whole_goad_id = gnome_mime_get_value (mime_type, "bonobo-goad-id");
- generic_goad_id = gnome_mime_get_value (mime_type_main,
- "bonobo-goad-id");
+ whole_goad_id = gnome_vfs_mime_get_value (mime_type, "bonobo-goad-id");
+ generic_goad_id = gnome_vfs_mime_get_value (mime_type_main,
+ "bonobo-goad-id");
if (whole_goad_id && (!generic_goad_id ||
strcmp (whole_goad_id, generic_goad_id) != 0)) {
@@ -1002,7 +1003,7 @@ handle_audio (CamelMimePart *part, const char *mime_type,
char *id;
const char *desc;
- desc = gnome_mime_get_value (mime_type, "description");
+ desc = gnome_vfs_mime_get_value (mime_type, "description");
if (desc)
id = g_strdup_printf ("%s data", desc);
else {
@@ -1149,7 +1150,7 @@ handle_undisplayable (CamelMimePart *part, const char *mime_type,
const char *desc;
char *id;
- desc = gnome_mime_get_value (mime_type, "description");
+ desc = gnome_vfs_mime_get_value (mime_type, "description");
if (desc)
id = g_strdup (desc);
else
diff --git a/mail/mail-identify.c b/mail/mail-identify.c
index 8b8e61487d..8c1e08104a 100644
--- a/mail/mail-identify.c
+++ b/mail/mail-identify.c
@@ -28,7 +28,8 @@
#include <string.h>
#include <glib.h>
-#include <libgnome/libgnome.h>
+#include <libgnomevfs/gnome-vfs-mime.h>
+#include <libgnomevfs/gnome-vfs-mime-sniff-buffer.h>
#include "mail.h"
/**
@@ -43,6 +44,10 @@ mail_identify_mime_part (CamelMimePart *part)
{
GMimeContentField *content_type;
const char *filename, *type;
+ GnomeVFSMimeSniffBuffer *sniffer;
+ CamelStream *memstream;
+ CamelDataWrapper *data;
+ GByteArray *ba;
content_type = camel_mime_part_get_content_type (part);
@@ -52,21 +57,35 @@ mail_identify_mime_part (CamelMimePart *part)
*/
filename = gmime_content_field_get_parameter (content_type, "name");
if (filename) {
- type = gnome_mime_type_or_default (filename, NULL);
+ type = gnome_vfs_mime_type_or_default (filename, NULL);
if (type)
return g_strdup (type);
}
filename = camel_mime_part_get_filename (part);
if (filename) {
- type = gnome_mime_type_or_default (filename, NULL);
+ type = gnome_vfs_mime_type_or_default (filename, NULL);
if (type)
return g_strdup (type);
}
/* Try file magic. */
- /* FIXME */
+ data = camel_medium_get_content_object (CAMEL_MEDIUM (part));
+ ba = g_byte_array_new ();
+ memstream = camel_stream_mem_new_with_byte_array (ba);
+ camel_data_wrapper_write_to_stream (data, memstream);
+ if (ba->len) {
+ sniffer = gnome_vfs_mime_sniff_buffer_new_from_memory (
+ ba->data, ba->len);
+ type = gnome_vfs_get_mime_type_for_buffer (sniffer);
+ gnome_vfs_mime_sniff_buffer_free (sniffer);
+ } else
+ type = NULL;
+ gtk_object_unref (GTK_OBJECT (memstream));
+
+ if (type)
+ return g_strdup (type);
/* Another possibility to try is the x-mac-type / x-mac-creator