GFileMonitor*
_g_local_directory_monitor_new (const char *dirname,
- GFileMonitorFlags flags,
+ GFileMonitorFlags flags,
+ GMainContext *context,
gboolean is_remote_fs,
- GError **error)
+ gboolean do_start,
+ GError **error)
{
GFileMonitor *monitor = NULL;
GType type = G_TYPE_INVALID;
G_STRUCT_OFFSET (GLocalDirectoryMonitorClass, is_supported));
if (type != G_TYPE_INVALID)
- monitor = G_FILE_MONITOR (g_object_new (type, "dirname", dirname, "flags", flags, NULL));
+ monitor = G_FILE_MONITOR (g_object_new (type, "dirname", dirname, "flags", flags, "context", context, NULL));
else
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
_("Unable to find default local directory monitor type"));
- if (monitor)
+ if (monitor && do_start)
g_local_directory_monitor_start (G_LOCAL_DIRECTORY_MONITOR (monitor));
return monitor;
GFileMonitor * _g_local_directory_monitor_new (const char *dirname,
GFileMonitorFlags flags,
+ GMainContext *context,
gboolean is_remote_fs,
+ gboolean do_start,
GError **error);
void g_local_directory_monitor_start (GLocalDirectoryMonitor *local_monitor);
+/* Actually in glocalfile.c */
+GLocalDirectoryMonitor * g_local_directory_monitor_new_in_worker (const char *pathname,
+ GFileMonitorFlags flags,
+ GError **error);
+
G_END_DECLS
#endif /* __G_LOCAL_DIRECTORY_MONITOR_H__ */
#endif
#include "glib-private.h"
+#include "glib-private.h"
+
#ifdef G_OS_WIN32
#include <windows.h>
#include <io.h>
GError **error)
{
GLocalFile* local_file = G_LOCAL_FILE(file);
- return _g_local_directory_monitor_new (local_file->filename, flags, is_remote (local_file->filename), error);
+ return _g_local_directory_monitor_new (local_file->filename, flags, NULL, is_remote (local_file->filename), TRUE, error);
}
static GFileMonitor*
GError **error)
{
GLocalFile* local_file = G_LOCAL_FILE(file);
- return _g_local_file_monitor_new (local_file->filename, flags, is_remote (local_file->filename), error);
+ return _g_local_file_monitor_new (local_file->filename, flags, NULL, is_remote (local_file->filename), TRUE, error);
+}
+
+GLocalDirectoryMonitor *
+g_local_directory_monitor_new_in_worker (const char *pathname,
+ GFileMonitorFlags flags,
+ GError **error)
+{
+ return (gpointer) _g_local_directory_monitor_new (pathname, flags,
+ GLIB_PRIVATE_CALL (g_get_worker_context) (),
+ is_remote (pathname), FALSE, error);
+}
+
+GLocalFileMonitor *
+g_local_file_monitor_new_in_worker (const char *pathname,
+ GFileMonitorFlags flags,
+ GError **error)
+{
+ return (gpointer) _g_local_file_monitor_new (pathname, flags,
+ GLIB_PRIVATE_CALL (g_get_worker_context) (),
+ is_remote (pathname), FALSE, error);
}
GFileMonitor*
_g_local_file_monitor_new (const char *pathname,
GFileMonitorFlags flags,
+ GMainContext *context,
gboolean is_remote_fs,
+ gboolean do_start,
GError **error)
{
GFileMonitor *monitor = NULL;
G_STRUCT_OFFSET (GLocalFileMonitorClass, is_supported));
if (type != G_TYPE_INVALID)
- monitor = G_FILE_MONITOR (g_object_new (type, "filename", pathname, "flags", flags, NULL));
+ monitor = G_FILE_MONITOR (g_object_new (type, "filename", pathname, "flags", flags, "context", context, NULL));
else
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
_("Unable to find default local file monitor type"));
- if (monitor)
+ if (monitor && do_start)
g_local_file_monitor_start (G_LOCAL_FILE_MONITOR (monitor));
return monitor;
GFileMonitor * _g_local_file_monitor_new (const char *pathname,
GFileMonitorFlags flags,
+ GMainContext *context,
gboolean is_remote_fs,
+ gboolean do_start,
GError **error);
void g_local_file_monitor_start (GLocalFileMonitor *local_monitor);
+/* Actually in glocalfile.c */
+GLocalFileMonitor * g_local_file_monitor_new_in_worker (const char *pathname,
+ GFileMonitorFlags flags,
+ GError **error);
+
G_END_DECLS
#endif /* __G_LOCAL_FILE_MONITOR_H__ */