diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2015-05-03 10:37:17 -0400 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2015-05-06 11:46:54 +0200 |
commit | 578524da528e554fddfa6cf070554984c0ebfcfd (patch) | |
tree | cfae65883658c276b71a41c99f3c698f0880d3c4 | |
parent | b98655a1d5f52c9c786b40fac31d5dc9d2f55e06 (diff) | |
download | gnome-settings-daemon-578524da528e554fddfa6cf070554984c0ebfcfd.tar.gz |
xsettings: Remove update timeout
GIO's GFileMonitor already delays directory monitor notifications, so
directory-level changes will already be coalesced even if there's a
lot of changes happening.
Monitoring files (which happens for the XML config files) are signalled
immediately now.
https://bugzilla.gnome.org/show_bug.cgi?id=748776
-rw-r--r-- | plugins/xsettings/fontconfig-monitor.c | 37 |
1 files changed, 7 insertions, 30 deletions
diff --git a/plugins/xsettings/fontconfig-monitor.c b/plugins/xsettings/fontconfig-monitor.c index 5647a2dc..3a17ee96 100644 --- a/plugins/xsettings/fontconfig-monitor.c +++ b/plugins/xsettings/fontconfig-monitor.c @@ -23,8 +23,6 @@ #include <gio/gio.h> #include <fontconfig/fontconfig.h> -#define TIMEOUT_MILLISECONDS 200 - static void stuff_changed (GFileMonitor *monitor, GFile *file, @@ -76,8 +74,6 @@ monitor_files (GPtrArray *monitors, struct _fontconfig_monitor_handle { GPtrArray *monitors; - guint timeout; - GFunc notify_callback; gpointer notify_data; }; @@ -103,13 +99,16 @@ monitors_free (GPtrArray *monitors) g_ptr_array_free (monitors, TRUE); } -static gboolean -update (gpointer data) +static void +stuff_changed (GFileMonitor *monitor G_GNUC_UNUSED, + GFile *file G_GNUC_UNUSED, + GFile *other_file G_GNUC_UNUSED, + GFileMonitorEvent event_type G_GNUC_UNUSED, + gpointer data) { fontconfig_monitor_handle_t *handle = data; - gboolean notify = FALSE; - handle->timeout = 0; + gboolean notify = FALSE; if (fontconfig_cache_update ()) { notify = TRUE; @@ -126,24 +125,6 @@ update (gpointer data) return FALSE; } -static void -stuff_changed (GFileMonitor *monitor G_GNUC_UNUSED, - GFile *file G_GNUC_UNUSED, - GFile *other_file G_GNUC_UNUSED, - GFileMonitorEvent event_type G_GNUC_UNUSED, - gpointer data) -{ - fontconfig_monitor_handle_t *handle = data; - - /* wait for quiescence */ - if (handle->timeout) - g_source_remove (handle->timeout); - - handle->timeout = g_timeout_add (TIMEOUT_MILLISECONDS, update, data); - g_source_set_name_by_id (handle->timeout, "[gnome-settings-daemon] update"); -} - - fontconfig_monitor_handle_t * fontconfig_monitor_start (GFunc notify_callback, gpointer notify_data) @@ -160,10 +141,6 @@ fontconfig_monitor_start (GFunc notify_callback, void fontconfig_monitor_stop (fontconfig_monitor_handle_t *handle) { - if (handle->timeout) - g_source_remove (handle->timeout); - handle->timeout = 0; - monitors_free (handle->monitors); handle->monitors = NULL; } |