~awn-core/awn/trunk-rewrite

« back to all changes in this revision

Viewing changes to libawn/awn-vfs.h

Merge from <lp:~malept/awn/0.4-libdesktop-agnostic>, revision 847.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 *  Copyright (C) 2007, 2008 Mark Lee <avant-wn@lazymalevolence.com>
3
 
 *
4
 
 *  This library is free software; you can redistribute it and/or
5
 
 *  modify it under the terms of the GNU Lesser General Public
6
 
 *  License as published by the Free Software Foundation; either
7
 
 *  version 2 of the License, or (at your option) any later version.
8
 
 *
9
 
 *  This library is distributed in the hope that it will be useful,
10
 
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
 
 *  Lesser General Public License for more details.
13
 
 *
14
 
 *  You should have received a copy of the GNU Lesser General Public
15
 
 *  License along with this library; if not, write to the
16
 
 *  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17
 
 *  Boston, MA 02111-1307, USA.
18
 
 *
19
 
 *  Author : Mark Lee <avant-wn@lazymalevolence.com>
20
 
 */
21
 
 
22
 
#ifndef _LIBAWN_AWN_VFS_H
23
 
#define _LIBAWN_AWN_VFS_H
24
 
 
25
 
#include <glib.h>
26
 
#include <gio/gio.h>
27
 
/**
28
 
 * AwnVfsMonitor:
29
 
 *
30
 
 * A wrapper structure for the VFS libraries' file/directory monitoring
31
 
 * structure. In the case of the GIO implementation, it is an opaque structure.
32
 
 */
33
 
typedef struct _AwnVfsMonitor AwnVfsMonitor;
34
 
 
35
 
 
36
 
/**
37
 
 * AwnVfsMonitorEvent:
38
 
 * @AWN_VFS_MONITOR_EVENT_CHANGED: Indicates that the path referenced has
39
 
 * been changed.
40
 
 * @AWN_VFS_MONITOR_EVENT_CREATED: Indicates that the path referenced has
41
 
 * been created on the filesystem.
42
 
 * @AWN_VFS_MONITOR_EVENT_DELETED: Indicates that the path referenced has
43
 
 * been removed from the filesystem.
44
 
 *
45
 
 * A list of valid monitor event types for use with monitor event emission or
46
 
 * retrieving the type of monitor event in the callback.  Due to thunar-vfs's
47
 
 * limited support for event types, only "changed", "created", and "deleted"
48
 
 * are available for use.
49
 
 */
50
 
typedef enum {
51
 
        AWN_VFS_MONITOR_EVENT_CHANGED,
52
 
        AWN_VFS_MONITOR_EVENT_CREATED,
53
 
        AWN_VFS_MONITOR_EVENT_DELETED
54
 
} AwnVfsMonitorEvent;
55
 
 
56
 
/**
57
 
 * AwnVfsMonitorType:
58
 
 * @AWN_VFS_MONITOR_FILE: Indicates that the #AwnVfsMonitor instance is
59
 
 * monitoring a file.
60
 
 * @AWN_VFS_MONITOR_DIRECTORY: Indicates that the #AwnVfsMonitor instance is
61
 
 * monitoring a directory.
62
 
 *
63
 
 * The type of path that an #AwnVfsMonitor instance is monitoring.
64
 
 */
65
 
typedef enum {
66
 
        AWN_VFS_MONITOR_FILE,
67
 
        AWN_VFS_MONITOR_DIRECTORY
68
 
} AwnVfsMonitorType;
69
 
 
70
 
/**
71
 
 * AwnVfsMonitorFunc:
72
 
 * @monitor: The monitor structure.
73
 
 * @monitor_path: The path that is associated with the monitor structure.
74
 
 * @event_path: In the case of a directory monitor, the path inside the folder
75
 
 * that triggered the event.  Otherwise, it is the same as the @monitor_path.
76
 
 * @event: The filesystem operation that triggered the callback to be executed.
77
 
 * @user_data: The data passed to awn_vfs_monitor_add() so that it could be used
78
 
 * in the callback.
79
 
 *
80
 
 * The function template used for callbacks executed when a filesystem event has
81
 
 * occurred on a path that is being monitored.
82
 
 */
83
 
typedef void (*AwnVfsMonitorFunc) (AwnVfsMonitor *monitor, gchar *monitor_path, gchar *event_path, AwnVfsMonitorEvent event, gpointer user_data);
84
 
 
85
 
/* File/Directory monitoring */
86
 
AwnVfsMonitor  *awn_vfs_monitor_add (gchar *path, AwnVfsMonitorType monitor_type, AwnVfsMonitorFunc callback, gpointer user_data);
87
 
void            awn_vfs_monitor_emit (AwnVfsMonitor *monitor, gchar *path, AwnVfsMonitorEvent event);
88
 
void            awn_vfs_monitor_remove (AwnVfsMonitor *monitor);
89
 
 
90
 
/* utility functions */
91
 
void            awn_vfs_init (void);
92
 
GSList         *awn_vfs_get_pathlist_from_string (gchar *paths, GError **err);
93
 
 
94
 
#endif /* _LIBAWN_AWN_VFS_H */
95
 
/* vim: set noet ts=8 sts=8 sw=8 : */