source: trunk/third/gnome-vfs/libgnomevfs/gnome-vfs-utils.h @ 17128

Revision 17128, 4.8 KB checked in by ghudson, 23 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r17127, which included commits to RCS files with non-trunk default branches.
Line 
1/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
2/* gnome-vfs-utils.h - Public utility functions for the GNOME Virtual
3   File System.
4
5   Copyright (C) 1999 Free Software Foundation
6   Copyright (C) 2000 Eazel, Inc.
7
8   The Gnome Library is free software; you can redistribute it and/or
9   modify it under the terms of the GNU Library General Public License as
10   published by the Free Software Foundation; either version 2 of the
11   License, or (at your option) any later version.
12
13   The Gnome Library is distributed in the hope that it will be useful,
14   but WITHOUT ANY WARRANTY; without even the implied warranty of
15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16   Library General Public License for more details.
17
18   You should have received a copy of the GNU Library General Public
19   License along with the Gnome Library; see the file COPYING.LIB.  If not,
20   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21   Boston, MA 02111-1307, USA.
22
23   Authors: Ettore Perazzoli <ettore@comm2000.it>
24            John Sullivan <sullivan@eazel.com>
25*/
26
27#ifndef GNOME_VFS_UTILS_H
28#define GNOME_VFS_UTILS_H
29
30#include <libgnomevfs/gnome-vfs-file-size.h>
31#include <libgnomevfs/gnome-vfs-result.h>
32#include <libgnomevfs/gnome-vfs-uri.h>
33
34/* Makes a human-readable string. */
35char *gnome_vfs_format_file_size_for_display (GnomeVFSFileSize  size);
36
37/* Converts unsafe characters to % sequences so the string can be
38 * used as a piece of a URI. Escapes all reserved URI characters.
39 */
40char *gnome_vfs_escape_string                (const char      *string);
41
42/* Converts unsafe characters to % sequences so the path can be
43 * used as a piece of a URI. Escapes all reserved URI characters
44 * except for "/".
45 */
46char *gnome_vfs_escape_path_string           (const char      *path);
47
48/* Converts unsafe characters to % sequences so the host/path segment
49 * can be used as a piece of a URI.  Allows ":" and "@" in the host
50 * section (everything up to the first "/"), and after that, it behaves
51 * like gnome_vfs_escape_path_string.
52 */
53char *gnome_vfs_escape_host_and_path_string  (const char      *path);
54
55/* Converts only slashes and % characters to % sequences. This is useful
56 * for code that wants to use an arbitrary string as a file name. To use
57 * it in a URI, you have to escape again, of course.
58 */
59char *gnome_vfs_escape_slashes               (const char      *string);
60
61
62/* Escapes all the characters that match any of the @match_set */                                       
63char *gnome_vfs_escape_set                   (const char      *string,
64                                              const char      *match_set);
65
66/* Returns NULL if any of the illegal character appear in escaped
67 * form. If the illegal characters are in there unescaped, that's OK.
68 * Typically you pass "/" for illegal characters when converting to a
69 * Unix path, since pieces of Unix paths can't contain "/". ASCII 0
70 * is always illegal due to the limitations of NULL-terminated strings.
71 */
72char *gnome_vfs_unescape_string              (const char      *string,
73                                              const char      *illegal_characters);
74
75/* returns a copy of uri, converted to a canonical form */
76char *gnome_vfs_make_uri_canonical           (const char        *uri);
77
78/* returns a copy of path, converted to a canonical form */
79char *gnome_vfs_make_path_name_canonical     (const char      *path);
80
81/* returns a copy of path, with initial ~ expanded, or just copy of path
82 * if there's no initial ~
83 */
84char *gnome_vfs_expand_initial_tilde         (const char      *path);
85
86/* Prepare an escaped string for display. Unlike gnome_vfs_unescape_string,
87 * this doesn't return NULL if an illegal sequences appears in the string,
88 * instead doing its best to provide a useful result.
89 */
90char *gnome_vfs_unescape_string_for_display  (const char      *escaped);
91
92/* Turn a "file://" URI in string form into a local path. Returns NULL
93 * if it's not a URI that can be converted.
94 */
95char *gnome_vfs_get_local_path_from_uri      (const char      *uri);
96
97/* Turn a path into a "file://" URI. */
98char *gnome_vfs_get_uri_from_local_path      (const char      *local_full_path);
99
100/* Check whether a string starts with an executable command */
101gboolean gnome_vfs_is_executable_command_string (const char *command_string);
102
103/* Free the list, freeing each item data with a g_free */
104void   gnome_vfs_list_deep_free               (GList            *list);
105
106
107/* Return amount of free space on target */
108GnomeVFSResult  gnome_vfs_get_volume_free_space (const GnomeVFSURI      *vfs_uri,
109                                                 GnomeVFSFileSize       *size);
110
111char *gnome_vfs_icon_path_from_filename       (const char *filename);
112
113/* TRUE if the current thread is the thread with the main glib event loop */
114#define GNOME_VFS_ASSERT_PRIMARY_THREAD g_assert (gnome_vfs_is_primary_thread())
115#define GNOME_VFS_ASSERT_SECONDARY_THREAD g_assert (!gnome_vfs_is_primary_thread())
116gboolean        gnome_vfs_is_primary_thread (void);
117
118#endif /* GNOME_VFS_UTILS_H */
Note: See TracBrowser for help on using the repository browser.