From 51d7fc9e965c64da40597d007756d330b5e3cc5f Mon Sep 17 00:00:00 2001 From: David Zeuthen Date: Fri, 14 Mar 2008 11:18:59 +0000 Subject: [PATCH] Add g_unix_mount_monitor_set_rate_limit() function (#521946) 2008-03-12 David Zeuthen * gio.symbols: * gunixmounts.[ch]: Add g_unix_mount_monitor_set_rate_limit() function (#521946) svn path=/trunk/; revision=6711 --- gio/ChangeLog | 6 ++++++ gio/gio.symbols | 1 + gio/gunixmounts.c | 29 ++++++++++++++++++++++++++++- gio/gunixmounts.h | 6 ++++-- 4 files changed, 39 insertions(+), 3 deletions(-) diff --git a/gio/ChangeLog b/gio/ChangeLog index d566ed7ac..8c0010871 100644 --- a/gio/ChangeLog +++ b/gio/ChangeLog @@ -1,3 +1,9 @@ +2008-03-12 David Zeuthen + + * gio.symbols: + * gunixmounts.[ch]: + Add g_unix_mount_monitor_set_rate_limit() function (#521946) + 2008-03-14 Alexander Larsson * gunixmounts.c: diff --git a/gio/gio.symbols b/gio/gio.symbols index c8de929de..9f8de2fce 100644 --- a/gio/gio.symbols +++ b/gio/gio.symbols @@ -665,6 +665,7 @@ g_unix_mounts_changed_since g_unix_mount_points_changed_since g_unix_mount_monitor_get_type G_GNUC_CONST g_unix_mount_monitor_new +g_unix_mount_monitor_set_rate_limit g_unix_is_mount_path_system_internal #endif /* G_OS_UNIX */ #endif diff --git a/gio/gunixmounts.c b/gio/gunixmounts.c index cc7090d5c..c04cd47e2 100644 --- a/gio/gunixmounts.c +++ b/gio/gunixmounts.c @@ -1230,10 +1230,37 @@ g_unix_mount_monitor_init (GUnixMountMonitor *monitor) } } +/** + * g_unix_mount_monitor_set_rate_limit: + * @mount_monitor: a #GUnixMountMonitor. + * @limit_msecs: a integer with the limit in milliseconds to + * poll for changes. + * + * Sets the rate limit to which the @mount_monitor will report + * consecutive change events to the mount and mount point entry files. + * + * Since: 2.18 + **/ +void +g_unix_mount_monitor_set_rate_limit (GUnixMountMonitor *mount_monitor, + int limit_msec) +{ + g_return_if_fail (G_IS_UNIX_MOUNT_MONITOR (mount_monitor)); + + if (mount_monitor->fstab_monitor != NULL) + g_file_monitor_set_rate_limit (mount_monitor->fstab_monitor, limit_msec); + + if (mount_monitor->mtab_monitor != NULL) + g_file_monitor_set_rate_limit (mount_monitor->mtab_monitor, limit_msec); +} + /** * g_unix_mount_monitor_new: * - * Gets a new #GUnixMountMonitor. + * Gets a new #GUnixMountMonitor. The default rate limit for which the + * monitor will report consecutive changes for the mount and mount + * point entry files is the default for a #GFileMonitor. Use + * g_unix_mount_monitor_set_rate_limit() to change this. * * Returns: a #GUnixMountMonitor. **/ diff --git a/gio/gunixmounts.h b/gio/gunixmounts.h index 6147f122a..e5ca86bbd 100644 --- a/gio/gunixmounts.h +++ b/gio/gunixmounts.h @@ -90,8 +90,10 @@ GUnixMountEntry *g_unix_mount_at (const char *mount_p gboolean g_unix_mounts_changed_since (guint64 time); gboolean g_unix_mount_points_changed_since (guint64 time); -GType g_unix_mount_monitor_get_type (void) G_GNUC_CONST; -GUnixMountMonitor *g_unix_mount_monitor_new (void); +GType g_unix_mount_monitor_get_type (void) G_GNUC_CONST; +GUnixMountMonitor *g_unix_mount_monitor_new (void); +void g_unix_mount_monitor_set_rate_limit (GUnixMountMonitor *mount_monitor, + int limit_msec); gboolean g_unix_is_mount_path_system_internal (const char *mount_path);