ftp://ftp.redhat.com/pub/redhat/linux/rawhide/SRPMS/SRPMS/gnome-vfs2-2.3.8-1.src.rpm
[gnome-vfs-httpcaptive.git] / doc / html / gnome-vfs-20-gnome-vfs-mime.html
1 <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>MIME typing</title><meta name="generator" content="DocBook XSL Stylesheets V1.61.0"><meta name="generator" content="GTK-Doc V1.1 (XML mode)"><style type="text/css">
2         .synopsis, .classsynopsis {
3             background: #eeeeee;
4             border: solid 1px #aaaaaa;
5             padding: 0.5em;
6         }
7         .programlisting {
8             background: #eeeeff;
9             border: solid 1px #aaaaff;
10             padding: 0.5em;
11         }
12         .variablelist {
13             padding: 4px;
14             margin-left: 3em;
15         }
16         .navigation {
17             background: #ffeeee;
18             border: solid 1px #ffaaaa;
19             margin-top: 0.5em;
20             margin-bottom: 0.5em;
21         }
22         .navigation a {
23             color: #770000;
24         }
25         .navigation a:visited {
26             color: #550000;
27         }
28         .navigation .title {
29             font-size: 200%;
30         }
31       </style><link rel="home" href="index.html" title="GnomeVFS - Filesystem Abstraction library"><link rel="up" href="modules.html" title="Filesystem Modules"><link rel="previous" href="gnome-vfs-writing-modules.html" title="Writing Modules"><link rel="next" href="gnome-vfs-20-gnome-vfs-method.html" title="gnome-vfs-method"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle"><td><a accesskey="p" href="gnome-vfs-writing-modules.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td><td><a accesskey="u" href="modules.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td><td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td><th width="100%" align="center">GnomeVFS - Filesystem Abstraction library</th><td><a accesskey="n" href="gnome-vfs-20-gnome-vfs-method.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td></tr></table><div class="refentry" lang="en"><a name="gnome-vfs-20-gnome-vfs-mime"></a><div class="titlepage"><div></div><div></div></div><div class="refnamediv"><h2><span class="refentrytitle">MIME typing</span></h2><p>MIME typing &#8212; functions to get a mime-type for a file using its name or its content</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><pre class="synopsis">
32
33
34
35 void        <a href="gnome-vfs-20-gnome-vfs-mime.html#gnome-vfs-mime-shutdown">gnome_vfs_mime_shutdown</a>         (void);
36 const char* <a href="gnome-vfs-20-gnome-vfs-mime.html#gnome-vfs-mime-type-from-name">gnome_vfs_mime_type_from_name</a>   (const char *filename);
37 const char* <a href="gnome-vfs-20-gnome-vfs-mime.html#gnome-vfs-mime-type-from-name-or-default">gnome_vfs_mime_type_from_name_or_default</a>
38                                             (const char *filename,
39                                              const char *defaultv);
40 const char* <a href="gnome-vfs-20-gnome-vfs-mime.html#gnome-vfs-get-mime-type-common">gnome_vfs_get_mime_type_common</a>  (GnomeVFSURI *uri);
41 const char* <a href="gnome-vfs-20-gnome-vfs-mime.html#gnome-vfs-get-mime-type-from-uri">gnome_vfs_get_mime_type_from_uri</a>
42                                             (GnomeVFSURI *uri);
43 const char* <a href="gnome-vfs-20-gnome-vfs-mime.html#gnome-vfs-get-mime-type-from-file-data">gnome_vfs_get_mime_type_from_file_data</a>
44                                             (GnomeVFSURI *uri);
45 const char* <a href="gnome-vfs-20-gnome-vfs-mime.html#gnome-vfs-get-file-mime-type">gnome_vfs_get_file_mime_type</a>    (const char *path,
46                                              const struct stat *optional_stat_info,
47                                              <a
48 href="../glib/glib-Basic-Types.html#gboolean"
49 >gboolean</a> suffix_only);
50 <a
51 href="../glib/glib-Basic-Types.html#gboolean"
52 >gboolean</a>    <a href="gnome-vfs-20-gnome-vfs-mime.html#gnome-vfs-mime-type-is-supertype">gnome_vfs_mime_type_is_supertype</a>
53                                             (const char *mime_type);
54 char*       <a href="gnome-vfs-20-gnome-vfs-mime.html#gnome-vfs-get-supertype-from-mime-type">gnome_vfs_get_supertype_from_mime_type</a>
55                                             (const char *mime_type);
56 </pre></div><div class="refsect1" lang="en"><h2>Description</h2><p>
57
58 </p></div><div class="refsect1" lang="en"><h2>Details</h2><div class="refsect2" lang="en"><h3><a name="gnome-vfs-mime-shutdown"></a>gnome_vfs_mime_shutdown ()</h3><a class="indexterm" name="id2973661"></a><pre class="programlisting">void        gnome_vfs_mime_shutdown         (void);</pre><p>
59 Unload the MIME database from memory.</p><p>
60
61 </p></div><hr><div class="refsect2" lang="en"><h3><a name="gnome-vfs-mime-type-from-name"></a>gnome_vfs_mime_type_from_name ()</h3><a class="indexterm" name="id2973707"></a><pre class="programlisting">const char* gnome_vfs_mime_type_from_name   (const char *filename);</pre><p>
62 Determined the mime type for <i class="parameter"><tt>filename</tt></i>.</p><p>
63
64 </p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>filename</tt></i> :</span></td><td> A filename (the file does not necessarily exist).
65 </td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the mime-type for this filename.
66 </td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><h3><a name="gnome-vfs-mime-type-from-name-or-default"></a>gnome_vfs_mime_type_from_name_or_default ()</h3><a class="indexterm" name="id2973805"></a><pre class="programlisting">const char* gnome_vfs_mime_type_from_name_or_default
67                                             (const char *filename,
68                                              const char *defaultv);</pre><p>
69 This routine tries to determine the mime-type of the filename
70 only by looking at the filename from the GNOME database of mime-types.</p><p>
71
72 </p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>filename</tt></i> :</span></td><td> A filename (the file does not necesarily exist).
73 </td></tr><tr><td><span class="term"><i class="parameter"><tt>defaultv</tt></i> :</span></td><td> A default value to be returned if no match is found
74 </td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the mime-type of the <i class="parameter"><tt>filename</tt></i>.  If no value could be
75 determined, it will return <i class="parameter"><tt>defaultv</tt></i>.
76 </td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><h3><a name="gnome-vfs-get-mime-type-common"></a>gnome_vfs_get_mime_type_common ()</h3><a class="indexterm" name="id2973938"></a><pre class="programlisting">const char* gnome_vfs_get_mime_type_common  (GnomeVFSURI *uri);</pre><p>
77 Tries to guess the mime type of the file represented by <i class="parameter"><tt>uir</tt></i>.
78 Favors using the file data to the <i class="parameter"><tt>uri</tt></i> extension.
79 Handles passing <i class="parameter"><tt>uri</tt></i> of a non-existent file by falling back
80 on returning a type based on the extension.
81 </p><p>
82 FIXME: This function will not necessarily return the same mime type as doing a
83 get file info on the text uri.</p><p>
84
85 </p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>uri</tt></i> :</span></td><td> a real file or a non-existent uri.
86 </td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> the mime-type for this uri.
87
88 </td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><h3><a name="gnome-vfs-get-mime-type-from-uri"></a>gnome_vfs_get_mime_type_from_uri ()</h3><a class="indexterm" name="id2974058"></a><pre class="programlisting">const char* gnome_vfs_get_mime_type_from_uri
89                                             (GnomeVFSURI *uri);</pre><p>
90 Tries to guess the mime type of the file <i class="parameter"><tt>uri</tt></i> by
91 checking the file name extension. Works on non-existent
92 files.</p><p>
93
94 </p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>uri</tt></i> :</span></td><td> A file uri.
95 </td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the mime-type for this filename.
96 </td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><h3><a name="gnome-vfs-get-mime-type-from-file-data"></a>gnome_vfs_get_mime_type_from_file_data ()</h3><a class="indexterm" name="id2974156"></a><pre class="programlisting">const char* gnome_vfs_get_mime_type_from_file_data
97                                             (GnomeVFSURI *uri);</pre><p>
98 Tries to guess the mime type of the file <i class="parameter"><tt>uri</tt></i> by
99 checking the file data using the magic patterns. Does not handle text files properly</p><p>
100
101 </p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>uri</tt></i> :</span></td><td> A file uri.
102 </td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>the mime-type for this filename.
103 </td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><h3><a name="gnome-vfs-get-file-mime-type"></a>gnome_vfs_get_file_mime_type ()</h3><a class="indexterm" name="id2974255"></a><pre class="programlisting">const char* gnome_vfs_get_file_mime_type    (const char *path,
104                                              const struct stat *optional_stat_info,
105                                              <a
106 href="../glib/glib-Basic-Types.html#gboolean"
107 >gboolean</a> suffix_only);</pre><p>
108 Tries to guess the mime type of the file represented by <i class="parameter"><tt>path</tt></i>.
109 If <i class="parameter"><tt>suffix_only</tt></i> is false, uses the mime-magic based lookup first.
110 Handles passing <i class="parameter"><tt>path</tt></i> of a non-existent file by falling back
111 on returning a type based on the extension.</p><p>
112
113 </p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>path</tt></i> :</span></td><td> a path of a file.
114 </td></tr><tr><td><span class="term"><i class="parameter"><tt>optional_stat_info</tt></i> :</span></td><td> optional stat buffer.
115 </td></tr><tr><td><span class="term"><i class="parameter"><tt>suffix_only</tt></i> :</span></td><td> whether or not to do a magic-based lookup.
116 </td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td> the mime-type for this path
117 </td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><h3><a name="gnome-vfs-mime-type-is-supertype"></a>gnome_vfs_mime_type_is_supertype ()</h3><a class="indexterm" name="id2974420"></a><pre class="programlisting"><a
118 href="../glib/glib-Basic-Types.html#gboolean"
119 >gboolean</a>    gnome_vfs_mime_type_is_supertype
120                                             (const char *mime_type);</pre><p>
121
122 </p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>mime_type</tt></i> :</span></td><td>
123 </td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>
124
125
126 </td></tr></tbody></table></div></div><hr><div class="refsect2" lang="en"><h3><a name="gnome-vfs-get-supertype-from-mime-type"></a>gnome_vfs_get_supertype_from_mime_type ()</h3><a class="indexterm" name="id2974505"></a><pre class="programlisting">char*       gnome_vfs_get_supertype_from_mime_type
127                                             (const char *mime_type);</pre><p>
128
129 </p><div class="variablelist"><table border="0"><col align="left" valign="top"><tbody><tr><td><span class="term"><i class="parameter"><tt>mime_type</tt></i> :</span></td><td>
130 </td></tr><tr><td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td><td>
131
132
133 </td></tr></tbody></table></div></div></div></div><table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle"><td align="left"><a accesskey="p" href="gnome-vfs-writing-modules.html"><b>&lt;&lt; Writing Modules</b></a></td><td align="right"><a accesskey="n" href="gnome-vfs-20-gnome-vfs-method.html"><b>gnome-vfs-method &gt;&gt;</b></a></td></tr></table></body></html>