aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--composer/ChangeLog8
-rw-r--r--composer/e-msg-composer-attachment-bar.c8
-rw-r--r--composer/e-msg-composer-attachment.c32
3 files changed, 36 insertions, 12 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog
index 66bc828f88..4ba129e4a5 100644
--- a/composer/ChangeLog
+++ b/composer/ChangeLog
@@ -1,3 +1,11 @@
+2000-09-18 Dan Winship <danw@helixcode.com>
+
+ * e-msg-composer-attachment.c (get_mime_type): Use
+ gnome_vfs_get_file_info.
+
+ * e-msg-composer-attachment-bar.c (update): Use gnome_vfs_mime
+ functions, not old gnome_mime.
+
2000-09-18 Christopher James Lahey <clahey@helixcode.com>
* Makefile.am: Added $(EXTRA_GNOME_CFLAGS) and
diff --git a/composer/e-msg-composer-attachment-bar.c b/composer/e-msg-composer-attachment-bar.c
index 50923f7e19..8a6272d833 100644
--- a/composer/e-msg-composer-attachment-bar.c
+++ b/composer/e-msg-composer-attachment-bar.c
@@ -23,6 +23,7 @@
#include <gnome.h>
#include <glade/glade.h>
+#include <libgnomevfs/gnome-vfs-mime-info.h>
#include "e-msg-composer-attachment.h"
#include "e-msg-composer-attachment-bar.h"
@@ -194,13 +195,14 @@ update (EMsgComposerAttachmentBar *bar)
content_type = camel_mime_part_get_content_type (attachment->body);
mime_type = g_strdup_printf ("%s/%s", content_type->type,
content_type->subtype);
- icon_name = gnome_mime_get_value (mime_type, "icon-filename");
+ icon_name = gnome_vfs_mime_get_value (mime_type,
+ "icon-filename");
g_free (mime_type);
/* FIXME we need some better default icon. */
if (icon_name == NULL)
- icon_name = gnome_mime_get_value ("text/plain",
- "icon-filename");
+ icon_name = gnome_vfs_mime_get_value ("text/plain",
+ "icon-filename");
desc = camel_mime_part_get_description (attachment->body);
if (!desc)
diff --git a/composer/e-msg-composer-attachment.c b/composer/e-msg-composer-attachment.c
index 141ad7c9ab..c607b59068 100644
--- a/composer/e-msg-composer-attachment.c
+++ b/composer/e-msg-composer-attachment.c
@@ -32,6 +32,7 @@
#include <gnome.h>
#include <camel/camel.h>
#include <gal/widgets/e-unicode.h>
+#include <libgnomevfs/gnome-vfs.h>
#include "e-msg-composer-attachment.h"
@@ -47,16 +48,23 @@ static GtkObjectClass *parent_class = NULL;
/* Utility functions. */
-static const gchar *
+static gchar *
get_mime_type (const gchar *file_name)
{
- const gchar *mime_type;
-
- mime_type = gnome_mime_type_of_file (file_name);
- if (mime_type == NULL)
- mime_type = "application/octet-stream";
-
- return mime_type;
+ GnomeVFSFileInfo info;
+ GnomeVFSResult result;
+
+ result = gnome_vfs_get_file_info (file_name, &info,
+ GNOME_VFS_FILE_INFO_GET_MIME_TYPE |
+ GNOME_VFS_FILE_INFO_FOLLOW_LINKS);
+ if (result == GNOME_VFS_OK) {
+ gchar *type;
+
+ type = g_strdup (gnome_vfs_file_info_get_mime_type (&info));
+ gnome_vfs_file_info_unref (&info);
+ return type;
+ } else
+ return NULL;
}
static void
@@ -161,6 +169,7 @@ e_msg_composer_attachment_new (const gchar *file_name)
CamelDataWrapper *wrapper;
CamelStream *data;
struct stat statbuf;
+ gchar *mime_type;
g_return_val_if_fail (file_name != NULL, NULL);
@@ -170,7 +179,12 @@ e_msg_composer_attachment_new (const gchar *file_name)
wrapper = camel_data_wrapper_new ();
camel_data_wrapper_construct_from_stream (wrapper, data);
camel_object_unref (CAMEL_OBJECT (data));
- camel_data_wrapper_set_mime_type (wrapper, get_mime_type (file_name));
+ mime_type = get_mime_type (file_name);
+ if (mime_type) {
+ camel_data_wrapper_set_mime_type (wrapper, mime_type);
+ g_free (mime_type);
+ } else
+ camel_data_wrapper_set_mime_type (wrapper, "application/octet-stream");
part = camel_mime_part_new ();
camel_medium_set_content_object (CAMEL_MEDIUM (part), wrapper);