Re: mime api shortcomings
- From: Paolo Borelli <pborelli katamail com>
- To: Alexander Larsson <alexl redhat com>
- Cc: gnome-vfs-list gnome org
- Subject: Re: mime api shortcomings
- Date: Mon, 16 Jan 2006 10:27:01 +0100
Il giorno mer, 11/01/2006 alle 14.23 +0100, Paolo Borelli ha scritto:
> Il giorno mer, 11/01/2006 alle 14.16 +0100, Alexander Larsson ha
> > We have gnome_vfs_get_mime_type_for_data in gnome-vfs-mime-utils.h,
> > can't we just add:
> > const char *gnome_vfs_get_mime_type_for_name (const char *filename);
> > const char *gnome_vfs_get_mime_type_for_name_and_data (const char *filename,
> > gconstpointer data,
> > int data_size);
> >
>
> sounds good to me. Iago, feel free to get started :)
>
> > The first is just gnome_vfs_mime_type_from_name() (availible to modules)
> > with a better name. We should probably change all uses of that inside
> > vfs to the new name.
>
Since api freeze is today I at least knocked up this little patch that
adds gnome_vfs_get_mime_type_for_name which is what we need most and
which is really easy to add. It just does the bare minimum, without
converting all the callers.
>
> ciao
>
> paolo
>
>
> _______________________________________________
> gnome-vfs-list mailing list
> gnome-vfs-list gnome org
> http://mail.gnome.org/mailman/listinfo/gnome-vfs-list
Index: libgnomevfs/gnome-vfs-mime-utils.h
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-mime-utils.h,v
retrieving revision 1.4
diff -u -p -r1.4 gnome-vfs-mime-utils.h
--- libgnomevfs/gnome-vfs-mime-utils.h 28 Oct 2005 15:10:56 -0000 1.4
+++ libgnomevfs/gnome-vfs-mime-utils.h 16 Jan 2006 09:18:35 -0000
@@ -49,6 +49,7 @@ GnomeVFSMimeEquivalence gnome_vfs_mime_t
gboolean gnome_vfs_mime_type_is_equal (const char *a,
const char *b);
+const char *gnome_vfs_get_mime_type_for_name (const char *filename);
const char *gnome_vfs_get_mime_type_for_data (gconstpointer data,
int data_size);
char *gnome_vfs_get_mime_type (const char *text_uri);
Index: libgnomevfs/gnome-vfs-mime.c
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-mime.c,v
retrieving revision 1.61
diff -u -p -r1.61 gnome-vfs-mime.c
--- libgnomevfs/gnome-vfs-mime.c 14 Nov 2005 11:41:13 -0000 1.61
+++ libgnomevfs/gnome-vfs-mime.c 16 Jan 2006 09:18:36 -0000
@@ -132,18 +132,40 @@ gnome_vfs_mime_type_from_name_or_default
}
/**
+ * gnome_vfs_mime_type_for_name:
+ * @filename: a filename.
+ *
+ * Determine the mime type for @filename. The file @filename may
+ * not exist, this function does not access the actual file.
+ * If the mime-type cannot be determined, %GNOME_VFS_MIME_TYPE_UNKNOWN
+ * is returned.
+ *
+ * Returns: the mime-type for this filename or
+ * %GNOME_VFS_MIME_TYPE_UNKNOWN if mime-type could not be determined.
+ */
+const char *
+gnome_vfs_get_mime_type_for_name (const char *filename)
+{
+ return gnome_vfs_mime_type_from_name_or_default (filename,
+ GNOME_VFS_MIME_TYPE_UNKNOWN);
+}
+
+/**
* gnome_vfs_mime_type_from_name:
* @filename: a filename (the file does not necessarily exist).
*
* Determine the mime type for @filename.
*
+ * Deprecated: This function is deprecated, use
+ * gnome_vfs_get_mime_type_for_name instead.
+ *
* Returns: the mime-type for this filename. Will return
* %GNOME_VFS_MIME_TYPE_UNKNOWN if mime-type could not be found.
*/
const char *
-gnome_vfs_mime_type_from_name (const gchar * filename)
+gnome_vfs_mime_type_from_name (const gchar *filename)
{
- return gnome_vfs_mime_type_from_name_or_default (filename, GNOME_VFS_MIME_TYPE_UNKNOWN);
+ return gnome_vfs_get_mime_type_for_name (filename);
}
static const char *
Index: libgnomevfs/gnome-vfs-mime.h
===================================================================
RCS file: /cvs/gnome/gnome-vfs/libgnomevfs/gnome-vfs-mime.h,v
retrieving revision 1.20
diff -u -p -r1.20 gnome-vfs-mime.h
--- libgnomevfs/gnome-vfs-mime.h 22 Jul 2004 03:54:52 -0000 1.20
+++ libgnomevfs/gnome-vfs-mime.h 16 Jan 2006 09:18:36 -0000
@@ -36,7 +36,10 @@ struct stat;
void gnome_vfs_mime_shutdown (void);
#endif
+#ifndef GNOME_VFS_DISABLE_DEPRECATED
const char *gnome_vfs_mime_type_from_name (const char *filename);
+#endif
+
const char *gnome_vfs_mime_type_from_name_or_default (const char *filename,
const char *defaultv);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]