1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
2 /* gnome-vfs-find-directory.c - Public utility functions for the GNOME Virtual
5 Copyright (C) 2000 Eazel, Inc.
7 The Gnome Library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public License as
9 published by the Free Software Foundation; either version 2 of the
10 License, or (at your option) any later version.
12 The Gnome Library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Library General Public License for more details.
17 You should have received a copy of the GNU Library General Public
18 License along with the Gnome Library; see the file COPYING.LIB. If not,
19 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 Boston, MA 02111-1307, USA.
22 Authors: Pavel Cisler <pavel@eazel.com>
26 #include "gnome-vfs-find-directory.h"
28 #include "gnome-vfs-cancellable-ops.h"
31 * gnome_vfs_find_directory:
32 * @near_uri: find a well known directory on the same volume as @near_uri
33 * @kind: kind of well known directory
34 * @result: newly created URI of the directory we found
35 * @create_if_needed: If directory we are looking for does not exist, try to create it
36 * @find_if_needed: If we don't know where trash is yet, look for it.
37 * @permissions: If creating, use these permissions
39 * Used to return well known directories such as Trash, Desktop, etc. from different
42 * There is quite a complicated logic behind finding/creating a Trash directory
43 * and you need to be aware of some implications:
44 * Finding the Trash the first time when using the file method may be pretty
45 * expensive. A cache file is used to store the location of that Trash file
47 * If @ceate_if_needed is specified without @find_if_needed, you may end up
48 * creating a Trash file when there already is one. Your app should start out
49 * by doing a gnome_vfs_find_directory with the @find_if_needed to avoid this
50 * and then use the @create_if_needed flag to create Trash lazily when it is
51 * needed for throwing away an item on a given disk.
53 * Returns: An integer representing the result of the operation
56 gnome_vfs_find_directory (GnomeVFSURI *near_uri,
57 GnomeVFSFindDirectoryKind kind,
59 gboolean create_if_needed,
60 gboolean find_if_needed,
63 return gnome_vfs_find_directory_cancellable (near_uri, kind, result,
64 create_if_needed, find_if_needed, permissions, NULL);