PolicyKit: Branch 'master'

David Zeuthen david at kemper.freedesktop.org
Tue Jan 27 14:27:01 PST 2009


 src/polkitbackend/polkitbackendactionpool.c |   32 +++++++++++++++++++++++-----
 1 file changed, 27 insertions(+), 5 deletions(-)

New commits:
commit 50e46f80aea70a3bd8cfa21917888c9a0a4f1ae2
Author: David Zeuthen <davidz at redhat.com>
Date:   Tue Jan 27 17:24:41 2009 -0500

    limit Change() signal storm by looking at the file monitor event

diff --git a/src/polkitbackend/polkitbackendactionpool.c b/src/polkitbackend/polkitbackendactionpool.c
index b63e046..d3d0908 100644
--- a/src/polkitbackend/polkitbackendactionpool.c
+++ b/src/polkitbackend/polkitbackendactionpool.c
@@ -200,12 +200,34 @@ dir_monitor_changed (GFileMonitor     *monitor,
    *       Because when editing a file with emacs we get 4-8 events..
    */
 
-  /* now throw away all caches */
-  g_hash_table_remove_all (priv->parsed_files);
-  g_hash_table_remove_all (priv->parsed_actions);
-  priv->has_loaded_all_files = FALSE;
+  if (file != NULL)
+    {
+      gchar *name;
+
+      name = g_file_get_basename (file);
+
+      //g_debug ("event_type=%d file=%p name=%s", event_type, file, name);
+
+      if (!g_str_has_prefix (name, ".") &&
+          !g_str_has_prefix (name, "#") &&
+          g_str_has_suffix (name, ".policy") &&
+          (event_type == G_FILE_MONITOR_EVENT_CREATED ||
+           event_type == G_FILE_MONITOR_EVENT_DELETED ||
+           event_type == G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT))
+        {
 
-  g_signal_emit_by_name (pool, "changed");
+          //g_debug ("match");
+
+          /* now throw away all caches */
+          g_hash_table_remove_all (priv->parsed_files);
+          g_hash_table_remove_all (priv->parsed_actions);
+          priv->has_loaded_all_files = FALSE;
+
+          g_signal_emit_by_name (pool, "changed");
+        }
+
+      g_free (name);
+    }
 }
 
 


More information about the hal-commit mailing list