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 |
---|
3 | File System. |
---|
4 | |
---|
5 | Copyright (C) 2000 Eazel, Inc. |
---|
6 | |
---|
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. |
---|
11 | |
---|
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. |
---|
16 | |
---|
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. |
---|
21 | |
---|
22 | Authors: Pavel Cisler <pavel@eazel.com> |
---|
23 | */ |
---|
24 | |
---|
25 | #include <config.h> |
---|
26 | #include "gnome-vfs-find-directory.h" |
---|
27 | |
---|
28 | #include "gnome-vfs.h" |
---|
29 | #include "gnome-vfs-private.h" |
---|
30 | |
---|
31 | |
---|
32 | /** |
---|
33 | * gnome_vfs_find_directory: |
---|
34 | * @near_uri: find a well known directory on the same volume as @near_uri |
---|
35 | * @kind: kind of well known directory |
---|
36 | * @result: newly created URI of the directory we found |
---|
37 | * @create_if_needed: If directory we are looking for does not exist, try to create it |
---|
38 | * @create_if_needed: If we don't know where trash is yet, look for it. |
---|
39 | * @permissions: If creating, use these permissions |
---|
40 | * |
---|
41 | * Used to return well known directories such as Trash, Desktop, etc. from different |
---|
42 | * file systems. |
---|
43 | * |
---|
44 | * There is quite a complicated logic behind finding/creating a Trash directory |
---|
45 | * and you need to be aware of some implications: |
---|
46 | * Finding the Trash the first time when using the file method may be pretty |
---|
47 | * expensive. A cache file is used to store the location of that Trash file |
---|
48 | * for next time. |
---|
49 | * If @ceate_if_needed is specified without @find_if_needed, you may end up |
---|
50 | * creating a Trash file when there already is one. Your app should start out |
---|
51 | * by doing a gnome_vfs_find_directory with the @find_if_needed to avoid this |
---|
52 | * and then use the @create_if_needed flag to create Trash lazily when it is |
---|
53 | * needed for throwing away an item on a given disk. |
---|
54 | * |
---|
55 | * Return value: An integer representing the result of the operation |
---|
56 | **/ |
---|
57 | GnomeVFSResult |
---|
58 | gnome_vfs_find_directory (GnomeVFSURI *near_uri, |
---|
59 | GnomeVFSFindDirectoryKind kind, |
---|
60 | GnomeVFSURI **result, |
---|
61 | gboolean create_if_needed, |
---|
62 | gboolean find_if_needed, |
---|
63 | guint permissions) |
---|
64 | { |
---|
65 | return gnome_vfs_find_directory_cancellable (near_uri, kind, result, |
---|
66 | create_if_needed, find_if_needed, permissions, NULL); |
---|
67 | } |
---|