1 /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
3 * vfolder-util.h - Utility functions for wrapping monitors and
4 * filename/uri parsing.
6 * Copyright (C) 2002 Ximian, Inc.
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.
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.
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.
23 * Author: Alex Graveley <alex@ximian.com>
24 * Based on original code by George Lebl <jirka@5z.com>.
27 #ifndef VFOLDER_UTIL_H
28 #define VFOLDER_UTIL_H
33 #include <libgnomevfs/gnome-vfs-uri.h>
34 #include <libgnomevfs/gnome-vfs-utils.h>
35 #include <libgnomevfs/gnome-vfs-monitor.h>
41 gboolean is_all_scheme;
42 gboolean ends_in_slash;
48 /* assumes vuri->path already set */
49 gboolean vfolder_uri_parse_internal (GnomeVFSURI *uri, VFolderURI *vuri);
51 #define VFOLDER_URI_PARSE(_uri, _vuri) { \
53 path = gnome_vfs_unescape_string ((_uri)->text, G_DIR_SEPARATOR_S); \
55 (_vuri)->path = g_alloca (strlen (path) + 1); \
56 strcpy ((_vuri)->path, path); \
59 (_vuri)->path = NULL; \
61 vfolder_uri_parse_internal ((_uri), (_vuri)); \
62 D (g_print ( "%s(): %s\n", G_GNUC_FUNCTION, (_vuri)->path)); \
67 GnomeVFSMonitorType type;
69 GnomeVFSMonitorHandle *vfs_handle;
76 GnomeVFSMonitorCallback callback;
81 VFolderMonitor *vfolder_monitor_dir_new (const gchar *uri,
82 GnomeVFSMonitorCallback callback,
84 VFolderMonitor *vfolder_monitor_file_new (const gchar *uri,
85 GnomeVFSMonitorCallback callback,
87 void vfolder_monitor_emit (const gchar *uri,
88 GnomeVFSMonitorEventType event_type);
89 void vfolder_monitor_freeze (VFolderMonitor *monitor);
90 void vfolder_monitor_thaw (VFolderMonitor *monitor);
91 void vfolder_monitor_cancel (VFolderMonitor *monitor);
94 GnomeVFSResult vfolder_make_directory_and_parents (const gchar *uri,
95 gboolean skip_filename,
99 gchar *vfolder_timestamp_file_name (const gchar *file);
100 gchar *vfolder_untimestamp_file_name (const gchar *file);
101 gboolean vfolder_check_extension (const char *name,
102 const char *ext_check);
103 gchar *vfolder_escape_home (const gchar *file);
105 gchar *vfolder_build_uri (const char *first_element,
111 #endif /* VFOLDER_UTIL_H */