Merge branch 'wip/oholy/nfs-poll-monitor' into 'master'

glocalfilemonitor: Fallback to poll file monitor for NFS

See merge request GNOME/glib!219
This commit is contained in:
Philip Withnall 2018-08-31 10:51:25 +00:00
commit 7427bb7184

View File

@ -834,6 +834,7 @@ static void g_local_file_monitor_class_init (GLocalFileMonitorClass *class)
static GLocalFileMonitor * static GLocalFileMonitor *
g_local_file_monitor_new (gboolean is_remote_fs, g_local_file_monitor_new (gboolean is_remote_fs,
gboolean is_directory,
GError **error) GError **error)
{ {
GType type = G_TYPE_INVALID; GType type = G_TYPE_INVALID;
@ -843,7 +844,8 @@ g_local_file_monitor_new (gboolean is_remote_fs,
"GIO_USE_FILE_MONITOR", "GIO_USE_FILE_MONITOR",
G_STRUCT_OFFSET (GLocalFileMonitorClass, is_supported)); G_STRUCT_OFFSET (GLocalFileMonitorClass, is_supported));
if (type == G_TYPE_INVALID) /* Fallback rather to poll file monitor for remote files, see gfile.c. */
if (type == G_TYPE_INVALID && (!is_remote_fs || is_directory))
type = _g_io_module_get_default_type (G_LOCAL_FILE_MONITOR_EXTENSION_POINT_NAME, type = _g_io_module_get_default_type (G_LOCAL_FILE_MONITOR_EXTENSION_POINT_NAME,
"GIO_USE_FILE_MONITOR", "GIO_USE_FILE_MONITOR",
G_STRUCT_OFFSET (GLocalFileMonitorClass, is_supported)); G_STRUCT_OFFSET (GLocalFileMonitorClass, is_supported));
@ -869,7 +871,7 @@ g_local_file_monitor_new_for_path (const gchar *pathname,
is_remote_fs = g_local_file_is_remote (pathname); is_remote_fs = g_local_file_is_remote (pathname);
monitor = g_local_file_monitor_new (is_remote_fs, error); monitor = g_local_file_monitor_new (is_remote_fs, is_directory, error);
if (monitor) if (monitor)
g_local_file_monitor_start (monitor, pathname, is_directory, flags, g_main_context_get_thread_default ()); g_local_file_monitor_start (monitor, pathname, is_directory, flags, g_main_context_get_thread_default ());
@ -890,7 +892,7 @@ g_local_file_monitor_new_in_worker (const gchar *pathname,
is_remote_fs = g_local_file_is_remote (pathname); is_remote_fs = g_local_file_is_remote (pathname);
monitor = g_local_file_monitor_new (is_remote_fs, error); monitor = g_local_file_monitor_new (is_remote_fs, is_directory, error);
if (monitor) if (monitor)
{ {