[gnome-settings-daemon] xsettings: Remove update timeout



commit 578524da528e554fddfa6cf070554984c0ebfcfd
Author: Behdad Esfahbod <behdad behdad org>
Date:   Sun May 3 10:37:17 2015 -0400

    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

 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 5647a2d..3a17ee9 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;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]