3
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4
<title>ThunarxFileInfo</title>
5
<meta name="generator" content="DocBook XSL Stylesheets V1.68.1">
6
<link rel="start" href="index.html" title="Thunar Extensions Reference Manual">
7
<link rel="up" href="thunarx-abstraction-layer.html" title="Part IV. Abstraction Layer">
8
<link rel="prev" href="thunarx-abstraction-layer.html" title="Part IV. Abstraction Layer">
9
<link rel="next" href="ThunarxPropertyPage.html" title="ThunarxPropertyPage">
10
<meta name="generator" content="GTK-Doc V1.4 (XML mode)">
11
<link rel="stylesheet" href="style.css" type="text/css">
12
<link rel="part" href="thunarx-overview.html" title="Part I. Overview">
13
<link rel="part" href="thunarx-writing-extensions.html" title="Part II. Writing Extensions">
14
<link rel="part" href="thunarx-fundamentals.html" title="Part III. Fundamentals">
15
<link rel="part" href="thunarx-abstraction-layer.html" title="Part IV. Abstraction Layer">
16
<link rel="part" href="thunarx-providers.html" title="Part V. Providers">
17
<link rel="index" href="ix01.html" title="Index">
19
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
20
<table class="navigation" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
21
<td><a accesskey="p" href="thunarx-abstraction-layer.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
22
<td><a accesskey="u" href="thunarx-abstraction-layer.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
23
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
24
<th width="100%" align="center">Thunar Extensions Reference Manual</th>
25
<td><a accesskey="n" href="ThunarxPropertyPage.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
27
<div class="refentry" lang="en">
28
<a name="ThunarxFileInfo"></a><div class="titlepage"></div>
29
<div class="refnamediv"><table width="100%"><tr>
31
<h2><span class="refentrytitle">ThunarxFileInfo</span></h2>
32
<p>ThunarxFileInfo — Abstraction of a file handled within the file manager</p>
34
<td valign="top" align="right"></td>
36
<div class="refsect1" lang="en">
37
<a name="id2592587"></a><h2>Stability Level</h2>
38
Stable, unless otherwise indicated
40
<div class="refsynopsisdiv">
42
<pre class="synopsis">
44
#include <thunarx/thunarx.h>
47
<a href="ThunarxFileInfo.html#ThunarxFileInfoIface">ThunarxFileInfoIface</a>;
48
<a href="ThunarxFileInfo.html#ThunarxFileInfo-struct">ThunarxFileInfo</a>;
49
gchar* <a href="ThunarxFileInfo.html#thunarx-file-info-get-name">thunarx_file_info_get_name</a> (<a href="ThunarxFileInfo.html" title="ThunarxFileInfo">ThunarxFileInfo</a> *file_info);
50
gchar* <a href="ThunarxFileInfo.html#thunarx-file-info-get-uri">thunarx_file_info_get_uri</a> (<a href="ThunarxFileInfo.html" title="ThunarxFileInfo">ThunarxFileInfo</a> *file_info);
51
gchar* <a href="ThunarxFileInfo.html#thunarx-file-info-get-parent-uri">thunarx_file_info_get_parent_uri</a>
52
(<a href="ThunarxFileInfo.html" title="ThunarxFileInfo">ThunarxFileInfo</a> *file_info);
53
gchar* <a href="ThunarxFileInfo.html#thunarx-file-info-get-uri-scheme">thunarx_file_info_get_uri_scheme</a>
54
(<a href="ThunarxFileInfo.html" title="ThunarxFileInfo">ThunarxFileInfo</a> *file_info);
55
gchar* <a href="ThunarxFileInfo.html#thunarx-file-info-get-mime-type">thunarx_file_info_get_mime_type</a> (<a href="ThunarxFileInfo.html" title="ThunarxFileInfo">ThunarxFileInfo</a> *file_info);
56
gboolean <a href="ThunarxFileInfo.html#thunarx-file-info-has-mime-type">thunarx_file_info_has_mime_type</a> (<a href="ThunarxFileInfo.html" title="ThunarxFileInfo">ThunarxFileInfo</a> *file_info,
57
const gchar *mime_type);
58
gboolean <a href="ThunarxFileInfo.html#thunarx-file-info-is-directory">thunarx_file_info_is_directory</a> (<a href="ThunarxFileInfo.html" title="ThunarxFileInfo">ThunarxFileInfo</a> *file_info);
59
GList* <a href="ThunarxFileInfo.html#thunarx-file-info-list-copy">thunarx_file_info_list_copy</a> (GList *file_infos);
60
void <a href="ThunarxFileInfo.html#thunarx-file-info-list-free">thunarx_file_info_list_free</a> (GList *file_infos);
65
<div class="refsect1" lang="en">
66
<a name="id2592842"></a><h2>Object Hierarchy</h2>
67
<pre class="synopsis">
73
<div class="refsect1" lang="en">
74
<a name="id2592859"></a><h2>Prerequisites</h2>
76
ThunarxFileInfo requires
79
<div class="refsect1" lang="en">
80
<a name="id2592874"></a><h2>Description</h2>
82
The <span class="interface">ThunarxFileInfo</span> interface provides extensions with
83
a way to access information about a file handled within the file manager.
86
<div class="refsect1" lang="en">
87
<a name="id2592889"></a><h2>Details</h2>
88
<div class="refsect2" lang="en">
89
<a name="id2592894"></a><h3>
90
<a name="ThunarxFileInfoIface"></a>ThunarxFileInfoIface</h3>
91
<a class="indexterm" name="id2592903"></a><pre class="programlisting">typedef struct {
92
gchar *(*get_name) (ThunarxFileInfo *file_info);
94
gchar *(*get_uri) (ThunarxFileInfo *file_info);
95
gchar *(*get_parent_uri) (ThunarxFileInfo *file_info);
96
gchar *(*get_uri_scheme) (ThunarxFileInfo *file_info);
98
gchar *(*get_mime_type) (ThunarxFileInfo *file_info);
99
gboolean (*has_mime_type) (ThunarxFileInfo *file_info,
100
const gchar *mime_type);
102
gboolean (*is_directory) (ThunarxFileInfo *file_info);
103
} ThunarxFileInfoIface;
106
Interface with virtual methods implemented by the file manager and accessible
109
<div class="variablelist"><table border="0">
110
<col align="left" valign="top">
114
<span class="term"><em class="structfield"><code>get_name</code></em> ()</span></td>
115
<td>See <a href="ThunarxFileInfo.html#thunarx-file-info-get-name"><code class="function">thunarx_file_info_get_name()</code></a>.
120
<span class="term"><em class="structfield"><code>get_uri</code></em> ()</span></td>
121
<td>See <a href="ThunarxFileInfo.html#thunarx-file-info-get-uri"><code class="function">thunarx_file_info_get_uri()</code></a>.
126
<span class="term"><em class="structfield"><code>get_parent_uri</code></em> ()</span></td>
127
<td>See <a href="ThunarxFileInfo.html#thunarx-file-info-get-parent-uri"><code class="function">thunarx_file_info_get_parent_uri()</code></a>.
132
<span class="term"><em class="structfield"><code>get_uri_scheme</code></em> ()</span></td>
133
<td>See <a href="ThunarxFileInfo.html#thunarx-file-info-get-uri-scheme"><code class="function">thunarx_file_info_get_uri_scheme()</code></a>.
138
<span class="term"><em class="structfield"><code>get_mime_type</code></em> ()</span></td>
139
<td>See <a href="ThunarxFileInfo.html#thunarx-file-info-get-mime-type"><code class="function">thunarx_file_info_get_mime_type()</code></a>.
144
<span class="term"><em class="structfield"><code>has_mime_type</code></em> ()</span></td>
145
<td>See <a href="ThunarxFileInfo.html#thunarx-file-info-has-mime-type"><code class="function">thunarx_file_info_has_mime_type()</code></a>.
150
<span class="term"><em class="structfield"><code>is_directory</code></em> ()</span></td>
151
<td>See <a href="ThunarxFileInfo.html#thunarx-file-info-is-directory"><code class="function">thunarx_file_info_is_directory()</code></a>.
159
<div class="refsect2" lang="en">
160
<a name="id2593217"></a><h3>
161
<a name="ThunarxFileInfo-struct"></a>ThunarxFileInfo</h3>
162
<a class="indexterm" name="id2593225"></a><pre class="programlisting">typedef struct _ThunarxFileInfo ThunarxFileInfo;</pre>
164
File info type, which is mapped to the real file info implementation
165
within the file manager.
169
<div class="refsect2" lang="en">
170
<a name="id2593240"></a><h3>
171
<a name="thunarx-file-info-get-name"></a>thunarx_file_info_get_name ()</h3>
172
<a class="indexterm" name="id2593249"></a><pre class="programlisting">gchar* thunarx_file_info_get_name (<a href="ThunarxFileInfo.html" title="ThunarxFileInfo">ThunarxFileInfo</a> *file_info);</pre>
174
Returns the real name of the file represented
175
by <em class="parameter"><code>file_info</code></em> in the local file system encoding.
176
You can use <code class="function">g_filename_display_name()</code> or similar
177
functions to generate an UTF-8 version of the
178
name, which is suitable for use in the user
182
The caller is responsible to free the returned
183
string using <code class="function">g_free()</code> when no longer needed.</p>
187
<div class="variablelist"><table border="0">
188
<col align="left" valign="top">
192
<span class="term"><em class="parameter"><code>file_info</code></em> :</span></td>
193
<td> a <a href="ThunarxFileInfo.html" title="ThunarxFileInfo"><span class="type">ThunarxFileInfo</span></a>.
198
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
199
<td> the real name of the file represented
200
by <em class="parameter"><code>file_info</code></em>.
207
<div class="refsect2" lang="en">
208
<a name="id2593345"></a><h3>
209
<a name="thunarx-file-info-get-uri"></a>thunarx_file_info_get_uri ()</h3>
210
<a class="indexterm" name="id2593353"></a><pre class="programlisting">gchar* thunarx_file_info_get_uri (<a href="ThunarxFileInfo.html" title="ThunarxFileInfo">ThunarxFileInfo</a> *file_info);</pre>
212
Returns the escaped, fully qualified URI
213
of the file object represented by <em class="parameter"><code>file_info</code></em>.
214
You may use <code class="function">g_filename_from_uri()</code> and similar
215
functions to work with the returned URI.
218
The caller is responsible to free the returned
219
string using <code class="function">g_free()</code> when no longer needed.</p>
223
<div class="variablelist"><table border="0">
224
<col align="left" valign="top">
228
<span class="term"><em class="parameter"><code>file_info</code></em> :</span></td>
229
<td> a <a href="ThunarxFileInfo.html" title="ThunarxFileInfo"><span class="type">ThunarxFileInfo</span></a>.
234
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
235
<td> the fully qualified URI of <em class="parameter"><code>file_info</code></em>.
242
<div class="refsect2" lang="en">
243
<a name="id2593447"></a><h3>
244
<a name="thunarx-file-info-get-parent-uri"></a>thunarx_file_info_get_parent_uri ()</h3>
245
<a class="indexterm" name="id2593459"></a><pre class="programlisting">gchar* thunarx_file_info_get_parent_uri
246
(<a href="ThunarxFileInfo.html" title="ThunarxFileInfo">ThunarxFileInfo</a> *file_info);</pre>
248
Returns the URI to the parent file of
249
<em class="parameter"><code>file_info</code></em> or <code class="literal">NULL</code> if <em class="parameter"><code>file_info</code></em> has
250
no parent. Note that the parent URI
251
may be of a different type than the
252
URI of <em class="parameter"><code>file_info</code></em>. For example, the
253
parent of "file:///" is "computer:///".
256
The caller is responsible to free the
257
returned string using <code class="function">g_free()</code> when no
262
<div class="variablelist"><table border="0">
263
<col align="left" valign="top">
267
<span class="term"><em class="parameter"><code>file_info</code></em> :</span></td>
268
<td> a <a href="ThunarxFileInfo.html" title="ThunarxFileInfo"><span class="type">ThunarxFileInfo</span></a>.
273
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
274
<td> the parent URI for <em class="parameter"><code>file_info</code></em>
275
or <code class="literal">NULL</code>.
282
<div class="refsect2" lang="en">
283
<a name="id2593566"></a><h3>
284
<a name="thunarx-file-info-get-uri-scheme"></a>thunarx_file_info_get_uri_scheme ()</h3>
285
<a class="indexterm" name="id2593578"></a><pre class="programlisting">gchar* thunarx_file_info_get_uri_scheme
286
(<a href="ThunarxFileInfo.html" title="ThunarxFileInfo">ThunarxFileInfo</a> *file_info);</pre>
288
Returns the URI scheme of the file represented
289
by <em class="parameter"><code>file_info</code></em>. E.g. if <em class="parameter"><code>file_info</code></em> refers to the
290
file "file:///usr/home", the return value will
294
The caller is responsible to free the returned
295
string using <code class="function">g_free()</code> when no longer needed.</p>
299
<div class="variablelist"><table border="0">
300
<col align="left" valign="top">
304
<span class="term"><em class="parameter"><code>file_info</code></em> :</span></td>
305
<td> a <a href="ThunarxFileInfo.html" title="ThunarxFileInfo"><span class="type">ThunarxFileInfo</span></a>.
310
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
311
<td> the URI scheme for <em class="parameter"><code>file_info</code></em>.
318
<div class="refsect2" lang="en">
319
<a name="id2593805"></a><h3>
320
<a name="thunarx-file-info-get-mime-type"></a>thunarx_file_info_get_mime_type ()</h3>
321
<a class="indexterm" name="id2593815"></a><pre class="programlisting">gchar* thunarx_file_info_get_mime_type (<a href="ThunarxFileInfo.html" title="ThunarxFileInfo">ThunarxFileInfo</a> *file_info);</pre>
323
Returns the MIME-type of the file represented by
324
<em class="parameter"><code>file_info</code></em> or <code class="literal">NULL</code> if no MIME-type is known for
325
<em class="parameter"><code>file_info</code></em>.
328
The caller is responsible to free the returned
329
string using <code class="function">g_free()</code> when no longer needed.</p>
333
<div class="variablelist"><table border="0">
334
<col align="left" valign="top">
338
<span class="term"><em class="parameter"><code>file_info</code></em> :</span></td>
339
<td> a <a href="ThunarxFileInfo.html" title="ThunarxFileInfo"><span class="type">ThunarxFileInfo</span></a>.
344
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
345
<td> the MIME-type for <em class="parameter"><code>file_info</code></em> or
346
<code class="literal">NULL</code>.
353
<div class="refsect2" lang="en">
354
<a name="id2593916"></a><h3>
355
<a name="thunarx-file-info-has-mime-type"></a>thunarx_file_info_has_mime_type ()</h3>
356
<a class="indexterm" name="id2593926"></a><pre class="programlisting">gboolean thunarx_file_info_has_mime_type (<a href="ThunarxFileInfo.html" title="ThunarxFileInfo">ThunarxFileInfo</a> *file_info,
357
const gchar *mime_type);</pre>
359
Checks whether <em class="parameter"><code>file_info</code></em> is of the given <em class="parameter"><code>mime_type</code></em>
360
or whether the MIME-type of <em class="parameter"><code>file_info</code></em> is a subclass
361
of <em class="parameter"><code>mime_type</code></em>.
364
This is the preferred way for most extensions to check
365
whether they support a given file or not, and you should
366
consider using this method rather than
367
<a href="ThunarxFileInfo.html#thunarx-file-info-get-mime-type"><code class="function">thunarx_file_info_get_mime_type()</code></a>. A simple example would
368
be a menu extension that performs a certain action on
369
text files. In this case you want to check whether a given
370
<a href="ThunarxFileInfo.html" title="ThunarxFileInfo"><span class="type">ThunarxFileInfo</span></a> refers to any kind of text file, not only
371
to "text/plain" (e.g. this also includes "text/xml" and
372
"application/x-desktop").
375
But you should be aware that this method may take some
376
time to test whether <em class="parameter"><code>mime_type</code></em> is valid for <em class="parameter"><code>file_info</code></em>,
377
so don't call it too often.</p>
381
<div class="variablelist"><table border="0">
382
<col align="left" valign="top">
386
<span class="term"><em class="parameter"><code>file_info</code></em> :</span></td>
387
<td> a <a href="ThunarxFileInfo.html" title="ThunarxFileInfo"><span class="type">ThunarxFileInfo</span></a>.
392
<span class="term"><em class="parameter"><code>mime_type</code></em> :</span></td>
393
<td> a MIME-type (e.g. "text/plain").
398
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
399
<td> <code class="literal">TRUE</code> if <em class="parameter"><code>mime_type</code></em> is valid for <em class="parameter"><code>file_info</code></em>,
400
else <code class="literal">FALSE</code>.
407
<div class="refsect2" lang="en">
408
<a name="id2594082"></a><h3>
409
<a name="thunarx-file-info-is-directory"></a>thunarx_file_info_is_directory ()</h3>
410
<a class="indexterm" name="id2594091"></a><pre class="programlisting">gboolean thunarx_file_info_is_directory (<a href="ThunarxFileInfo.html" title="ThunarxFileInfo">ThunarxFileInfo</a> *file_info);</pre>
412
Checks whether <em class="parameter"><code>file_info</code></em> refers to a directory.</p>
416
<div class="variablelist"><table border="0">
417
<col align="left" valign="top">
421
<span class="term"><em class="parameter"><code>file_info</code></em> :</span></td>
422
<td> a <a href="ThunarxFileInfo.html" title="ThunarxFileInfo"><span class="type">ThunarxFileInfo</span></a>.
427
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
428
<td> <code class="literal">TRUE</code> if <em class="parameter"><code>file_info</code></em> is a directory.
435
<div class="refsect2" lang="en">
436
<a name="id2594168"></a><h3>
437
<a name="thunarx-file-info-list-copy"></a>thunarx_file_info_list_copy ()</h3>
438
<a class="indexterm" name="id2594177"></a><pre class="programlisting">GList* thunarx_file_info_list_copy (GList *file_infos);</pre>
440
Does a deep copy of <em class="parameter"><code>file_infos</code></em> and returns the
445
<div class="variablelist"><table border="0">
446
<col align="left" valign="top">
450
<span class="term"><em class="parameter"><code>file_infos</code></em> :</span></td>
451
<td> a <span class="type">GList</span> of <a href="ThunarxFileInfo.html" title="ThunarxFileInfo"><span class="type">ThunarxFileInfo</span></a>s.
456
<span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
457
<td> a copy of <em class="parameter"><code>file_infos</code></em>.
464
<div class="refsect2" lang="en">
465
<a name="id2594256"></a><h3>
466
<a name="thunarx-file-info-list-free"></a>thunarx_file_info_list_free ()</h3>
467
<a class="indexterm" name="id2594264"></a><pre class="programlisting">void thunarx_file_info_list_free (GList *file_infos);</pre>
469
Frees the resources allocated for the <em class="parameter"><code>file_infos</code></em>
470
list and decreases the reference count on the
471
<a href="ThunarxFileInfo.html" title="ThunarxFileInfo"><span class="type">ThunarxFileInfo</span></a>s contained within.</p>
475
<div class="variablelist"><table border="0">
476
<col align="left" valign="top">
479
<span class="term"><em class="parameter"><code>file_infos</code></em> :</span></td>
480
<td> a <span class="type">GList</span> of <a href="ThunarxFileInfo.html" title="ThunarxFileInfo"><span class="type">ThunarxFileInfo</span></a>s.
487
<table class="navigation" width="100%" summary="Navigation footer" cellpadding="2" cellspacing="0"><tr valign="middle">
488
<td align="left"><a accesskey="p" href="thunarx-abstraction-layer.html"><b><< Part IV. Abstraction Layer</b></a></td>
489
<td align="right"><a accesskey="n" href="ThunarxPropertyPage.html"><b>ThunarxPropertyPage >></b></a></td>