diff options
author | David Walter Seikel | 2013-01-13 17:29:19 +1000 |
---|---|---|
committer | David Walter Seikel | 2013-01-13 17:29:19 +1000 |
commit | 07274513e984f0b5544586c74508ccd16e7dcafa (patch) | |
tree | b32ff2a9136fbc1a4a6a0ed1e4d79cde0f5f16d9 /libraries/ecore/src/lib/ecore_file/ecore_file_monitor.c | |
parent | Added Irrlicht 1.8, but without all the Windows binaries. (diff) | |
download | SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.zip SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.gz SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.bz2 SledjHamr-07274513e984f0b5544586c74508ccd16e7dcafa.tar.xz |
Remove EFL, since it's been released now.
Diffstat (limited to 'libraries/ecore/src/lib/ecore_file/ecore_file_monitor.c')
-rw-r--r-- | libraries/ecore/src/lib/ecore_file/ecore_file_monitor.c | 180 |
1 files changed, 0 insertions, 180 deletions
diff --git a/libraries/ecore/src/lib/ecore_file/ecore_file_monitor.c b/libraries/ecore/src/lib/ecore_file/ecore_file_monitor.c deleted file mode 100644 index 7c334c0..0000000 --- a/libraries/ecore/src/lib/ecore_file/ecore_file_monitor.c +++ /dev/null | |||
@@ -1,180 +0,0 @@ | |||
1 | #ifdef HAVE_CONFIG_H | ||
2 | # include <config.h> | ||
3 | #endif | ||
4 | |||
5 | #include "ecore_file_private.h" | ||
6 | |||
7 | typedef enum { | ||
8 | ECORE_FILE_MONITOR_TYPE_NONE, | ||
9 | #ifdef HAVE_INOTIFY | ||
10 | ECORE_FILE_MONITOR_TYPE_INOTIFY, | ||
11 | #endif | ||
12 | #ifdef HAVE_NOTIFY_WIN32 | ||
13 | ECORE_FILE_MONITOR_TYPE_NOTIFY_WIN32, | ||
14 | #endif | ||
15 | #ifdef HAVE_POLL | ||
16 | ECORE_FILE_MONITOR_TYPE_POLL | ||
17 | #endif | ||
18 | } Ecore_File_Monitor_Type; | ||
19 | |||
20 | static Ecore_File_Monitor_Type monitor_type = ECORE_FILE_MONITOR_TYPE_NONE; | ||
21 | |||
22 | int | ||
23 | ecore_file_monitor_init(void) | ||
24 | { | ||
25 | #ifdef HAVE_INOTIFY | ||
26 | monitor_type = ECORE_FILE_MONITOR_TYPE_INOTIFY; | ||
27 | if (ecore_file_monitor_inotify_init()) | ||
28 | return 1; | ||
29 | #endif | ||
30 | #ifdef HAVE_NOTIFY_WIN32 | ||
31 | monitor_type = ECORE_FILE_MONITOR_TYPE_NOTIFY_WIN32; | ||
32 | if (ecore_file_monitor_win32_init()) | ||
33 | return 1; | ||
34 | #endif | ||
35 | #ifdef HAVE_POLL | ||
36 | monitor_type = ECORE_FILE_MONITOR_TYPE_POLL; | ||
37 | if (ecore_file_monitor_poll_init()) | ||
38 | return 1; | ||
39 | #endif | ||
40 | monitor_type = ECORE_FILE_MONITOR_TYPE_NONE; | ||
41 | return 0; | ||
42 | } | ||
43 | |||
44 | void | ||
45 | ecore_file_monitor_shutdown(void) | ||
46 | { | ||
47 | switch (monitor_type) | ||
48 | { | ||
49 | case ECORE_FILE_MONITOR_TYPE_NONE: | ||
50 | break; | ||
51 | #ifdef HAVE_INOTIFY | ||
52 | case ECORE_FILE_MONITOR_TYPE_INOTIFY: | ||
53 | ecore_file_monitor_inotify_shutdown(); | ||
54 | break; | ||
55 | #endif | ||
56 | #ifdef HAVE_NOTIFY_WIN32 | ||
57 | case ECORE_FILE_MONITOR_TYPE_NOTIFY_WIN32: | ||
58 | ecore_file_monitor_win32_shutdown(); | ||
59 | break; | ||
60 | #endif | ||
61 | #ifdef HAVE_POLL | ||
62 | case ECORE_FILE_MONITOR_TYPE_POLL: | ||
63 | ecore_file_monitor_poll_shutdown(); | ||
64 | break; | ||
65 | #endif | ||
66 | } | ||
67 | } | ||
68 | |||
69 | /** | ||
70 | * @addtogroup Ecore_File_Group Ecore_File - Files and directories convenience functions | ||
71 | * | ||
72 | * @{ | ||
73 | */ | ||
74 | |||
75 | /** | ||
76 | * @brief Monitor the given path using inotify, Windows notification, or polling. | ||
77 | * | ||
78 | * @param path The path to monitor. | ||
79 | * @param func The function to call on changes. | ||
80 | * @param data The data passed to func. | ||
81 | * @return An Ecore_File_Monitor pointer or NULL on failure. | ||
82 | * | ||
83 | * This function monitors @p path. If @p path is @c NULL, or is an | ||
84 | * empty string, or none of the notify methods (Inotify, Windows | ||
85 | * notification or polling) is available, or if @p path is not a file, | ||
86 | * the function returns @c NULL. Otherwise, it returns a newly | ||
87 | * allocated Ecore_File_Monitor object and the monitoring begins. When | ||
88 | * one of the #Ecore_File_Event event is notified, @p func is called | ||
89 | * and @p data is passed to @p func. Call ecore_file_monitor_del() to | ||
90 | * stop the monitoring. | ||
91 | */ | ||
92 | EAPI Ecore_File_Monitor * | ||
93 | ecore_file_monitor_add(const char *path, | ||
94 | Ecore_File_Monitor_Cb func, | ||
95 | void *data) | ||
96 | { | ||
97 | if (!path || !*path) | ||
98 | return NULL; | ||
99 | |||
100 | switch (monitor_type) | ||
101 | { | ||
102 | case ECORE_FILE_MONITOR_TYPE_NONE: | ||
103 | return NULL; | ||
104 | #ifdef HAVE_INOTIFY | ||
105 | case ECORE_FILE_MONITOR_TYPE_INOTIFY: | ||
106 | return ecore_file_monitor_inotify_add(path, func, data); | ||
107 | #endif | ||
108 | #ifdef HAVE_NOTIFY_WIN32 | ||
109 | case ECORE_FILE_MONITOR_TYPE_NOTIFY_WIN32: | ||
110 | return ecore_file_monitor_win32_add(path, func, data); | ||
111 | #endif | ||
112 | #ifdef HAVE_POLL | ||
113 | case ECORE_FILE_MONITOR_TYPE_POLL: | ||
114 | return ecore_file_monitor_poll_add(path, func, data); | ||
115 | #endif | ||
116 | } | ||
117 | return NULL; | ||
118 | } | ||
119 | |||
120 | /** | ||
121 | * @brief Stop the monitoring of the given path. | ||
122 | * | ||
123 | * @param em The Ecore_File_Monitor to stop. | ||
124 | * | ||
125 | * This function stops the the monitoring of the path that has been | ||
126 | * monitored by ecore_file_monitor_add(). @p em must be the value | ||
127 | * returned by ecore_file_monitor_add(). If @p em is @c NULL, or none | ||
128 | * of the notify methods (Inotify, Windows notification or polling) is | ||
129 | * availablethis function does nothing. | ||
130 | */ | ||
131 | EAPI void | ||
132 | ecore_file_monitor_del(Ecore_File_Monitor *em) | ||
133 | { | ||
134 | if (!em) | ||
135 | return; | ||
136 | |||
137 | switch (monitor_type) | ||
138 | { | ||
139 | case ECORE_FILE_MONITOR_TYPE_NONE: | ||
140 | break; | ||
141 | #ifdef HAVE_INOTIFY | ||
142 | case ECORE_FILE_MONITOR_TYPE_INOTIFY: | ||
143 | ecore_file_monitor_inotify_del(em); | ||
144 | break; | ||
145 | #endif | ||
146 | #ifdef HAVE_NOTIFY_WIN32 | ||
147 | case ECORE_FILE_MONITOR_TYPE_NOTIFY_WIN32: | ||
148 | ecore_file_monitor_win32_del(em); | ||
149 | break; | ||
150 | #endif | ||
151 | #ifdef HAVE_POLL | ||
152 | case ECORE_FILE_MONITOR_TYPE_POLL: | ||
153 | ecore_file_monitor_poll_del(em); | ||
154 | break; | ||
155 | #endif | ||
156 | } | ||
157 | } | ||
158 | |||
159 | /** | ||
160 | * @brief Get the monitored path. | ||
161 | * | ||
162 | * @param em The Ecore_File_Monitor to query. | ||
163 | * @return The path that is monitored by @p em. | ||
164 | * | ||
165 | * This function returns the monitored path that has been | ||
166 | * monitored by ecore_file_monitor_add(). @p em must be the value | ||
167 | * returned by ecore_file_monitor_add(). If @p em is @c NULL, the | ||
168 | * function returns @c NULL. | ||
169 | */ | ||
170 | EAPI const char * | ||
171 | ecore_file_monitor_path_get(Ecore_File_Monitor *em) | ||
172 | { | ||
173 | if (!em) | ||
174 | return NULL; | ||
175 | return em->path; | ||
176 | } | ||
177 | |||
178 | /** | ||
179 | * @} | ||
180 | */ | ||