BonoboStreamFS content_type



Hi,

in the bonobo-stream-fs driver the content_type for every regular file
is hardcoded to "application/octet-stream". Is this intended? 

If not, there is a patch attached which fixes this issue.

Regards,

  Jens 

Index: bonobo-stream-fs.c
===================================================================
RCS file: /cvs/gnome/bonobo/storage-modules/bonobo-stream-fs.c,v
retrieving revision 1.42
diff -u -r1.42 bonobo-stream-fs.c
--- bonobo-stream-fs.c	2000/11/30 21:58:30	1.42
+++ bonobo-stream-fs.c	2001/02/19 17:27:22
@@ -14,6 +14,7 @@
 #include <sys/stat.h>
 #include <libgnome/gnome-defs.h>
 #include <libgnome/gnome-util.h>
+#include <libgnome/gnome-mime.h>
 #include <storage-modules/bonobo-stream-fs.h>
 #include <errno.h>
 
@@ -44,6 +45,7 @@
 	BonoboStreamFS *stream_fs = BONOBO_STREAM_FS (stream);
 	Bonobo_StorageInfo *si;
 	struct stat st;
+	gchar *mime_type;
 
 	if (mask & ~(Bonobo_FIELD_CONTENT_TYPE | Bonobo_FIELD_SIZE |
 		     Bonobo_FIELD_TYPE)) {
@@ -60,7 +62,8 @@
 	si->size = st.st_size;
 	si->type = Bonobo_STORAGE_TYPE_REGULAR;
 	si->name = CORBA_string_dup ("");
-	si->content_type = CORBA_string_dup ("application/octet-stream");
+	mime_type = (gchar*)gnome_mime_type_of_file (stream_fs->path);
+	si->content_type = CORBA_string_dup (mime_type);
 
 	return si;
 
@@ -289,7 +292,11 @@
 	
 	if (close (stream_fs->fd)) 
 		g_warning ("Close failed");
+
+	if (stream_fs->path)
+		g_free (stream_fs->path);
 	
+	stream_fs->path = NULL;
 	stream_fs->fd = -1;
 }
 
@@ -368,7 +375,7 @@
 }
 
 static BonoboStream *
-bonobo_stream_create (int fd)
+bonobo_stream_create (int fd, const char *path)
 {
 	BonoboStreamFS *stream_fs;
 	Bonobo_Stream corba_stream;
@@ -378,6 +385,7 @@
 		return NULL;
 	
 	stream_fs->fd = fd;
+	stream_fs->path = g_strdup (path);
 	
 	corba_stream = bonobo_stream_corba_object_create (
 		BONOBO_OBJECT (stream_fs));
@@ -461,7 +469,7 @@
 		return NULL;
 	}
 
-	if (!(stream = bonobo_stream_create (fd)))
+	if (!(stream = bonobo_stream_create (fd, path)))
 		CORBA_exception_set (ev, CORBA_USER_EXCEPTION, 
 				     ex_Bonobo_Storage_IOError, NULL);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]