1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
<title>Locating Standard Directories</title>
6
<meta name="generator" content="DocBook XSL Stylesheets V1.74.3">
7
<link rel="home" href="index.html" title="GnomeVFS - Filesystem Abstraction library">
8
<link rel="up" href="gnome-vfs-directory-ops.html" title="Directory-Specific Operations">
9
<link rel="prev" href="gnome-vfs-2.0-gnome-vfs-directory-list-ops.html" title="Listing Directory Contents">
10
<link rel="next" href="gnome-vfs-file-and-dirs-ops.html" title="Advanced File/Directory Operations">
11
<meta name="generator" content="GTK-Doc V1.12 (XML mode)">
12
<link rel="stylesheet" href="style.css" type="text/css">
13
<link rel="chapter" href="about.html" title="Introduction to GnomeVFS">
14
<link rel="chapter" href="data-types.html" title="Basic Data Types">
15
<link rel="chapter" href="gnome-vfs-basic-file-ops.html" title="File Operations">
16
<link rel="chapter" href="gnome-vfs-directory-ops.html" title="Directory-Specific Operations">
17
<link rel="chapter" href="gnome-vfs-file-and-dirs-ops.html" title="Advanced File/Directory Operations">
18
<link rel="chapter" href="gnome-vfs-file-async-ops.html" title="Asynchronous Operations">
19
<link rel="chapter" href="volumes.html" title="Volumes and Drives Handling">
20
<link rel="chapter" href="networking.html" title="Networking">
21
<link rel="chapter" href="mime-registry.html" title="MIME Registry">
22
<link rel="chapter" href="modules.html" title="Filesystem Modules">
24
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
25
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
27
<td><a accesskey="p" href="gnome-vfs-2.0-gnome-vfs-directory-list-ops.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
28
<td><a accesskey="u" href="gnome-vfs-directory-ops.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
29
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
30
<th width="100%" align="center">GnomeVFS - Filesystem Abstraction library</th>
31
<td><a accesskey="n" href="gnome-vfs-file-and-dirs-ops.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
33
<tr><td colspan="5" class="shortcuts">
34
<a href="#gnome-vfs-2.0-gnome-vfs-directory-find-ops.synopsis" class="shortcut">Top</a>
36
<a href="#gnome-vfs-2.0-gnome-vfs-directory-find-ops.description" class="shortcut">Description</a>
39
<div class="refentry" lang="en">
40
<a name="gnome-vfs-2.0-gnome-vfs-directory-find-ops"></a><div class="titlepage"></div>
41
<div class="refnamediv"><table width="100%"><tr>
43
<h2><span class="refentrytitle"><a name="gnome-vfs-2.0-gnome-vfs-directory-find-ops.top_of_page"></a>Locating Standard Directories</span></h2>
44
<p>Locating Standard Directories — Utilities for locating standard directories such as the desktop and trash</p>
46
<td valign="top" align="right"></td>
48
<div class="refsynopsisdiv">
49
<a name="gnome-vfs-2.0-gnome-vfs-directory-find-ops.synopsis"></a><h2>Synopsis</h2>
50
<pre class="synopsis">
51
enum <a class="link" href="gnome-vfs-2.0-gnome-vfs-directory-find-ops.html#GnomeVFSFindDirectoryKind" title="enum GnomeVFSFindDirectoryKind">GnomeVFSFindDirectoryKind</a>;
52
<a class="link" href="gnome-vfs-2.0-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult">GnomeVFSResult</a> <a class="link" href="gnome-vfs-2.0-gnome-vfs-directory-find-ops.html#gnome-vfs-find-directory" title="gnome_vfs_find_directory ()">gnome_vfs_find_directory</a> (<a class="link" href="gnome-vfs-2.0-gnome-vfs-uri.html#GnomeVFSURI" title="GnomeVFSURI">GnomeVFSURI</a> *near_uri,
53
<a class="link" href="gnome-vfs-2.0-gnome-vfs-directory-find-ops.html#GnomeVFSFindDirectoryKind" title="enum GnomeVFSFindDirectoryKind">GnomeVFSFindDirectoryKind</a> kind,
54
<a class="link" href="gnome-vfs-2.0-gnome-vfs-uri.html#GnomeVFSURI" title="GnomeVFSURI">GnomeVFSURI</a> **result,
55
gboolean create_if_needed,
56
gboolean find_if_needed,
60
<div class="refsect1" lang="en">
61
<a name="gnome-vfs-2.0-gnome-vfs-directory-find-ops.description"></a><h2>Description</h2>
65
<div class="refsect1" lang="en">
66
<a name="gnome-vfs-2.0-gnome-vfs-directory-find-ops.details"></a><h2>Details</h2>
67
<div class="refsect2" lang="en">
68
<a name="GnomeVFSFindDirectoryKind"></a><h3>enum GnomeVFSFindDirectoryKind</h3>
69
<pre class="programlisting">typedef enum {
70
GNOME_VFS_DIRECTORY_KIND_DESKTOP = 1000,
71
GNOME_VFS_DIRECTORY_KIND_TRASH = 1001
72
} GnomeVFSFindDirectoryKind;
75
Specifies what directory <a class="link" href="gnome-vfs-2.0-gnome-vfs-directory-find-ops.html#gnome-vfs-find-directory" title="gnome_vfs_find_directory ()"><code class="function">gnome_vfs_find_directory()</code></a> or
76
<code class="function">gnome_vfs_find_directory_cancellable()</code> should find.</p>
79
<div class="variablelist"><table border="0">
80
<col align="left" valign="top">
83
<td><p><a name="GNOME-VFS-DIRECTORY-KIND-DESKTOP:CAPS"></a><span class="term"><code class="literal">GNOME_VFS_DIRECTORY_KIND_DESKTOP</code></span></p></td>
84
<td> Desktop directory.
88
<td><p><a name="GNOME-VFS-DIRECTORY-KIND-TRASH:CAPS"></a><span class="term"><code class="literal">GNOME_VFS_DIRECTORY_KIND_TRASH</code></span></p></td>
96
<div class="refsect2" lang="en">
97
<a name="gnome-vfs-find-directory"></a><h3>gnome_vfs_find_directory ()</h3>
98
<pre class="programlisting"><a class="link" href="gnome-vfs-2.0-gnome-vfs-result.html#GnomeVFSResult" title="enum GnomeVFSResult">GnomeVFSResult</a> gnome_vfs_find_directory (<a class="link" href="gnome-vfs-2.0-gnome-vfs-uri.html#GnomeVFSURI" title="GnomeVFSURI">GnomeVFSURI</a> *near_uri,
99
<a class="link" href="gnome-vfs-2.0-gnome-vfs-directory-find-ops.html#GnomeVFSFindDirectoryKind" title="enum GnomeVFSFindDirectoryKind">GnomeVFSFindDirectoryKind</a> kind,
100
<a class="link" href="gnome-vfs-2.0-gnome-vfs-uri.html#GnomeVFSURI" title="GnomeVFSURI">GnomeVFSURI</a> **result,
101
gboolean create_if_needed,
102
gboolean find_if_needed,
103
guint permissions);</pre>
105
Used to return well known directories such as Trash, Desktop, etc. from different
109
There is quite a complicated logic behind finding/creating a Trash directory
110
and you need to be aware of some implications:
111
Finding the Trash the first time when using the file method may be pretty
112
expensive. A cache file is used to store the location of that Trash file
114
If <em class="parameter"><code>create_if_needed</code></em> is specified without <em class="parameter"><code>find_if_needed</code></em>, you may end up
115
creating a Trash file when there already is one. Your app should start out
116
by doing a <a class="link" href="gnome-vfs-2.0-gnome-vfs-directory-find-ops.html#gnome-vfs-find-directory" title="gnome_vfs_find_directory ()"><code class="function">gnome_vfs_find_directory()</code></a> with the <em class="parameter"><code>find_if_needed</code></em> to avoid this
117
and then use the <em class="parameter"><code>create_if_needed</code></em> flag to create Trash lazily when it is
118
needed for throwing away an item on a given disk.</p>
121
<div class="variablelist"><table border="0">
122
<col align="left" valign="top">
125
<td><p><span class="term"><em class="parameter"><code>near_uri</code></em> :</span></p></td>
126
<td> find a well known directory on the same volume as <em class="parameter"><code>near_uri</code></em>.
130
<td><p><span class="term"><em class="parameter"><code>kind</code></em> :</span></p></td>
131
<td> kind of well known directory.
135
<td><p><span class="term"><em class="parameter"><code>result</code></em> :</span></p></td>
136
<td> newly created uri of the directory we found.
140
<td><p><span class="term"><em class="parameter"><code>create_if_needed</code></em> :</span></p></td>
141
<td> if directory we are looking for does not exist, try to create it.
145
<td><p><span class="term"><em class="parameter"><code>find_if_needed</code></em> :</span></p></td>
146
<td> if we don't know where directory is yet, look for it.
150
<td><p><span class="term"><em class="parameter"><code>permissions</code></em> :</span></p></td>
151
<td> if creating, use these permissions.
155
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
156
<td> an integer representing the result of the operation.
166
Generated by GTK-Doc V1.12</div>