PolicyKit: Branch 'master'

David Zeuthen david at kemper.freedesktop.org
Mon Nov 19 21:25:47 PST 2007


 src/polkit/polkit-context.c |   52 ++++++++++++++++++++++++++++++--------------
 src/polkit/polkit-context.h |    2 +
 2 files changed, 38 insertions(+), 16 deletions(-)

New commits:
commit b69598928d7231a4768368a12e53b972b1002abe
Author: David Zeuthen <davidz at redhat.com>
Date:   Tue Nov 20 00:25:34 2007 -0500

    provide a way to force a reload of all caches etc.

diff --git a/src/polkit/polkit-context.c b/src/polkit/polkit-context.c
index 88685bf..6414db2 100644
--- a/src/polkit/polkit-context.c
+++ b/src/polkit/polkit-context.c
@@ -325,23 +325,8 @@ again:
         }
 
         if (config_changed) {
-                /* purge existing policy files */
-                _pk_debug ("purging policy files");
-                if (pk_context->priv_cache != NULL) {
-                        polkit_policy_cache_unref (pk_context->priv_cache);
-                        pk_context->priv_cache = NULL;
-                }
-                
-                /* Purge existing old config file */
-                _pk_debug ("purging configuration file");
-                if (pk_context->config != NULL) {
-                        polkit_config_unref (pk_context->config);
-                        pk_context->config = NULL;
-                }
+                polkit_context_force_reload (pk_context);
 
-                /* Purge authorization entries from the cache */
-                _polkit_authorization_db_invalidate_cache (pk_context->authdb);
-                
                 if (pk_context->config_changed_cb != NULL) {
                         pk_context->config_changed_cb (pk_context, 
                                                        pk_context->config_changed_user_data);
@@ -350,6 +335,41 @@ again:
 }
 
 /**
+ * polkit_context_force_reload:
+ * @pk_context: context
+ *
+ * Force a reload. 
+ *
+ * Note that there is no reason to call this method in response to a
+ * config changed callback.
+ *
+ * Since: 0.7 
+ */
+void
+polkit_context_force_reload (PolKitContext *pk_context)
+{
+        kit_return_if_fail (pk_context != NULL);
+
+        /* purge existing policy files */
+        _pk_debug ("purging policy files");
+        if (pk_context->priv_cache != NULL) {
+                polkit_policy_cache_unref (pk_context->priv_cache);
+                pk_context->priv_cache = NULL;
+        }
+        
+        /* Purge existing old config file */
+        _pk_debug ("purging configuration file");
+        if (pk_context->config != NULL) {
+                polkit_config_unref (pk_context->config);
+                pk_context->config = NULL;
+        }
+        
+        /* Purge authorization entries from the cache */
+        _polkit_authorization_db_invalidate_cache (pk_context->authdb);
+}
+
+
+/**
  * polkit_context_set_io_watch_functions:
  * @pk_context: the context object
  * @io_add_watch_func: the function that the PolicyKit library can invoke to start watching a file descriptor
diff --git a/src/polkit/polkit-context.h b/src/polkit/polkit-context.h
index 72e4ad8..c4a6332 100644
--- a/src/polkit/polkit-context.h
+++ b/src/polkit/polkit-context.h
@@ -154,6 +154,8 @@ polkit_bool_t  polkit_context_init                   (PolKitContext
 PolKitContext *polkit_context_ref                    (PolKitContext                        *pk_context);
 void           polkit_context_unref                  (PolKitContext                        *pk_context);
 
+void           polkit_context_force_reload           (PolKitContext                        *pk_context);
+
 void           polkit_context_io_func                (PolKitContext *pk_context, int fd);
 
 PolKitPolicyCache *polkit_context_get_policy_cache   (PolKitContext *pk_context);


More information about the hal-commit mailing list