PolicyKit: Branch 'master' - 12 commits

David Zeuthen david at kemper.freedesktop.org
Fri Aug 6 10:28:19 PDT 2010


 README                                                                           |    3 
 configure.ac                                                                     |    6 
 docs/polkit/Makefile.am                                                          |    4 
 docs/polkit/docbook-interface-org.freedesktop.PolicyKit1.AuthenticationAgent.xml |  116 
 docs/polkit/docbook-interface-org.freedesktop.PolicyKit1.Authority.xml           |  848 ++++++
 docs/polkit/polkit-1-docs.xml                                                    |    4 
 docs/polkit/polkit-1-sections.txt                                                |   16 
 src/examples/cancel.c                                                            |   18 
 src/polkit/Makefile.am                                                           |   38 
 src/polkit/polkitactiondescription.c                                             |  181 -
 src/polkit/polkitauthority.c                                                     | 1365 +++-------
 src/polkit/polkitauthority.h                                                     |   31 
 src/polkit/polkitauthorizationresult.c                                           |  118 
 src/polkit/polkitauthorizationresult.h                                           |    1 
 src/polkit/polkitdetails.c                                                       |   49 
 src/polkit/polkiterror.c                                                         |   17 
 src/polkit/polkitidentity.c                                                      |  168 -
 src/polkit/polkitprivate.h                                                       |   43 
 src/polkit/polkitsubject.c                                                       |  223 +
 src/polkit/polkitsystembusname.c                                                 |  190 -
 src/polkit/polkittemporaryauthorization.c                                        |  111 
 src/polkit/polkitunixsession.c                                                   |  305 --
 src/polkitagent/Makefile.am                                                      |    4 
 src/polkitagent/polkitagentlistener.c                                            |  415 +--
 src/polkitbackend/Makefile.am                                                    |   25 
 src/polkitbackend/org.freedesktop.ConsoleKit.xml                                 |  278 --
 src/polkitbackend/polkitbackendactionpool.c                                      |   38 
 src/polkitbackend/polkitbackendauthority.c                                       | 1127 +++-----
 src/polkitbackend/polkitbackendauthority.h                                       |   62 
 src/polkitbackend/polkitbackendinteractiveauthority.c                            |  276 +-
 src/polkitbackend/polkitbackendlocalauthority.c                                  |  500 ---
 src/polkitbackend/polkitbackendprivate.h                                         |    2 
 src/polkitbackend/polkitbackendsessionmonitor.c                                  |  559 +---
 src/polkitd/Makefile.am                                                          |    3 
 src/polkitd/gposixsignal.c                                                       |  128 
 src/polkitd/gposixsignal.h                                                       |   42 
 src/polkitd/main.c                                                               |  135 
 37 files changed, 3654 insertions(+), 3795 deletions(-)

New commits:
commit 85f6ffbbdb00ef434340e85ce57c0e7b48184c08
Merge: 7d502f4... 90c0429...
Author: David Zeuthen <davidz at redhat.com>
Date:   Fri Aug 6 13:25:37 2010 -0400

    Merge remote branch 'origin/gdbus'

commit 7d502f49ce666e2c7f25ec5e311eb2c1297d06af
Author: David Zeuthen <davidz at redhat.com>
Date:   Fri Aug 6 13:24:43 2010 -0400

    Update README
    
    Signed-off-by: David Zeuthen <davidz at redhat.com>

diff --git a/README b/README
index e69de29..1fd906b 100644
--- a/README
+++ b/README
@@ -0,0 +1,3 @@
+PolicyKit is a toolkit for defining and handling authorizations.  It
+is used for allowing unprivileged processes to speak to privileged
+processes.
commit 90c0429f668be1cb675da26eba0ef505e6e3f123
Author: David Zeuthen <davidz at redhat.com>
Date:   Tue Aug 3 16:37:49 2010 -0400

    Make NameOwnerChanged a private impl detail of the interactive authority
    
    There's no need to expose this as public API.
    
    Signed-off-by: David Zeuthen <davidz at redhat.com>

diff --git a/docs/polkit/polkit-1-sections.txt b/docs/polkit/polkit-1-sections.txt
index b1b71cc..5826e54 100644
--- a/docs/polkit/polkit-1-sections.txt
+++ b/docs/polkit/polkit-1-sections.txt
@@ -278,7 +278,6 @@ polkit_backend_authority_register_authentication_agent
 polkit_backend_authority_unregister_authentication_agent
 polkit_backend_authority_authentication_agent_response
 polkit_backend_authority_enumerate_actions
-polkit_backend_authority_system_bus_name_owner_changed
 polkit_backend_authority_enumerate_temporary_authorizations
 polkit_backend_authority_revoke_temporary_authorizations
 polkit_backend_authority_get
diff --git a/src/polkitbackend/polkitbackendauthority.c b/src/polkitbackend/polkitbackendauthority.c
index 28a77ba..9dc8943 100644
--- a/src/polkitbackend/polkitbackendauthority.c
+++ b/src/polkitbackend/polkitbackendauthority.c
@@ -81,20 +81,6 @@ polkit_backend_authority_class_init (PolkitBackendAuthorityClass *klass)
                                           0);
 }
 
-void
-polkit_backend_authority_system_bus_name_owner_changed (PolkitBackendAuthority   *authority,
-                                                        const gchar              *name,
-                                                        const gchar              *old_owner,
-                                                        const gchar              *new_owner)
-{
-  PolkitBackendAuthorityClass *klass;
-
-  klass = POLKIT_BACKEND_AUTHORITY_GET_CLASS (authority);
-
-  if (klass->system_bus_name_owner_changed != NULL)
-    klass->system_bus_name_owner_changed (authority, name, old_owner, new_owner);
-}
-
 /**
  * polkit_backend_authority_get_name:
  * @authority: A #PolkitBackendAuthority.
@@ -503,7 +489,6 @@ polkit_backend_authority_revoke_temporary_authorization_by_id (PolkitBackendAuth
 typedef struct
 {
   guint authority_registration_id;
-  guint name_owner_changed_signal_id;
 
   GDBusNodeInfo *introspection_info;
 
@@ -523,14 +508,9 @@ server_free (Server *server)
 {
   g_free (server->object_path);
 
-  //g_signal_handler_disconnect (server->bus, server->name_owner_changed_id);
-
   if (server->authority_registration_id > 0)
     g_dbus_connection_unregister_object (server->connection, server->authority_registration_id);
 
-  if (server->name_owner_changed_signal_id > 0)
-    g_dbus_connection_signal_unsubscribe (server->connection, server->name_owner_changed_signal_id);
-
   if (server->connection != NULL)
     g_object_unref (server->connection);
 
@@ -1221,34 +1201,6 @@ server_handle_get_property (GDBusConnection  *connection,
 
 /* ---------------------------------------------------------------------------------------------------- */
 
-static void
-server_on_name_owner_changed_signal (GDBusConnection *connection,
-                                     const gchar     *sender_name,
-                                     const gchar     *object_path,
-                                     const gchar     *interface_name,
-                                     const gchar     *signal_name,
-                                     GVariant        *parameters,
-                                     gpointer         user_data)
-{
-  Server *server = user_data;
-  const gchar *name;
-  const gchar *old_owner;
-  const gchar *new_owner;
-
-  g_variant_get (parameters,
-                 "(&s&s&s)",
-                 &name,
-                 &old_owner,
-                 &new_owner);
-
-  polkit_backend_authority_system_bus_name_owner_changed (server->authority,
-                                                          name,
-                                                          old_owner,
-                                                          new_owner);
-}
-
-/* ---------------------------------------------------------------------------------------------------- */
-
 static const GDBusInterfaceVTable server_vtable =
 {
   server_handle_method_call,
@@ -1311,18 +1263,6 @@ polkit_backend_authority_register (PolkitBackendAuthority   *authority,
       goto error;
     }
 
-  server->name_owner_changed_signal_id =
-    g_dbus_connection_signal_subscribe (server->connection,
-                                        "org.freedesktop.DBus",   /* sender */
-                                        "org.freedesktop.DBus",   /* interface */
-                                        "NameOwnerChanged",       /* member */
-                                        "/org/freedesktop/DBus",  /* path */
-                                        NULL,                     /* arg0 */
-                                        G_DBUS_SIGNAL_FLAGS_NONE,
-                                        server_on_name_owner_changed_signal,
-                                        server,
-                                        NULL); /* GDestroyNotify */
-
   server->authority = g_object_ref (authority);
 
   server->authority_changed_id = g_signal_connect (server->authority,
diff --git a/src/polkitbackend/polkitbackendauthority.h b/src/polkitbackend/polkitbackendauthority.h
index e6a8104..e9879a7 100644
--- a/src/polkitbackend/polkitbackendauthority.h
+++ b/src/polkitbackend/polkitbackendauthority.h
@@ -98,7 +98,6 @@ struct _PolkitBackendAuthority
  * authorization identified by id or %NULL if the backend doesn't support
  * the operation. See polkit_backend_authority_revoke_temporary_authorization_by_id()
  * for details.
- * @system_bus_name_owner_changed: temporary VFunc, to be removed before API is declared stable.
  *
  * VFuncs that authority backends need to implement.
  */
@@ -169,12 +168,6 @@ struct _PolkitBackendAuthorityClass
                                                     const gchar              *id,
                                                     GError                  **error);
 
-  /* TODO: need something more efficient such that we don't watch all name changes */
-  void (*system_bus_name_owner_changed)  (PolkitBackendAuthority   *authority,
-                                          const gchar              *name,
-                                          const gchar              *old_owner,
-                                          const gchar              *new_owner);
-
   /*< private >*/
   /* Padding for future expansion */
   void (*_polkit_reserved1) (void);
@@ -223,11 +216,6 @@ void     polkit_backend_authority_log (PolkitBackendAuthority *authority,
                                        const gchar *format,
                                        ...);
 
-void     polkit_backend_authority_system_bus_name_owner_changed (PolkitBackendAuthority   *authority,
-                                                                 const gchar              *name,
-                                                                 const gchar              *old_owner,
-                                                                 const gchar              *new_owner);
-
 GList   *polkit_backend_authority_enumerate_actions         (PolkitBackendAuthority    *authority,
                                                              PolkitSubject             *caller,
                                                              const gchar               *locale,
diff --git a/src/polkitbackend/polkitbackendinteractiveauthority.c b/src/polkitbackend/polkitbackendinteractiveauthority.c
index c4f993f..ab783b4 100644
--- a/src/polkitbackend/polkitbackendinteractiveauthority.c
+++ b/src/polkitbackend/polkitbackendinteractiveauthority.c
@@ -115,10 +115,10 @@ static void authentication_session_cancel (AuthenticationSession *session);
 
 /* ---------------------------------------------------------------------------------------------------- */
 
-static void polkit_backend_interactive_authority_system_bus_name_owner_changed (PolkitBackendAuthority   *authority,
-                                                                          const gchar              *name,
-                                                                          const gchar              *old_owner,
-                                                                          const gchar              *new_owner);
+static void polkit_backend_interactive_authority_system_bus_name_owner_changed (PolkitBackendInteractiveAuthority   *authority,
+                                                                                const gchar              *name,
+                                                                                const gchar              *old_owner,
+                                                                                const gchar              *new_owner);
 
 static GList *polkit_backend_interactive_authority_enumerate_actions  (PolkitBackendAuthority   *authority,
                                                                  PolkitSubject            *caller,
@@ -197,6 +197,8 @@ typedef struct
 
   GHashTable *hash_session_to_authentication_agent;
 
+  GDBusConnection *system_bus_connection;
+  guint name_owner_changed_signal_id;
 } PolkitBackendInteractiveAuthorityPrivate;
 
 /* ---------------------------------------------------------------------------------------------------- */
@@ -216,6 +218,35 @@ action_pool_changed (PolkitBackendActionPool *action_pool,
   g_signal_emit_by_name (authority, "changed");
 }
 
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+static void
+on_name_owner_changed_signal (GDBusConnection *connection,
+                              const gchar     *sender_name,
+                              const gchar     *object_path,
+                              const gchar     *interface_name,
+                              const gchar     *signal_name,
+                              GVariant        *parameters,
+                              gpointer         user_data)
+{
+  PolkitBackendInteractiveAuthority *authority = POLKIT_BACKEND_INTERACTIVE_AUTHORITY (user_data);
+  const gchar *name;
+  const gchar *old_owner;
+  const gchar *new_owner;
+
+  g_variant_get (parameters,
+                 "(&s&s&s)",
+                 &name,
+                 &old_owner,
+                 &new_owner);
+
+  polkit_backend_interactive_authority_system_bus_name_owner_changed (authority,
+                                                                      name,
+                                                                      old_owner,
+                                                                      new_owner);
+}
+
 /* ---------------------------------------------------------------------------------------------------- */
 
 static void
@@ -231,6 +262,7 @@ polkit_backend_interactive_authority_init (PolkitBackendInteractiveAuthority *au
 {
   PolkitBackendInteractiveAuthorityPrivate *priv;
   GFile *directory;
+  GError *error;
 
   priv = POLKIT_BACKEND_INTERACTIVE_AUTHORITY_GET_PRIVATE (authority);
 
@@ -254,6 +286,29 @@ polkit_backend_interactive_authority_init (PolkitBackendInteractiveAuthority *au
                     "changed",
                     G_CALLBACK (on_session_monitor_changed),
                     authority);
+
+  error = NULL;
+  priv->system_bus_connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
+  if (priv->system_bus_connection == NULL)
+    {
+      g_warning ("Error getting system bus: %s", error->message);
+      g_error_free (error);
+    }
+  else
+    {
+      /* TODO: this is a bit inefficient */
+      priv->name_owner_changed_signal_id =
+        g_dbus_connection_signal_subscribe (priv->system_bus_connection,
+                                            "org.freedesktop.DBus",   /* sender */
+                                            "org.freedesktop.DBus",   /* interface */
+                                            "NameOwnerChanged",       /* member */
+                                            "/org/freedesktop/DBus",  /* path */
+                                            NULL,                     /* arg0 */
+                                            G_DBUS_SIGNAL_FLAGS_NONE,
+                                            on_name_owner_changed_signal,
+                                            authority,
+                                            NULL); /* GDestroyNotify */
+    }
 }
 
 static void
@@ -265,6 +320,12 @@ polkit_backend_interactive_authority_finalize (GObject *object)
   interactive_authority = POLKIT_BACKEND_INTERACTIVE_AUTHORITY (object);
   priv = POLKIT_BACKEND_INTERACTIVE_AUTHORITY_GET_PRIVATE (interactive_authority);
 
+  if (priv->name_owner_changed_signal_id > 0)
+    g_dbus_connection_signal_unsubscribe (priv->system_bus_connection, priv->name_owner_changed_signal_id);
+
+  if (priv->system_bus_connection != NULL)
+    g_object_unref (priv->system_bus_connection);
+
   if (priv->action_pool != NULL)
     g_object_unref (priv->action_pool);
 
@@ -310,7 +371,6 @@ polkit_backend_interactive_authority_class_init (PolkitBackendInteractiveAuthori
   authority_class->get_name                        = polkit_backend_interactive_authority_get_name;
   authority_class->get_version                     = polkit_backend_interactive_authority_get_version;
   authority_class->get_features                    = polkit_backend_interactive_authority_get_features;
-  authority_class->system_bus_name_owner_changed   = polkit_backend_interactive_authority_system_bus_name_owner_changed;
   authority_class->enumerate_actions               = polkit_backend_interactive_authority_enumerate_actions;
   authority_class->check_authorization             = polkit_backend_interactive_authority_check_authorization;
   authority_class->check_authorization_finish      = polkit_backend_interactive_authority_check_authorization_finish;
@@ -2122,10 +2182,10 @@ polkit_backend_interactive_authority_authentication_agent_response (PolkitBacken
 /* ---------------------------------------------------------------------------------------------------- */
 
 static void
-polkit_backend_interactive_authority_system_bus_name_owner_changed (PolkitBackendAuthority   *authority,
-                                                              const gchar              *name,
-                                                              const gchar              *old_owner,
-                                                              const gchar              *new_owner)
+polkit_backend_interactive_authority_system_bus_name_owner_changed (PolkitBackendInteractiveAuthority *authority,
+                                                                    const gchar                       *name,
+                                                                    const gchar                       *old_owner,
+                                                                    const gchar                       *new_owner)
 {
   PolkitBackendInteractiveAuthority *interactive_authority;
   PolkitBackendInteractiveAuthorityPrivate *priv;
commit 7491b69e86cf7cb813c956307a96f246b386b16c
Author: David Zeuthen <davidz at redhat.com>
Date:   Tue Aug 3 14:10:12 2010 -0400

    Remove Lock Down functionality
    
    This is better implemented as a separate set of extension to the local
    authority. The only current known user, PolkitLockButton, will be
    ported away from using these interfaces.
    
    Since polkit still hasn't reached 1.0 this removal of functionality is
    OK especially since the NEWS file has already wanred something like
    this may happen.
    
    Signed-off-by: David Zeuthen <davidz at redhat.com>

diff --git a/docs/polkit/docbook-interface-org.freedesktop.PolicyKit1.Authority.xml b/docs/polkit/docbook-interface-org.freedesktop.PolicyKit1.Authority.xml
index 8b76fa2..cb9da6b 100644
--- a/docs/polkit/docbook-interface-org.freedesktop.PolicyKit1.Authority.xml
+++ b/docs/polkit/docbook-interface-org.freedesktop.PolicyKit1.Authority.xml
@@ -42,8 +42,6 @@ Structure    <link linkend="eggdbus-struct-TemporaryAuthorization">TemporaryAuth
                                   OUT Array&lt;<link linkend="eggdbus-struct-TemporaryAuthorization">TemporaryAuthorization</link>&gt;  temporary_authorizations)
 <link linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.RevokeTemporaryAuthorizations">RevokeTemporaryAuthorizations</link>    (IN  <link linkend="eggdbus-struct-Subject">Subject</link>                        subject)
 <link linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.RevokeTemporaryAuthorizationById">RevokeTemporaryAuthorizationById</link> (IN  String                         id)
-<link linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.AddLockdownForAction">AddLockdownForAction</link>             (IN  String                         action_id)
-<link linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.RemoveLockdownForAction">RemoveLockdownForAction</link>          (IN  String                         action_id)
     </synopsis>
   </refsynopsisdiv>
   <refsect1 role="signal_proto" id="eggdbus-if-signals-org.freedesktop.PolicyKit1.Authority">
@@ -232,8 +230,7 @@ The passed <parameter>cancellation_id</parameter> is already in use.
           <programlisting>
 {
   None                   = 0x00000000,
-  TemporaryAuthorization = 0x00000001,
-  Lockdown               = 0x00000002
+  TemporaryAuthorization = 0x00000001
 }
           </programlisting>
           <para>
@@ -256,14 +253,6 @@ The authority supports temporary authorizations that can be obtained through aut
       </para>
     </listitem>
   </varlistentry>
-  <varlistentry id="eggdbus-constant-AuthorityFeatures.Lockdown" role="constant">
-    <term><literal>Lockdown</literal></term>
-    <listitem>
-      <para>
-The authority supports the <link linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.AddLockdownForAction">AddLockdownForAction()</link> and <link linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.RemoveLockdownForAction">RemoveLockdownForAction()</link> methods.
-      </para>
-    </listitem>
-  </varlistentry>
           </variablelist>
         </para>
     </refsect2>
@@ -472,7 +461,7 @@ TRUE if the given <link linkend="eggdbus-struct-Subject">Subject</link> could be
     <term><literal>Dict&lt;String,String&gt; <structfield>details</structfield></literal></term>
     <listitem>
       <para>
-Details for the result or empty if not authorized. Known key/value-pairs include <literal>polkit.temporary_authorization_id</literal> (if the authorization is temporary, this is set to the opaque temporary authorization id), <literal>polkit.retains_authorization_after_challenge</literal> (Set to a non-empty string if the authorization will be retained after authentication (if is_challenge is TRUE)) and <literal>polkit.lockdown</literal> (set to a non-empty string if the action is locked down).
+Details for the result or empty if not authorized. Known key/value-pairs include <literal>polkit.temporary_authorization_id</literal> (if the authorization is temporary, this is set to the opaque temporary authorization id), <literal>polkit.retains_authorization_after_challenge</literal> (Set to a non-empty string if the authorization will be retained after authentication (if is_challenge is TRUE)).
       </para>
     </listitem>
   </varlistentry>
@@ -811,44 +800,6 @@ The opaque identifier of the temporary authorization.
   </varlistentry>
 </variablelist>
     </refsect2>
-    <refsect2 role="function" id="eggdbus-method-org.freedesktop.PolicyKit1.Authority.AddLockdownForAction">
-      <title>AddLockdownForAction ()</title>
-    <programlisting>
-AddLockdownForAction (IN  String  action_id)
-    </programlisting>
-    <para>
-Locks down an action so administrator authentication is always needed to obtain a temporary authorization for the action.
-    </para>
-<variablelist role="params">
-  <varlistentry>
-    <term><literal>IN  String <parameter>action_id</parameter></literal>:</term>
-    <listitem>
-      <para>
-Identifier for the action.
-      </para>
-    </listitem>
-  </varlistentry>
-</variablelist>
-    </refsect2>
-    <refsect2 role="function" id="eggdbus-method-org.freedesktop.PolicyKit1.Authority.RemoveLockdownForAction">
-      <title>RemoveLockdownForAction ()</title>
-    <programlisting>
-RemoveLockdownForAction (IN  String  action_id)
-    </programlisting>
-    <para>
-Removes the effect of a previous <link linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.AddLockdownForAction">AddLockdownForAction()</link> call.
-    </para>
-<variablelist role="params">
-  <varlistentry>
-    <term><literal>IN  String <parameter>action_id</parameter></literal>:</term>
-    <listitem>
-      <para>
-Identifier for the action.
-      </para>
-    </listitem>
-  </varlistentry>
-</variablelist>
-    </refsect2>
   </refsect1>
   <refsect1 role="signals" id="eggdbus-if-signal-details-org.freedesktop.PolicyKit1.Authority">
     <title role="signals.title">Signal Details</title>
diff --git a/docs/polkit/polkit-1-sections.txt b/docs/polkit/polkit-1-sections.txt
index 999abb2..b1b71cc 100644
--- a/docs/polkit/polkit-1-sections.txt
+++ b/docs/polkit/polkit-1-sections.txt
@@ -42,10 +42,6 @@ polkit_authority_revoke_temporary_authorizations
 polkit_authority_revoke_temporary_authorizations_finish
 polkit_authority_revoke_temporary_authorization_by_id
 polkit_authority_revoke_temporary_authorization_by_id_finish
-polkit_authority_add_lockdown_for_action
-polkit_authority_add_lockdown_for_action_finish
-polkit_authority_remove_lockdown_for_action
-polkit_authority_remove_lockdown_for_action_finish
 polkit_authority_check_authorization_sync
 polkit_authority_enumerate_actions_sync
 polkit_authority_register_authentication_agent_sync
@@ -54,8 +50,6 @@ polkit_authority_authentication_agent_response_sync
 polkit_authority_enumerate_temporary_authorizations_sync
 polkit_authority_revoke_temporary_authorizations_sync
 polkit_authority_revoke_temporary_authorization_by_id_sync
-polkit_authority_add_lockdown_for_action_sync
-polkit_authority_remove_lockdown_for_action_sync
 <SUBSECTION Standard>
 PolkitAuthorityClass
 POLKIT_AUTHORITY
@@ -75,7 +69,6 @@ polkit_authorization_result_get_is_authorized
 polkit_authorization_result_get_is_challenge
 polkit_authorization_result_get_retains_authorization
 polkit_authorization_result_get_temporary_authorization_id
-polkit_authorization_result_get_locked_down
 polkit_authorization_result_get_details
 <SUBSECTION Standard>
 PolkitAuthorizationResultClass
@@ -288,10 +281,6 @@ polkit_backend_authority_enumerate_actions
 polkit_backend_authority_system_bus_name_owner_changed
 polkit_backend_authority_enumerate_temporary_authorizations
 polkit_backend_authority_revoke_temporary_authorizations
-polkit_backend_authority_add_lockdown_for_action
-polkit_backend_authority_add_lockdown_for_action_finish
-polkit_backend_authority_remove_lockdown_for_action
-polkit_backend_authority_remove_lockdown_for_action_finish
 polkit_backend_authority_get
 polkit_backend_authority_register
 polkit_backend_authority_unregister
diff --git a/src/polkit/polkitauthority.c b/src/polkit/polkitauthority.c
index 8edbfa3..f16b29c 100644
--- a/src/polkit/polkitauthority.c
+++ b/src/polkit/polkitauthority.c
@@ -1383,206 +1383,6 @@ polkit_authority_revoke_temporary_authorization_by_id_sync (PolkitAuthority
 /* ---------------------------------------------------------------------------------------------------- */
 
 /**
- * polkit_authority_add_lockdown_for_action:
- * @authority: A #PolkitAuthority.
- * @action_id: The identifier for the action.
- * @cancellable: A #GCancellable or %NULL.
- * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
- * @user_data: The data to pass to @callback.
- *
- * Locks down the action identified by @action_id.
- *
- * When the operation is finished, @callback will be invoked. You can then
- * call polkit_authority_add_lockdown_for_action_finish() to get the result of
- * the operation.
- */
-void
-polkit_authority_add_lockdown_for_action (PolkitAuthority     *authority,
-                                          const gchar         *action_id,
-                                          GCancellable        *cancellable,
-                                          GAsyncReadyCallback  callback,
-                                          gpointer             user_data)
-{
-  g_dbus_proxy_call (authority->proxy,
-                     "AddLockdownForAction",
-                     g_variant_new ("(s)",
-                                    action_id),
-                     G_DBUS_CALL_FLAGS_NONE,
-                     -1,
-                     cancellable,
-                     generic_async_cb,
-                     g_simple_async_result_new (G_OBJECT (authority),
-                                                callback,
-                                                user_data,
-                                                polkit_authority_add_lockdown_for_action));
-}
-
-/**
- * polkit_authority_add_lockdown_for_action_finish:
- * @authority: A #PolkitAuthority.
- * @res: A #GAsyncResult obtained from the callback.
- * @error: Return location for error or %NULL.
- *
- * Finishes locking down an action.
- *
- * Returns: %TRUE if the action was locked down, %FALSE if error is set.
- **/
-gboolean
-polkit_authority_add_lockdown_for_action_finish (PolkitAuthority *authority,
-                                                 GAsyncResult    *res,
-                                                 GError         **error)
-{
-  gboolean ret;
-  GVariant *value;
-  GAsyncResult *_res;
-
-  ret = FALSE;
-
-  g_warn_if_fail (g_simple_async_result_get_source_tag (G_SIMPLE_ASYNC_RESULT (res)) == polkit_authority_add_lockdown_for_action);
-  _res = G_ASYNC_RESULT (g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res)));
-
-  value = g_dbus_proxy_call_finish (authority->proxy, _res, error);
-  if (value == NULL)
-    goto out;
-  ret = TRUE;
-  g_variant_unref (value);
-
- out:
-  return ret;
-}
-
-/**
- * polkit_authority_add_lockdown_for_action_sync:
- * @authority: A #PolkitAuthority.
- * @action_id: The identifier for the action.
- * @cancellable: A #GCancellable or %NULL.
- * @error: Return location for error or %NULL.
- *
- * Synchronously locks down an action.
- *
- * Returns: %TRUE if the action was locked down, %FALSE if error is set.
- **/
-gboolean
-polkit_authority_add_lockdown_for_action_sync (PolkitAuthority     *authority,
-                                               const gchar         *action_id,
-                                               GCancellable        *cancellable,
-                                               GError             **error)
-{
-  gboolean ret;
-  CallSyncData *data;
-
-  data = call_sync_new ();
-  polkit_authority_add_lockdown_for_action (authority, action_id, cancellable, call_sync_cb, data);
-  call_sync_block (data);
-  ret = polkit_authority_add_lockdown_for_action_finish (authority, data->res, error);
-  call_sync_free (data);
-
-  return ret;
-}
-
-/* ---------------------------------------------------------------------------------------------------- */
-
-/**
- * polkit_authority_remove_lockdown_for_action:
- * @authority: A #PolkitAuthority.
- * @action_id: The identifier for the action.
- * @cancellable: A #GCancellable or %NULL.
- * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
- * @user_data: The data to pass to @callback.
- *
- * Removes locks down the action identified by @action_id.
- *
- * When the operation is finished, @callback will be invoked. You can then
- * call polkit_authority_remove_lockdown_for_action_finish() to get the result of
- * the operation.
- */
-void
-polkit_authority_remove_lockdown_for_action (PolkitAuthority     *authority,
-                                             const gchar         *action_id,
-                                             GCancellable        *cancellable,
-                                             GAsyncReadyCallback  callback,
-                                             gpointer             user_data)
-{
-  g_dbus_proxy_call (authority->proxy,
-                     "RemoveLockdownForAction",
-                     g_variant_new ("(s)",
-                                    action_id),
-                     G_DBUS_CALL_FLAGS_NONE,
-                     -1,
-                     cancellable,
-                     generic_async_cb,
-                     g_simple_async_result_new (G_OBJECT (authority),
-                                                callback,
-                                                user_data,
-                                                polkit_authority_remove_lockdown_for_action));
-}
-
-/**
- * polkit_authority_remove_lockdown_for_action_finish:
- * @authority: A #PolkitAuthority.
- * @res: A #GAsyncResult obtained from the callback.
- * @error: Return location for error or %NULL.
- *
- * Finishes removing lock down for an action.
- *
- * Returns: %TRUE if the action was locked down, %FALSE if error is set.
- **/
-gboolean
-polkit_authority_remove_lockdown_for_action_finish (PolkitAuthority *authority,
-                                                    GAsyncResult    *res,
-                                                    GError         **error)
-{
-  gboolean ret;
-  GVariant *value;
-  GAsyncResult *_res;
-
-  ret = FALSE;
-
-  g_warn_if_fail (g_simple_async_result_get_source_tag (G_SIMPLE_ASYNC_RESULT (res)) == polkit_authority_remove_lockdown_for_action);
-  _res = G_ASYNC_RESULT (g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res)));
-
-  value = g_dbus_proxy_call_finish (authority->proxy, _res, error);
-  if (value == NULL)
-    goto out;
-  ret = TRUE;
-  g_variant_unref (value);
-
- out:
-  return ret;
-}
-
-/**
- * polkit_authority_remove_lockdown_for_action_sync:
- * @authority: A #PolkitAuthority.
- * @action_id: The identifier for the action.
- * @cancellable: A #GCancellable or %NULL.
- * @error: Return location for error or %NULL.
- *
- * Synchronously removes lock down for an action.
- *
- * Returns: %TRUE if the action was locked down, %FALSE if error is set.
- **/
-gboolean
-polkit_authority_remove_lockdown_for_action_sync (PolkitAuthority     *authority,
-                                                  const gchar         *action_id,
-                                                  GCancellable        *cancellable,
-                                                  GError             **error)
-{
-  gboolean ret;
-  CallSyncData *data;
-
-  data = call_sync_new ();
-  polkit_authority_remove_lockdown_for_action (authority, action_id, cancellable, call_sync_cb, data);
-  call_sync_block (data);
-  ret = polkit_authority_remove_lockdown_for_action_finish (authority, data->res, error);
-  call_sync_free (data);
-
-  return ret;
-}
-
-/* ---------------------------------------------------------------------------------------------------- */
-
-/**
  * polkit_authority_get_owner:
  * @authority: A #PolkitAuthority.
  *
diff --git a/src/polkit/polkitauthority.h b/src/polkit/polkitauthority.h
index 4140ff8..0556b34 100644
--- a/src/polkit/polkitauthority.h
+++ b/src/polkit/polkitauthority.h
@@ -110,16 +110,6 @@ gboolean                   polkit_authority_revoke_temporary_authorization_by_id
                                                                                        GCancellable        *cancellable,
                                                                                        GError             **error);
 
-gboolean                   polkit_authority_add_lockdown_for_action_sync (PolkitAuthority     *authority,
-                                                                          const gchar         *action_id,
-                                                                          GCancellable        *cancellable,
-                                                                          GError             **error);
-
-gboolean                   polkit_authority_remove_lockdown_for_action_sync (PolkitAuthority     *authority,
-                                                                             const gchar         *action_id,
-                                                                             GCancellable        *cancellable,
-                                                                             GError             **error);
-
 /* ---------------------------------------------------------------------------------------------------- */
 
 void                       polkit_authority_enumerate_actions (PolkitAuthority     *authority,
@@ -208,26 +198,6 @@ gboolean                   polkit_authority_revoke_temporary_authorization_by_id
                                                                                          GAsyncResult    *res,
                                                                                          GError         **error);
 
-void                       polkit_authority_add_lockdown_for_action (PolkitAuthority     *authority,
-                                                                     const gchar         *action_id,
-                                                                     GCancellable        *cancellable,
-                                                                     GAsyncReadyCallback  callback,
-                                                                     gpointer             user_data);
-
-gboolean                   polkit_authority_add_lockdown_for_action_finish (PolkitAuthority *authority,
-                                                                            GAsyncResult    *res,
-                                                                            GError         **error);
-
-void                       polkit_authority_remove_lockdown_for_action (PolkitAuthority     *authority,
-                                                                        const gchar         *action_id,
-                                                                        GCancellable        *cancellable,
-                                                                        GAsyncReadyCallback  callback,
-                                                                        gpointer             user_data);
-
-gboolean                   polkit_authority_remove_lockdown_for_action_finish (PolkitAuthority *authority,
-                                                                               GAsyncResult    *res,
-                                                                               GError         **error);
-
 /* ---------------------------------------------------------------------------------------------------- */
 
 G_END_DECLS
diff --git a/src/polkit/polkitauthorizationresult.c b/src/polkit/polkitauthorizationresult.c
index 5bc1065..e027008 100644
--- a/src/polkit/polkitauthorizationresult.c
+++ b/src/polkit/polkitauthorizationresult.c
@@ -227,32 +227,6 @@ polkit_authorization_result_get_temporary_authorization_id (PolkitAuthorizationR
   return ret;
 }
 
-/**
- * polkit_authorization_result_get_locked_down:
- * @result: A #PolkitAuthorizationResult.
- *
- * Gets whether the action is locked down via
- * e.g. polkit_authority_add_lockdown_for_action().
- *
- * This method simply reads the value of the key/value pair in @details with the
- * key <literal>polkit.lockdown</literal>.
- *
- * Returns: %TRUE if the action for the authorization is locked down.
- */
-gboolean
-polkit_authorization_result_get_locked_down (PolkitAuthorizationResult *result)
-{
-  gboolean ret;
-  PolkitDetails *details;
-
-  ret = FALSE;
-  details = polkit_authorization_result_get_details (result);
-  if (details != NULL && polkit_details_lookup (details, "polkit.lockdown") != NULL)
-    ret = TRUE;
-
-  return ret;
-}
-
 PolkitAuthorizationResult *
 polkit_authorization_result_new_for_gvariant (GVariant *value)
 {
diff --git a/src/polkit/polkitauthorizationresult.h b/src/polkit/polkitauthorizationresult.h
index 5a66885..ea479fe 100644
--- a/src/polkit/polkitauthorizationresult.h
+++ b/src/polkit/polkitauthorizationresult.h
@@ -52,7 +52,6 @@ gboolean           polkit_authorization_result_get_is_authorized              (P
 gboolean           polkit_authorization_result_get_is_challenge               (PolkitAuthorizationResult *result);
 gboolean           polkit_authorization_result_get_retains_authorization      (PolkitAuthorizationResult *result);
 const gchar       *polkit_authorization_result_get_temporary_authorization_id (PolkitAuthorizationResult *result);
-gboolean           polkit_authorization_result_get_locked_down                (PolkitAuthorizationResult *result);
 
 /* ---------------------------------------------------------------------------------------------------- */
 
diff --git a/src/polkitbackend/polkitbackendauthority.c b/src/polkitbackend/polkitbackendauthority.c
index 33c800f..28a77ba 100644
--- a/src/polkitbackend/polkitbackendauthority.c
+++ b/src/polkitbackend/polkitbackendauthority.c
@@ -498,154 +498,6 @@ polkit_backend_authority_revoke_temporary_authorization_by_id (PolkitBackendAuth
     }
 }
 
-/**
- * polkit_backend_authority_add_lockdown_for_action:
- * @authority: A #PolkitBackendAuthority.
- * @caller: The system bus name that called the method.
- * @action_id: The action id.
- * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
- * @user_data: The data to pass to @callback.
- *
- * Asynchronously add locks down for @action_id.
- *
- * When the operation is finished, @callback will be invoked. You can
- * then call polkit_backend_authority_add_lockdown_for_action_finish()
- * to get the result of the operation.
- */
-void
-polkit_backend_authority_add_lockdown_for_action (PolkitBackendAuthority  *authority,
-                                                  PolkitSubject           *caller,
-                                                  const gchar             *action_id,
-                                                  GAsyncReadyCallback      callback,
-                                                  gpointer                 user_data)
-{
-  PolkitBackendAuthorityClass *klass;
-
-  klass = POLKIT_BACKEND_AUTHORITY_GET_CLASS (authority);
-
-  if (klass->add_lockdown_for_action == NULL)
-    {
-      GSimpleAsyncResult *simple;
-
-      simple = g_simple_async_result_new_error (G_OBJECT (authority),
-                                                callback,
-                                                user_data,
-                                                POLKIT_ERROR,
-                                                POLKIT_ERROR_NOT_SUPPORTED,
-                                                "Operation not supported");
-      g_simple_async_result_complete (simple);
-      g_object_unref (simple);
-    }
-  else
-    {
-      klass->add_lockdown_for_action (authority, caller, action_id, callback, user_data);
-    }
-}
-
-/**
- * polkit_backend_authority_add_lockdown_for_action_finish:
- * @authority: A #PolkitBackendAuthority.
- * @res: A #GAsyncResult obtained from the callback.
- * @error: Return location for error or %NULL.
- *
- * Finishes adding lock down for an action.
- *
- * Returns: %TRUE if the operation succeeded or, %FALE if @error is set.
- */
-gboolean
-polkit_backend_authority_add_lockdown_for_action_finish (PolkitBackendAuthority  *authority,
-                                                         GAsyncResult            *res,
-                                                         GError                 **error)
-{
-  PolkitBackendAuthorityClass *klass;
-
-  klass = POLKIT_BACKEND_AUTHORITY_GET_CLASS (authority);
-
-  if (klass->add_lockdown_for_action_finish == NULL)
-    {
-      g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error);
-      return FALSE;
-    }
-  else
-    {
-      return klass->add_lockdown_for_action_finish (authority, res, error);
-    }
-}
-
-/**
- * polkit_backend_authority_remove_lockdown_for_action:
- * @authority: A #PolkitBackendAuthority.
- * @caller: The system bus name that called the method.
- * @action_id: The action id.
- * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
- * @user_data: The data to pass to @callback.
- *
- * Asynchronously remove locks down for @action_id.
- *
- * When the operation is finished, @callback will be invoked. You can
- * then call polkit_backend_authority_remove_lockdown_for_action_finish()
- * to get the result of the operation.
- */
-void
-polkit_backend_authority_remove_lockdown_for_action (PolkitBackendAuthority  *authority,
-                                                     PolkitSubject           *caller,
-                                                     const gchar             *action_id,
-                                                     GAsyncReadyCallback      callback,
-                                                     gpointer                 user_data)
-{
-  PolkitBackendAuthorityClass *klass;
-
-  klass = POLKIT_BACKEND_AUTHORITY_GET_CLASS (authority);
-
-  if (klass->remove_lockdown_for_action == NULL)
-    {
-      GSimpleAsyncResult *simple;
-
-      simple = g_simple_async_result_new_error (G_OBJECT (authority),
-                                                callback,
-                                                user_data,
-                                                POLKIT_ERROR,
-                                                POLKIT_ERROR_NOT_SUPPORTED,
-                                                "Operation not supported");
-      g_simple_async_result_complete (simple);
-      g_object_unref (simple);
-    }
-  else
-    {
-      klass->remove_lockdown_for_action (authority, caller, action_id, callback, user_data);
-    }
-}
-
-/**
- * polkit_backend_authority_remove_lockdown_for_action_finish:
- * @authority: A #PolkitBackendAuthority.
- * @res: A #GAsyncResult obtained from the callback.
- * @error: Return location for error or %NULL.
- *
- * Finishes removing lock down for an action.
- *
- * Returns: %TRUE if the operation succeeded or, %FALE if @error is set.
- */
-gboolean
-polkit_backend_authority_remove_lockdown_for_action_finish (PolkitBackendAuthority  *authority,
-                                                            GAsyncResult            *res,
-                                                            GError                 **error)
-{
-  PolkitBackendAuthorityClass *klass;
-
-  klass = POLKIT_BACKEND_AUTHORITY_GET_CLASS (authority);
-
-  if (klass->remove_lockdown_for_action_finish == NULL)
-    {
-      g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (res), error);
-      return FALSE;
-    }
-  else
-    {
-      return klass->remove_lockdown_for_action_finish (authority, res, error);
-    }
-}
-
 /* ---------------------------------------------------------------------------------------------------- */
 
 typedef struct
@@ -758,12 +610,6 @@ static const gchar *server_introspection_data =
   "    <method name='RevokeTemporaryAuthorizationById'>"
   "      <arg type='s' name='id' direction='in'/>"
   "    </method>"
-  "    <method name='AddLockdownForAction'>"
-  "      <arg type='s' name='action_id' direction='in'/>"
-  "    </method>"
-  "    <method name='RemoveLockdownForAction'>"
-  "      <arg type='s' name='action_id' direction='in'/>"
-  "    </method>"
   "    <signal name='Changed'/>"
   "    <property type='s' name='BackendName' access='read'/>"
   "    <property type='s' name='BackendVersion' access='read'/>"
@@ -1280,7 +1126,7 @@ server_handle_revoke_temporary_authorization_by_id (Server                 *serv
   const gchar *id;
 
   g_variant_get (parameters,
-                 "(@s)",
+                 "(&s)",
                  &id);
 
   error = NULL;
@@ -1303,36 +1149,6 @@ server_handle_revoke_temporary_authorization_by_id (Server                 *serv
 /* ---------------------------------------------------------------------------------------------------- */
 
 static void
-server_handle_add_lockdown_for_action (Server                 *server,
-                                       GVariant               *parameters,
-                                       PolkitSubject          *caller,
-                                       GDBusMethodInvocation  *invocation)
-{
-  /* TODO: probably want to nuke this method so don't implement now */
-  g_dbus_method_invocation_return_error (invocation,
-                                         POLKIT_ERROR,
-                                         POLKIT_ERROR_NOT_SUPPORTED,
-                                         "Operation is not supported");
-}
-
-/* ---------------------------------------------------------------------------------------------------- */
-
-static void
-server_handle_remove_lockdown_for_action (Server                 *server,
-                                          GVariant               *parameters,
-                                          PolkitSubject          *caller,
-                                          GDBusMethodInvocation  *invocation)
-{
-  /* TODO: probably want to nuke this method so don't implement now */
-  g_dbus_method_invocation_return_error (invocation,
-                                         POLKIT_ERROR,
-                                         POLKIT_ERROR_NOT_SUPPORTED,
-                                         "Operation is not supported");
-}
-
-/* ---------------------------------------------------------------------------------------------------- */
-
-static void
 server_handle_method_call (GDBusConnection        *connection,
                            const gchar            *sender,
                            const gchar            *object_path,
@@ -1365,10 +1181,6 @@ server_handle_method_call (GDBusConnection        *connection,
     server_handle_revoke_temporary_authorizations (server, parameters, caller, invocation);
   else if (g_strcmp0 (method_name, "RevokeTemporaryAuthorizationById") == 0)
     server_handle_revoke_temporary_authorization_by_id (server, parameters, caller, invocation);
-  else if (g_strcmp0 (method_name, "AddLockdownForAction") == 0)
-    server_handle_add_lockdown_for_action (server, parameters, caller, invocation);
-  else if (g_strcmp0 (method_name, "RemoveLockdownForAction") == 0)
-    server_handle_remove_lockdown_for_action (server, parameters, caller, invocation);
   else
     g_assert_not_reached ();
 
diff --git a/src/polkitbackend/polkitbackendauthority.h b/src/polkitbackend/polkitbackendauthority.h
index 626c4a5..e6a8104 100644
--- a/src/polkitbackend/polkitbackendauthority.h
+++ b/src/polkitbackend/polkitbackendauthority.h
@@ -98,10 +98,6 @@ struct _PolkitBackendAuthority
  * authorization identified by id or %NULL if the backend doesn't support
  * the operation. See polkit_backend_authority_revoke_temporary_authorization_by_id()
  * for details.
- * @add_lockdown_for_action: Called to add lock down for an action. See polkit_backend_authority_add_lockdown_for_action() for details. Can be %NULL if not supported by the backend.
- * @add_lockdown_for_action_finish: Called to finish adding lock down for an an action. See polkit_backend_authority_add_lockdown_for_action_finish() for details. Can be %NULL if not supported by the backend.
- * @remove_lockdown_for_action: Called when removing lock down for an action. See polkit_backend_authority_remove_lockdown_for_action() for details. Can be %NULL if not supported by the backend.
- * @remove_lockdown_for_action_finish: Called to finish removing lock down for an action. See polkit_backend_authority_remove_lockdown_for_action_finish() for details. Can be %NULL if not supported by the backend.
  * @system_bus_name_owner_changed: temporary VFunc, to be removed before API is declared stable.
  *
  * VFuncs that authority backends need to implement.
@@ -173,26 +169,6 @@ struct _PolkitBackendAuthorityClass
                                                     const gchar              *id,
                                                     GError                  **error);
 
-  void (*add_lockdown_for_action) (PolkitBackendAuthority  *authority,
-                                   PolkitSubject           *caller,
-                                   const gchar             *action_id,
-                                   GAsyncReadyCallback      callback,
-                                   gpointer                 user_data);
-
-  gboolean (*add_lockdown_for_action_finish) (PolkitBackendAuthority  *authority,
-                                              GAsyncResult            *res,
-                                              GError                 **error);
-
-  void (*remove_lockdown_for_action) (PolkitBackendAuthority  *authority,
-                                      PolkitSubject           *caller,
-                                      const gchar             *action_id,
-                                      GAsyncReadyCallback      callback,
-                                      gpointer                 user_data);
-
-  gboolean (*remove_lockdown_for_action_finish) (PolkitBackendAuthority  *authority,
-                                                 GAsyncResult            *res,
-                                                 GError                 **error);
-
   /* TODO: need something more efficient such that we don't watch all name changes */
   void (*system_bus_name_owner_changed)  (PolkitBackendAuthority   *authority,
                                           const gchar              *name,
@@ -305,26 +281,6 @@ gboolean polkit_backend_authority_revoke_temporary_authorization_by_id (PolkitBa
                                                                         const gchar              *id,
                                                                         GError                  **error);
 
-void polkit_backend_authority_add_lockdown_for_action (PolkitBackendAuthority  *authority,
-                                                       PolkitSubject           *caller,
-                                                       const gchar             *action_id,
-                                                       GAsyncReadyCallback      callback,
-                                                       gpointer                 user_data);
-
-gboolean polkit_backend_authority_add_lockdown_for_action_finish (PolkitBackendAuthority  *authority,
-                                                                  GAsyncResult            *res,
-                                                                  GError                 **error);
-
-void polkit_backend_authority_remove_lockdown_for_action (PolkitBackendAuthority  *authority,
-                                                          PolkitSubject           *caller,
-                                                          const gchar             *action_id,
-                                                          GAsyncReadyCallback      callback,
-                                                          gpointer                 user_data);
-
-gboolean polkit_backend_authority_remove_lockdown_for_action_finish (PolkitBackendAuthority  *authority,
-                                                                     GAsyncResult            *res,
-                                                                     GError                 **error);
-
 /* --- */
 
 PolkitBackendAuthority *polkit_backend_authority_get (void);
diff --git a/src/polkitbackend/polkitbackendlocalauthority.c b/src/polkitbackend/polkitbackendlocalauthority.c
index 737b7d2..7af6d4f 100644
--- a/src/polkitbackend/polkitbackendlocalauthority.c
+++ b/src/polkitbackend/polkitbackendlocalauthority.c
@@ -45,8 +45,7 @@
  * An implementation of #PolkitBackendAuthority that stores
  * authorizations on the local file system, supports interaction with
  * authentication agents (virtue of being based on
- * #PolkitBackendInteractiveAuthority), and implements support for
- * lock down.
+ * #PolkitBackendInteractiveAuthority).
  */
 
 /* ---------------------------------------------------------------------------------------------------- */
@@ -56,8 +55,6 @@ static GList *get_users_in_group (PolkitIdentity              *group,
 
 static GList *get_groups_for_user (PolkitIdentity              *user);
 
-static void register_extensions (void);
-
 /* ---------------------------------------------------------------------------------------------------- */
 
 typedef struct
@@ -92,27 +89,6 @@ static PolkitImplicitAuthorization polkit_backend_local_authority_check_authoriz
                                                           PolkitImplicitAuthorization        implicit,
                                                           PolkitDetails                     *out_details);
 
-static void polkit_backend_local_authority_add_lockdown_for_action (PolkitBackendAuthority  *authority,
-                                                                    PolkitSubject           *caller,
-                                                                    const gchar             *action_id,
-                                                                    GAsyncReadyCallback      callback,
-                                                                    gpointer                 user_data);
-
-static gboolean polkit_backend_local_authority_add_lockdown_for_action_finish (PolkitBackendAuthority  *authority,
-                                                                               GAsyncResult            *res,
-                                                                               GError                 **error);
-
-static void polkit_backend_local_authority_remove_lockdown_for_action (PolkitBackendAuthority  *authority,
-                                                                       PolkitSubject           *caller,
-                                                                       const gchar             *action_id,
-                                                                       GAsyncReadyCallback      callback,
-                                                                       gpointer                 user_data);
-
-static gboolean polkit_backend_local_authority_remove_lockdown_for_action_finish (PolkitBackendAuthority  *authority,
-                                                                                  GAsyncResult            *res,
-                                                                                  GError                 **error);
-
-
 G_DEFINE_TYPE_WITH_CODE (PolkitBackendLocalAuthority,
                          polkit_backend_local_authority,
                          POLKIT_BACKEND_TYPE_INTERACTIVE_AUTHORITY,
@@ -393,7 +369,7 @@ polkit_backend_local_authority_get_version (PolkitBackendAuthority *authority)
 static PolkitAuthorityFeatures
 polkit_backend_local_authority_get_features (PolkitBackendAuthority *authority)
 {
-  return POLKIT_AUTHORITY_FEATURES_TEMPORARY_AUTHORIZATION | POLKIT_AUTHORITY_FEATURES_LOCKDOWN;
+  return POLKIT_AUTHORITY_FEATURES_TEMPORARY_AUTHORIZATION;
 }
 
 static void
@@ -411,16 +387,10 @@ polkit_backend_local_authority_class_init (PolkitBackendLocalAuthorityClass *kla
   authority_class->get_name                             = polkit_backend_local_authority_get_name;
   authority_class->get_version                          = polkit_backend_local_authority_get_version;
   authority_class->get_features                         = polkit_backend_local_authority_get_features;
-  authority_class->add_lockdown_for_action              = polkit_backend_local_authority_add_lockdown_for_action;
-  authority_class->add_lockdown_for_action_finish       = polkit_backend_local_authority_add_lockdown_for_action_finish;
-  authority_class->remove_lockdown_for_action           = polkit_backend_local_authority_remove_lockdown_for_action;
-  authority_class->remove_lockdown_for_action_finish    = polkit_backend_local_authority_remove_lockdown_for_action_finish;
   interactive_authority_class->get_admin_identities     = polkit_backend_local_authority_get_admin_auth_identities;
   interactive_authority_class->check_authorization_sync = polkit_backend_local_authority_check_authorization_sync;
 
   g_type_class_add_private (klass, sizeof (PolkitBackendLocalAuthorityPrivate));
-
-  register_extensions ();
 }
 
 static GList *
@@ -693,469 +663,3 @@ get_groups_for_user (PolkitIdentity *user)
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
-
-static gchar *
-lockdown_get_filename (const gchar *action_id)
-{
-  return g_strdup_printf (PACKAGE_LOCALSTATE_DIR
-                          "/lib/polkit-1/localauthority/90-mandatory.d/"
-                          "org.freedesktop.policykit.localauthority.lockdown.action-%s.pkla",
-                          action_id);
-}
-
-static gboolean
-lockdown_exists (const gchar *action_id)
-{
-  gchar *filename;
-  gboolean ret;
-
-  ret = FALSE;
-
-  filename = lockdown_get_filename (action_id);
-  if (g_file_test (filename, G_FILE_TEST_IS_REGULAR | G_FILE_TEST_EXISTS))
-    ret = TRUE;
-  g_free (filename);
-
-  return ret;
-}
-
-static gboolean
-lockdown_add (const gchar  *action_id,
-              GError      **error)
-{
-  gboolean ret;
-  gchar *filename;
-  gchar *contents;
-
-  ret = FALSE;
-
-  filename = lockdown_get_filename (action_id);
-  contents = g_strdup_printf ("# Added by pklalockdown(1)\n"
-                              "#\n"
-                              "[Lockdown]\n"
-                              "Identity=unix-user:*\n"
-                              "Action=%s\n"
-                              "ResultAny=no\n"
-                              "ResultInactive=no\n"
-                              "ResultActive=auth_admin_keep\n"
-                              "ReturnValue=polkit.lockdown=1",
-                              action_id);
-  if (!g_file_set_contents (filename,
-                            contents,
-                            -1,
-                            error))
-    goto out;
-
-  ret = TRUE;
-
- out:
-  g_free (filename);
-  g_free (contents);
-  return ret;
-}
-
-static gboolean
-lockdown_remove (const gchar  *action_id,
-                 GError      **error)
-{
-  gboolean ret;
-  gchar *filename;
-
-  ret = FALSE;
-
-  filename = lockdown_get_filename (action_id);
-  if (g_unlink (filename) != 0)
-    {
-      g_set_error (error,
-                   POLKIT_ERROR,
-                   POLKIT_ERROR_FAILED,
-                   "Cannot unlink file %s: %s\n",
-                   filename,
-                   g_strerror (errno));
-      goto out;
-    }
-
-  ret = TRUE;
-
- out:
-  g_free (filename);
-  return ret;
-}
-
-/* ---------------------------------------------------------------------------------------------------- */
-
-static void
-add_lockdown_check_auth_cb (PolkitBackendAuthority *authority,
-                            GAsyncResult           *res,
-                            gpointer                user_data)
-{
-  GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (user_data);
-  PolkitAuthorizationResult *result;
-  GError *error;
-
-  result = polkit_backend_authority_check_authorization_finish (authority,
-                                                                res,
-                                                                &error);
-  if (result == NULL)
-    {
-      g_simple_async_result_set_from_error (simple, error);
-      g_error_free (error);
-    }
-  else
-    {
-      if (polkit_authorization_result_get_is_authorized (result))
-        {
-          const gchar *action_id;
-
-          action_id = g_object_get_data (G_OBJECT (simple), "lock-down-action-id");
-
-          if (lockdown_exists (action_id))
-            {
-              g_simple_async_result_set_error (simple,
-                                               POLKIT_ERROR,
-                                               POLKIT_ERROR_FAILED,
-                                               "Action %s is already locked down",
-                                               action_id);
-            }
-          else
-            {
-              GError *error;
-
-              error = NULL;
-              if (!lockdown_add (action_id, &error))
-                {
-                  g_simple_async_result_set_error (simple,
-                                                   POLKIT_ERROR,
-                                                   POLKIT_ERROR_FAILED,
-                                                   "Error adding lock down for action %s: %s",
-                                                   action_id,
-                                                   error->message);
-                  g_error_free (error);
-                }
-            }
-        }
-      else
-        {
-          g_simple_async_result_set_error (simple,
-                                           POLKIT_ERROR,
-                                           POLKIT_ERROR_NOT_AUTHORIZED,
-                                           "Not authorized to add lock down for the requested action");
-        }
-      g_object_unref (result);
-    }
-
-  g_simple_async_result_complete (simple);
-  g_object_unref (simple);
-}
-
-static void
-polkit_backend_local_authority_add_lockdown_for_action (PolkitBackendAuthority  *authority,
-                                                        PolkitSubject           *caller,
-                                                        const gchar             *action_id,
-                                                        GAsyncReadyCallback      callback,
-                                                        gpointer                 user_data)
-{
-  GSimpleAsyncResult *simple;
-  PolkitDetails *details;
-  GCancellable *cancellable;
-
-  simple = g_simple_async_result_new (G_OBJECT (authority),
-                                      callback,
-                                      user_data,
-                                      polkit_backend_local_authority_add_lockdown_for_action);
-
-  g_object_set_data_full (G_OBJECT (simple), "lock-down-action-id", g_strdup (action_id), g_free);
-
-  details = polkit_details_new ();
-  polkit_details_insert (details, "action-id", action_id);
-  polkit_details_insert (details, "add-lockdown", "1");
-
-  cancellable = g_cancellable_new ();
-
-  /* first check if caller is authorized for this */
-  polkit_backend_authority_check_authorization (POLKIT_BACKEND_AUTHORITY (authority),
-                                                NULL,
-                                                caller,
-                                                "org.freedesktop.policykit.lockdown",
-                                                details,
-                                                POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION,
-                                                cancellable,
-                                                (GAsyncReadyCallback) add_lockdown_check_auth_cb,
-                                                simple);
-
-  g_object_unref (details);
-  g_object_unref (cancellable);
-}
-
-static gboolean
-polkit_backend_local_authority_add_lockdown_for_action_finish (PolkitBackendAuthority  *authority,
-                                                               GAsyncResult            *res,
-                                                               GError                 **error)
-{
-  GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (res);
-
-  g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == polkit_backend_local_authority_add_lockdown_for_action);
-
-  if (g_simple_async_result_propagate_error (simple, error))
-    return FALSE;
-
-  return TRUE;
-}
-
-/* ---------------------------------------------------------------------------------------------------- */
-
-static void
-remove_lockdown_check_auth_cb (PolkitBackendAuthority *authority,
-                            GAsyncResult           *res,
-                            gpointer                user_data)
-{
-  GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (user_data);
-  PolkitAuthorizationResult *result;
-  GError *error;
-
-  result = polkit_backend_authority_check_authorization_finish (authority,
-                                                                res,
-                                                                &error);
-  if (result == NULL)
-    {
-      g_simple_async_result_set_from_error (simple, error);
-      g_error_free (error);
-    }
-  else
-    {
-      if (polkit_authorization_result_get_is_authorized (result))
-        {
-          const gchar *action_id;
-
-          action_id = g_object_get_data (G_OBJECT (simple), "lock-down-action-id");
-
-          if (!lockdown_exists (action_id))
-            {
-              g_simple_async_result_set_error (simple,
-                                               POLKIT_ERROR,
-                                               POLKIT_ERROR_FAILED,
-                                               "Action %s is not locked down",
-                                               action_id);
-            }
-          else
-            {
-              GError *error;
-
-              error = NULL;
-              if (!lockdown_remove (action_id, &error))
-                {
-                  g_simple_async_result_set_error (simple,
-                                                   POLKIT_ERROR,
-                                                   POLKIT_ERROR_FAILED,
-                                                   "Error removing lock down for action %s: %s",
-                                                   action_id,
-                                                   error->message);
-                  g_error_free (error);
-                }
-            }
-        }
-      else
-        {
-          g_simple_async_result_set_error (simple,
-                                           POLKIT_ERROR,
-                                           POLKIT_ERROR_NOT_AUTHORIZED,
-                                           "Not authorized to remove lock down for the requested action");
-        }
-      g_object_unref (result);
-    }
-
-  g_simple_async_result_complete (simple);
-  g_object_unref (simple);
-}
-
-static void
-polkit_backend_local_authority_remove_lockdown_for_action (PolkitBackendAuthority  *authority,
-                                                        PolkitSubject           *caller,
-                                                        const gchar             *action_id,
-                                                        GAsyncReadyCallback      callback,
-                                                        gpointer                 user_data)
-{
-  GSimpleAsyncResult *simple;
-  PolkitDetails *details;
-  GCancellable *cancellable;
-
-  simple = g_simple_async_result_new (G_OBJECT (authority),
-                                      callback,
-                                      user_data,
-                                      polkit_backend_local_authority_remove_lockdown_for_action);
-
-  g_object_set_data_full (G_OBJECT (simple), "lock-down-action-id", g_strdup (action_id), g_free);
-
-  details = polkit_details_new ();
-  polkit_details_insert (details, "action-id", action_id);
-  polkit_details_insert (details, "remove-lockdown", "1");
-
-  cancellable = g_cancellable_new ();
-
-  /* first check if caller is authorized for this */
-  polkit_backend_authority_check_authorization (POLKIT_BACKEND_AUTHORITY (authority),
-                                                NULL,
-                                                caller,
-                                                "org.freedesktop.policykit.lockdown",
-                                                details,
-                                                POLKIT_CHECK_AUTHORIZATION_FLAGS_ALLOW_USER_INTERACTION,
-                                                cancellable,
-                                                (GAsyncReadyCallback) remove_lockdown_check_auth_cb,
-                                                simple);
-
-  g_object_unref (details);
-  g_object_unref (cancellable);
-}
-
-static gboolean
-polkit_backend_local_authority_remove_lockdown_for_action_finish (PolkitBackendAuthority  *authority,
-                                                               GAsyncResult            *res,
-                                                               GError                 **error)
-{
-  GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (res);
-
-  g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == polkit_backend_local_authority_remove_lockdown_for_action);
-
-  if (g_simple_async_result_propagate_error (simple, error))
-    return FALSE;
-
-  return TRUE;
-}
-
-/* ---------------------------------------------------------------------------------------------------- */
-
-#define PBLA_TYPE_ACTION_LOOKUP          (pbla_action_lookup_get_type())
-#define PBLA_ACTION_LOOKUP(o)            (G_TYPE_CHECK_INSTANCE_CAST ((o), PBLA_TYPE_ACTION_LOOKUP, PblaActionLookup))
-#define PBLA_ACTION_LOOKUP_CLASS(k)      (G_TYPE_CHECK_CLASS_CAST((k), PBLA_TYPE_ACTION_LOOKUP, PblaActionLookupClass))
-#define PBLA_ACTION_LOOKUP_GET_CLASS(o)  (G_TYPE_INSTANCE_GET_CLASS ((o), PBLA_TYPE_ACTION_LOOKUP, PblaActionLookupClass))
-#define PBLA_IS_ACTION_LOOKUP(o)         (G_TYPE_CHECK_INSTANCE_TYPE ((o), PBLA_TYPE_ACTION_LOOKUP))
-#define PBLA_IS_ACTION_LOOKUP_CLASS(k)   (G_TYPE_CHECK_CLASS_TYPE ((k), PBLA_TYPE_ACTION_LOOKUP))
-
-typedef struct _PblaActionLookup PblaActionLookup;
-typedef struct _PblaActionLookupClass PblaActionLookupClass;
-
-struct _PblaActionLookup
-{
-  GObject parent;
-};
-
-struct _PblaActionLookupClass
-{
-  GObjectClass parent_class;
-};
-
-GType pbla_action_lookup_get_type (void) G_GNUC_CONST;
-
-static void pbla_action_lookup_iface_init (PolkitBackendActionLookupIface *iface);
-
-
-G_DEFINE_TYPE_EXTENDED (PblaActionLookup,
-                        pbla_action_lookup,
-                        G_TYPE_OBJECT,
-                        0,
-                        G_IMPLEMENT_INTERFACE (POLKIT_BACKEND_TYPE_ACTION_LOOKUP,
-                                               pbla_action_lookup_iface_init))
-
-static void
-pbla_action_lookup_init (PblaActionLookup *lookup)
-{
-}
-
-static void
-pbla_action_lookup_class_init (PblaActionLookupClass *klass)
-{
-}
-
-/* ---------------------------------------------------------------------------------------------------- */
-
-static gchar *
-pbla_action_lookup_get_message   (PolkitBackendActionLookup *lookup,
-                                  const gchar               *action_id,
-                                  PolkitDetails             *details,
-                                  PolkitActionDescription   *action_description)
-{
-  gchar *ret;
-  const gchar *s;
-
-  ret = NULL;
-
-  if (g_strcmp0 (action_id, "org.freedesktop.policykit.lockdown") != 0)
-    goto out;
-
-  s = polkit_details_lookup (details, "remove-lockdown");
-  if (s == NULL)
-    {
-      ret = g_strdup (_("Authentication is needed to lock down an action"));
-    }
-  else
-    {
-      ret = g_strdup (_("Authentication is needed to remove lock down for an action"));
-    }
-
- out:
-  return ret;
-}
-
-static gchar *
-pbla_action_lookup_get_icon_name (PolkitBackendActionLookup *lookup,
-                                  const gchar               *action_id,
-                                  PolkitDetails             *details,
-                                  PolkitActionDescription   *action_description)
-{
-  gchar *ret;
-
-  ret = NULL;
-
-  /* explicitly left blank for now */
-
-  return ret;
-}
-
-static PolkitDetails *
-pbla_action_lookup_get_details (PolkitBackendActionLookup *lookup,
-                                const gchar               *action_id,
-                                PolkitDetails             *details,
-                                PolkitActionDescription   *action_desc)
-{
-  PolkitDetails *ret;
-  const gchar *s;
-  const gchar *s2;
-
-  ret = NULL;
-
-  if (g_strcmp0 (action_id, "org.freedesktop.policykit.lockdown") != 0)
-    goto out;
-
-  s = polkit_details_lookup (details, "action-id");
-  if (s == NULL)
-    goto out;
-
-  s2 = polkit_details_lookup (details, "remove-lockdown");
-
-  ret = polkit_details_new ();
-  if (s2 == NULL)
-    polkit_details_insert (ret, _("Action to lock down"), s);
-  else
-    polkit_details_insert (ret, _("Locked down action"), s);
-
- out:
-  return ret;
-}
-
-static void
-pbla_action_lookup_iface_init (PolkitBackendActionLookupIface *iface)
-{
-  iface->get_message   = pbla_action_lookup_get_message;
-  iface->get_icon_name = pbla_action_lookup_get_icon_name;
-  iface->get_details   = pbla_action_lookup_get_details;
-}
-
-
-static void
-register_extensions (void)
-{
-  g_io_extension_point_implement (POLKIT_BACKEND_ACTION_LOOKUP_EXTENSION_POINT_NAME,
-                                  PBLA_TYPE_ACTION_LOOKUP,
-                                  "lockdown action lookup extension " PACKAGE_VERSION,
-                                  0);
-}
commit b224c80463d7408e6d410f718686d609ab16d1c7
Author: David Zeuthen <davidz at redhat.com>
Date:   Mon Aug 2 15:05:18 2010 -0400

    Implement polkit_temporary_authorization_new_for_gvariant()
    
    This is hit by the authentication agent in order to display a padlock
    when temporary authorizations exist.
    
    Signed-off-by: David Zeuthen <davidz at redhat.com>

diff --git a/src/polkit/polkitauthority.c b/src/polkit/polkitauthority.c
index 1a66add..8edbfa3 100644
--- a/src/polkit/polkitauthority.c
+++ b/src/polkit/polkitauthority.c
@@ -1126,8 +1126,17 @@ polkit_authority_enumerate_temporary_authorizations_finish (PolkitAuthority *aut
   g_variant_iter_init (&iter, array);
   while ((child = g_variant_iter_next_value (&iter)) != NULL)
     {
-      ret = g_list_prepend (ret, polkit_temporary_authorization_new_for_gvariant (child));
+      PolkitTemporaryAuthorization *auth;
+      auth = polkit_temporary_authorization_new_for_gvariant (child, error);
       g_variant_unref (child);
+      if (auth == NULL)
+        {
+          g_prefix_error (error, "Error serializing return value of EnumerateTemporaryAuthorizations: ");
+          g_list_foreach (ret, (GFunc) g_object_unref, NULL);
+          g_list_free (ret);
+          goto out;
+        }
+      ret = g_list_prepend (ret, auth);
     }
   ret = g_list_reverse (ret);
   g_variant_unref (array);
diff --git a/src/polkit/polkitprivate.h b/src/polkit/polkitprivate.h
index bdf03c1..579cc25 100644
--- a/src/polkit/polkitprivate.h
+++ b/src/polkit/polkitprivate.h
@@ -40,7 +40,8 @@ PolkitIdentity *polkit_identity_new_for_gvariant (GVariant *variant, GError **er
 PolkitAuthorizationResult  *polkit_authorization_result_new_for_gvariant (GVariant *value);
 GVariant *polkit_authorization_result_to_gvariant (PolkitAuthorizationResult *authorization_result);
 
-PolkitTemporaryAuthorization *polkit_temporary_authorization_new_for_gvariant (GVariant *value);
+PolkitTemporaryAuthorization *polkit_temporary_authorization_new_for_gvariant (GVariant *value,
+                                                                               GError   **error);
 GVariant *polkit_temporary_authorization_to_gvariant (PolkitTemporaryAuthorization *authorization);
 
 GVariant *polkit_details_to_gvariant (PolkitDetails *details);
diff --git a/src/polkit/polkittemporaryauthorization.c b/src/polkit/polkittemporaryauthorization.c
index d6e946b..71092b4 100644
--- a/src/polkit/polkittemporaryauthorization.c
+++ b/src/polkit/polkittemporaryauthorization.c
@@ -186,10 +186,31 @@ polkit_temporary_authorization_get_time_expires (PolkitTemporaryAuthorization *a
 }
 
 PolkitTemporaryAuthorization *
-polkit_temporary_authorization_new_for_gvariant (GVariant *value)
+polkit_temporary_authorization_new_for_gvariant (GVariant  *value,
+                                                 GError   **error)
 {
-  g_assert_not_reached ();
-  return NULL;
+  PolkitTemporaryAuthorization *authorization;
+  GVariant *subject_gvariant;
+
+  authorization = POLKIT_TEMPORARY_AUTHORIZATION (g_object_new (POLKIT_TYPE_TEMPORARY_AUTHORIZATION, NULL));
+  g_variant_get (value,
+                 "(ss@(sa{sv})tt)",
+                 &authorization->id,
+                 &authorization->action_id,
+                 &subject_gvariant,
+                 &authorization->time_obtained,
+                 &authorization->time_expires);
+  authorization->subject = polkit_subject_new_for_gvariant (subject_gvariant, error);
+  if (authorization->subject == NULL)
+    {
+      g_object_unref (authorization);
+      authorization = NULL;
+      goto out;
+    }
+
+ out:
+  g_variant_unref (subject_gvariant);
+  return authorization;
 }
 
 GVariant *
commit 4a9e4f72db4ec00500d9334f7411a086d7c81d0f
Author: David Zeuthen <davidz at redhat.com>
Date:   Fri Jul 30 12:19:55 2010 -0400

    Make polkitd accept --replace and gracefully handle SIGINT
    
    E.g. actually clean up everything before exiting. This makes it much
    easier to chase memory leaks.
    
    Signed-off-by: David Zeuthen <davidz at redhat.com>

diff --git a/docs/polkit/polkit-1-sections.txt b/docs/polkit/polkit-1-sections.txt
index 6b03fa2..999abb2 100644
--- a/docs/polkit/polkit-1-sections.txt
+++ b/docs/polkit/polkit-1-sections.txt
@@ -293,7 +293,8 @@ polkit_backend_authority_add_lockdown_for_action_finish
 polkit_backend_authority_remove_lockdown_for_action
 polkit_backend_authority_remove_lockdown_for_action_finish
 polkit_backend_authority_get
-polkit_backend_register_authority
+polkit_backend_authority_register
+polkit_backend_authority_unregister
 <SUBSECTION Standard>
 POLKIT_BACKEND_AUTHORITY
 POLKIT_BACKEND_IS_AUTHORITY
diff --git a/src/polkit/polkitauthorizationresult.c b/src/polkit/polkitauthorizationresult.c
index 85b039f..5bc1065 100644
--- a/src/polkit/polkitauthorizationresult.c
+++ b/src/polkit/polkitauthorizationresult.c
@@ -109,7 +109,7 @@ polkit_authorization_result_new (gboolean                   is_authorized,
   authorization_result = POLKIT_AUTHORIZATION_RESULT (g_object_new (POLKIT_TYPE_AUTHORIZATION_RESULT, NULL));
   authorization_result->is_authorized = is_authorized;
   authorization_result->is_challenge = is_challenge;
-  authorization_result->details = g_object_ref (details);
+  authorization_result->details = details != NULL ? g_object_ref (details) : NULL;
 
   return authorization_result;
 }
diff --git a/src/polkitbackend/polkitbackendauthority.c b/src/polkitbackend/polkitbackendauthority.c
index 4373315..33c800f 100644
--- a/src/polkitbackend/polkitbackendauthority.c
+++ b/src/polkitbackend/polkitbackendauthority.c
@@ -657,11 +657,10 @@ typedef struct
 
   PolkitBackendAuthority *authority;
 
-  GDBusConnection *system_bus;
+  GDBusConnection *connection;
 
   gulong authority_changed_id;
 
-  gchar *well_known_name;
   gchar *object_path;
 
   GHashTable *cancellation_id_to_check_auth_data;
@@ -670,21 +669,18 @@ typedef struct
 static void
 server_free (Server *server)
 {
-  g_free (server->well_known_name);
   g_free (server->object_path);
 
-  /* TODO: release well_known_name if not NULL */
-
   //g_signal_handler_disconnect (server->bus, server->name_owner_changed_id);
 
   if (server->authority_registration_id > 0)
-    g_dbus_connection_unregister_object (server->system_bus, server->authority_registration_id);
+    g_dbus_connection_unregister_object (server->connection, server->authority_registration_id);
 
   if (server->name_owner_changed_signal_id > 0)
-    g_dbus_connection_signal_unsubscribe (server->system_bus, server->name_owner_changed_signal_id);
+    g_dbus_connection_signal_unsubscribe (server->connection, server->name_owner_changed_signal_id);
 
-  if (server->system_bus != NULL)
-    g_object_unref (server->system_bus);
+  if (server->connection != NULL)
+    g_object_unref (server->connection);
 
   if (server->introspection_info != NULL)
     g_dbus_node_info_unref (server->introspection_info);
@@ -695,6 +691,8 @@ server_free (Server *server)
   if (server->cancellation_id_to_check_auth_data != NULL)
     g_hash_table_unref (server->cancellation_id_to_check_auth_data);
 
+  g_object_unref (server->authority);
+
   g_free (server);
 }
 
@@ -706,7 +704,7 @@ on_authority_changed (PolkitBackendAuthority *authority,
   GError *error;
 
   error = NULL;
-  if (!g_dbus_connection_emit_signal (server->system_bus,
+  if (!g_dbus_connection_emit_signal (server->connection,
                                       NULL, /* destination bus name */
                                       server->object_path,
                                       "org.freedesktop.PolicyKit1.Authority",
@@ -719,14 +717,6 @@ on_authority_changed (PolkitBackendAuthority *authority,
     }
 }
 
-static void
-authority_died (gpointer user_data,
-                GObject *where_the_object_was)
-{
-  Server *server = user_data;
-  server_free (server);
-}
-
 static const gchar *server_introspection_data =
   "<node>"
   "  <interface name='org.freedesktop.PolicyKit1.Authority'>"
@@ -1455,19 +1445,32 @@ static const GDBusInterfaceVTable server_vtable =
 };
 
 /**
- * polkit_backend_register_authority:
+ * polkit_backend_authority_unregister:
+ * @registration_id: A #gpointer obtained from polkit_backend_authority_register().
+ *
+ * Unregisters a #PolkitBackendAuthority registered with polkit_backend_authority_register().
+ */
+void
+polkit_backend_authority_unregister (gpointer registration_id)
+{
+  Server *server = registration_id;
+  server_free (server);
+}
+
+/**
+ * polkit_backend_authority_register:
+ * @connection: The #GDBusConnection to register the authority on.
  * @authority: A #PolkitBackendAuthority.
- * @well_known_name: Well-known name to claim on the system bus or %NULL to not claim a well-known name.
  * @object_path: Object path of the authority.
  * @error: Return location for error.
  *
- * Registers @authority on the system message bus.
+ * Registers @authority on a #GDBusConnection.
  *
- * Returns: %TRUE if @authority was registered, %FALSE if @error is set.
- **/
-gboolean
-polkit_backend_register_authority (PolkitBackendAuthority   *authority,
-                                   const gchar              *well_known_name,
+ * Returns: A #gpointer that can be used with polkit_backend_authority_unregister() or %NULL if @error is set.
+ */
+gpointer
+polkit_backend_authority_register (PolkitBackendAuthority   *authority,
+                                   GDBusConnection          *connection,
                                    const gchar              *object_path,
                                    GError                  **error)
 {
@@ -1477,18 +1480,14 @@ polkit_backend_register_authority (PolkitBackendAuthority   *authority,
 
   server->cancellation_id_to_check_auth_data = g_hash_table_new (g_str_hash, g_str_equal);
 
-  server->system_bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, error);
-  if (server->system_bus == NULL)
-    goto error;
-
-  server->well_known_name = g_strdup (well_known_name);
+  server->connection = g_object_ref (connection);
   server->object_path = g_strdup (object_path);
 
   server->introspection_info = g_dbus_node_info_new_for_xml (server_introspection_data, error);
   if (server->introspection_info == NULL)
       goto error;
 
-  server->authority_registration_id = g_dbus_connection_register_object (server->system_bus,
+  server->authority_registration_id = g_dbus_connection_register_object (server->connection,
                                                                          object_path,
                                                                          g_dbus_node_info_lookup_interface (server->introspection_info, "org.freedesktop.PolicyKit1.Authority"),
                                                                          &server_vtable,
@@ -1500,46 +1499,8 @@ polkit_backend_register_authority (PolkitBackendAuthority   *authority,
       goto error;
     }
 
-  if (well_known_name != NULL)
-    {
-      GVariant *result;
-      guint32 request_name_result;
-
-      /* TODO: use g_bus_own_name() instead */
-      result = g_dbus_connection_call_sync (server->system_bus,
-                                            "org.freedesktop.DBus",  /* name */
-                                            "/org/freedesktop/DBus", /* path */
-                                            "org.freedesktop.DBus",  /* interface */
-                                            "RequestName",
-                                            g_variant_new ("(su)", well_known_name, 0),
-                                            G_VARIANT_TYPE ("(u)"),
-                                            G_DBUS_CALL_FLAGS_NONE,
-                                            -1,
-                                            NULL, /* GCancellable */
-                                            error);
-      if (result == NULL)
-        {
-          g_prefix_error (error,
-                          "Could not become primary name owner for `%s'. RequestName() failed with: ",
-                          well_known_name);
-          goto error;
-        }
-      g_variant_get (result, "(u)", &request_name_result);
-      g_variant_unref (result);
-      if (request_name_result != 1)
-        {
-          g_set_error (error,
-                       POLKIT_ERROR,
-                       POLKIT_ERROR_FAILED,
-                       "Could not become primary name owner for `%s'. RequestName returned %d",
-                       well_known_name,
-                       request_name_result);
-          goto error;
-        }
-    }
-
   server->name_owner_changed_signal_id =
-    g_dbus_connection_signal_subscribe (server->system_bus,
+    g_dbus_connection_signal_subscribe (server->connection,
                                         "org.freedesktop.DBus",   /* sender */
                                         "org.freedesktop.DBus",   /* interface */
                                         "NameOwnerChanged",       /* member */
@@ -1550,21 +1511,18 @@ polkit_backend_register_authority (PolkitBackendAuthority   *authority,
                                         server,
                                         NULL); /* GDestroyNotify */
 
-  server->authority = authority;
+  server->authority = g_object_ref (authority);
 
   server->authority_changed_id = g_signal_connect (server->authority,
                                                    "changed",
                                                    G_CALLBACK (on_authority_changed),
                                                    server);
 
-  /* take a weak ref and kill server when listener dies */
-  g_object_weak_ref (G_OBJECT (server->authority), authority_died, server);
-
-  return TRUE;
+  return server;
 
  error:
   server_free (server);
-  return FALSE;
+  return NULL;
 }
 
 
diff --git a/src/polkitbackend/polkitbackendauthority.h b/src/polkitbackend/polkitbackendauthority.h
index 7ce5fde..626c4a5 100644
--- a/src/polkitbackend/polkitbackendauthority.h
+++ b/src/polkitbackend/polkitbackendauthority.h
@@ -329,11 +329,13 @@ gboolean polkit_backend_authority_remove_lockdown_for_action_finish (PolkitBacke
 
 PolkitBackendAuthority *polkit_backend_authority_get (void);
 
-gboolean polkit_backend_register_authority (PolkitBackendAuthority   *authority,
-                                            const gchar              *well_known_name,
+gpointer polkit_backend_authority_register (PolkitBackendAuthority   *authority,
+                                            GDBusConnection          *connection,
                                             const gchar              *object_path,
                                             GError                  **error);
 
+void polkit_backend_authority_unregister (gpointer registration_id);
+
 G_END_DECLS
 
 #endif /* __POLKIT_BACKEND_AUTHORITY_H */
diff --git a/src/polkitd/Makefile.am b/src/polkitd/Makefile.am
index 1234417..5ea3e95 100644
--- a/src/polkitd/Makefile.am
+++ b/src/polkitd/Makefile.am
@@ -17,7 +17,8 @@ INCLUDES =                                              		\
 libexec_PROGRAMS = polkitd
 
 polkitd_SOURCES = 							\
-	main.c								\
+					main.c				\
+	gposixsignal.h			gposixsignal.c			\
 	$(NULL)
 
 polkitd_CFLAGS = 							\
diff --git a/src/polkitd/gposixsignal.c b/src/polkitd/gposixsignal.c
new file mode 100644
index 0000000..8e9bb65
--- /dev/null
+++ b/src/polkitd/gposixsignal.c
@@ -0,0 +1,128 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/* 
+ * Copyright (C) 2010 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: David Zeuthen <davidz at redhat.com>
+ */
+
+#include "config.h"
+
+#include <unistd.h>
+#include <sys/signalfd.h>
+#include <signal.h>
+
+#include "gposixsignal.h"
+
+typedef struct
+{
+  GSource source;
+  GPollFD pollfd;
+  gint signum;
+} _GPosixSignalSource;
+
+static gboolean
+_g_posix_signal_source_prepare (GSource  *_source,
+                                gint     *timeout)
+{
+  *timeout = -1;
+  return FALSE;
+}
+
+static gboolean
+_g_posix_signal_source_check (GSource  *_source)
+{
+  _GPosixSignalSource *source = (_GPosixSignalSource *) _source;
+  return source->pollfd.revents != 0;
+}
+
+static gboolean
+_g_posix_signal_source_dispatch (GSource     *_source,
+                                 GSourceFunc  callback,
+                                 gpointer     user_data)
+
+{
+  _GPosixSignalWatchFunc func = (_GPosixSignalWatchFunc) callback;
+  g_warn_if_fail (func != NULL);
+  return (*func) (user_data);
+}
+
+static void
+_g_posix_signal_source_finalize (GSource *_source)
+{
+  _GPosixSignalSource *source = (_GPosixSignalSource *) _source;
+  close (source->pollfd.fd);
+}
+
+static GSourceFuncs _g_posix_signal_source_funcs =
+{
+  _g_posix_signal_source_prepare,
+  _g_posix_signal_source_check,
+  _g_posix_signal_source_dispatch,
+  _g_posix_signal_source_finalize
+};
+
+GSource *
+_g_posix_signal_source_new (gint signum)
+{
+  sigset_t sigset;
+  gint fd;
+  GSource *_source;
+  _GPosixSignalSource *source;
+
+  _source = NULL;
+
+  sigemptyset (&sigset);
+  sigaddset (&sigset, signum);
+
+  if (sigprocmask (SIG_BLOCK, &sigset, NULL) == -1)
+    g_assert_not_reached ();
+
+  fd = signalfd (-1, &sigset, SFD_NONBLOCK | SFD_CLOEXEC);
+
+  _source = g_source_new (&_g_posix_signal_source_funcs, sizeof (_GPosixSignalSource));
+  source = (_GPosixSignalSource *) _source;
+
+  source->pollfd.fd = fd;
+  source->pollfd.events = G_IO_IN;
+  g_source_add_poll (_source, &source->pollfd);
+
+  source->signum = signum;
+  return _source;
+}
+
+guint
+_g_posix_signal_watch_add (gint                   signum,
+                           gint                   priority,
+                           _GPosixSignalWatchFunc function,
+                           gpointer               user_data,
+                           GDestroyNotify         notify)
+{
+  GSource *source;
+  guint id;
+
+  g_return_val_if_fail (function != NULL, 0);
+
+  source = _g_posix_signal_source_new (signum);
+  if (priority != G_PRIORITY_DEFAULT_IDLE)
+    g_source_set_priority (source, priority);
+  g_source_set_callback (source, (GSourceFunc) function, user_data, notify);
+  id = g_source_attach (source, NULL);
+  g_source_unref (source);
+
+  return id;
+}
diff --git a/src/polkitd/gposixsignal.h b/src/polkitd/gposixsignal.h
new file mode 100644
index 0000000..f9b3249
--- /dev/null
+++ b/src/polkitd/gposixsignal.h
@@ -0,0 +1,42 @@
+/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
+/* 
+ * Copyright (C) 2010 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author: David Zeuthen <davidz at redhat.com>
+ */
+
+#ifndef ___G_POSIX_SIGNAL_H__
+#define ___G_POSIX_SIGNAL_H__
+
+#include <glib.h>
+
+G_BEGIN_DECLS
+
+typedef gboolean (*_GPosixSignalWatchFunc) (gpointer user_data);
+
+GSource *_g_posix_signal_source_new (gint signum);
+
+guint _g_posix_signal_watch_add (gint                   signum,
+                                 gint                   priority,
+                                 _GPosixSignalWatchFunc function,
+                                 gpointer               user_data,
+                                 GDestroyNotify         notify);
+
+G_END_DECLS
+
+#endif /* ___G_POSIX_SIGNAL_H__ */
diff --git a/src/polkitd/main.c b/src/polkitd/main.c
index ff39dd9..4b1967a 100644
--- a/src/polkitd/main.c
+++ b/src/polkitd/main.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008 Red Hat, Inc.
+ * Copyright (C) 2008-2010 Red Hat, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -19,49 +19,144 @@
  * Author: David Zeuthen <davidz at redhat.com>
  */
 
-#ifdef HAVE_CONFIG_H
-#  include "config.h"
-#endif
+#include "config.h"
 
+#include <signal.h>
 #include <polkit/polkit.h>
 #include <polkitbackend/polkitbackend.h>
 
-int
-main (int argc, char **argv)
+#include "gposixsignal.h"
+
+/* ---------------------------------------------------------------------------------------------------- */
+
+static PolkitBackendAuthority *authority = NULL;
+static gpointer                registration_id = NULL;
+static GMainLoop              *loop = NULL;
+static gboolean                opt_replace = FALSE;
+static GOptionEntry            opt_entries[] = {
+  {"replace", 0, 0, G_OPTION_ARG_NONE, &opt_replace, "Replace existing daemon", NULL},
+  {NULL }
+};
+
+static void
+on_bus_acquired (GDBusConnection *connection,
+                 const gchar     *name,
+                 gpointer         user_data)
 {
-  int ret;
   GError *error;
-  GMainLoop *loop;
-  PolkitBackendAuthority *authority;
-
-  ret = 1;
-  error = NULL;
-  authority = NULL;
 
-  g_type_init ();
+  g_print ("Connected to the system bus\n");
 
-  loop = g_main_loop_new (NULL, FALSE);
+  g_assert (authority == NULL);
+  g_assert (registration_id == NULL);
 
   authority = polkit_backend_authority_get ();
-
   g_print ("Using authority class %s\n", g_type_name (G_TYPE_FROM_INSTANCE (authority)));
 
-  if (!polkit_backend_register_authority (authority,
-                                          "org.freedesktop.PolicyKit1",
-                                          "/org/freedesktop/PolicyKit1/Authority",
-                                          &error))
+  error = NULL;
+  registration_id = polkit_backend_authority_register (authority,
+                                                       connection,
+                                                       "/org/freedesktop/PolicyKit1/Authority",
+                                                       &error);
+  if (registration_id == NULL)
     {
       g_printerr ("Error registering authority: %s\n", error->message);
       g_error_free (error);
+      g_main_loop_quit (loop); /* exit */
+    }
+}
+
+static void
+on_name_lost (GDBusConnection *connection,
+              const gchar     *name,
+              gpointer         user_data)
+{
+  g_print ("Lost the name org.freedesktop.PolicyKit1 - exiting\n");
+  g_main_loop_quit (loop);
+}
+
+static void
+on_name_acquired (GDBusConnection *connection,
+                  const gchar     *name,
+                  gpointer         user_data)
+{
+  g_print ("Acquired the name org.freedesktop.PolicyKit1\n");
+}
+
+static gboolean
+on_sigint (gpointer user_data)
+{
+  g_print ("Handling SIGINT\n");
+  g_main_loop_quit (loop);
+  return FALSE;
+}
+int
+main (int    argc,
+      char **argv)
+{
+  GError *error;
+  GOptionContext *opt_context;
+  gint ret;
+  guint name_owner_id;
+  guint sigint_id;
+
+  ret = 1;
+  loop = NULL;
+  opt_context = NULL;
+  name_owner_id = 0;
+  sigint_id = 0;
+  registration_id = NULL;
+
+  g_type_init ();
+
+  opt_context = g_option_context_new ("polkit authority");
+  g_option_context_add_main_entries (opt_context, opt_entries, NULL);
+  error = NULL;
+  if (!g_option_context_parse (opt_context, &argc, &argv, &error))
+    {
+      g_printerr ("Error parsing options: %s", error->message);
+      g_error_free (error);
       goto out;
     }
 
+  loop = g_main_loop_new (NULL, FALSE);
+
+  sigint_id = _g_posix_signal_watch_add (SIGINT,
+                                         G_PRIORITY_DEFAULT,
+                                         on_sigint,
+                                         NULL,
+                                         NULL);
+
+  name_owner_id = g_bus_own_name (G_BUS_TYPE_SYSTEM,
+                                  "org.freedesktop.PolicyKit1",
+                                  G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT |
+                                    (opt_replace ? G_BUS_NAME_OWNER_FLAGS_REPLACE : 0),
+                                  on_bus_acquired,
+                                  on_name_acquired,
+                                  on_name_lost,
+                                  NULL,
+                                  NULL);
+
+  g_print ("Entering main event loop\n");
   g_main_loop_run (loop);
 
   ret = 0;
 
+  g_print ("Shutting down\n");
  out:
+  if (sigint_id > 0)
+    g_source_remove (sigint_id);
+  if (name_owner_id != 0)
+    g_bus_unown_name (name_owner_id);
+  if (registration_id != NULL)
+    polkit_backend_authority_unregister (registration_id);
   if (authority != NULL)
     g_object_unref (authority);
+  if (loop != NULL)
+    g_main_loop_unref (loop);
+  if (opt_context != NULL)
+    g_option_context_free (opt_context);
+
+  g_print ("Exiting with code %d\n", ret);
   return ret;
 }
commit 2d0ef52d64707666fd8b6a85be50fa6e3e65ec9e
Author: David Zeuthen <davidz at redhat.com>
Date:   Fri Jul 30 11:10:24 2010 -0400

    Nuke eggdbus usage
    
    Signed-off-by: David Zeuthen <davidz at redhat.com>

diff --git a/configure.ac b/configure.ac
index 899b56b..a1980f3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -120,14 +120,10 @@ if test "x$GCC" = "xyes"; then
   changequote([,])dnl
 fi
 
-PKG_CHECK_MODULES(GLIB, [glib-2.0 >= 2.21.4 gio-2.0 >= 2.21.4])
+PKG_CHECK_MODULES(GLIB, [gio-2.0 >= 2.25.11])
 AC_SUBST(GLIB_CFLAGS)
 AC_SUBST(GLIB_LIBS)
 
-PKG_CHECK_MODULES(EGG_DBUS, [eggdbus-1 >= 0.6])
-AC_SUBST(EGG_DBUS_CFLAGS)
-AC_SUBST(EGG_DBUS_LIBS)
-
 EXPAT_LIB=""
 AC_ARG_WITH(expat, [  --with-expat=<dir>      Use expat from here],
                       [
diff --git a/src/polkit/Makefile.am b/src/polkit/Makefile.am
index ad345db..befe905 100644
--- a/src/polkit/Makefile.am
+++ b/src/polkit/Makefile.am
@@ -12,11 +12,9 @@ INCLUDES =                                                      \
         -DPACKAGE_LIB_DIR=\""$(libdir)"\"                       \
         -D_POSIX_PTHREAD_SEMANTICS                              \
         -D_REENTRANT                                            \
-	-DEGG_DBUS_I_KNOW_API_IS_SUBJECT_TO_CHANGE		\
         $(NULL)
 
 BUILT_SOURCES = 						\
-	polkit-built-sources.stamp				\
 	polkitenumtypes.c		polkitenumtypes.h	\
 	$(NULL)
 
@@ -32,37 +30,6 @@ polkitenumtypes.c: $(enum_headers) polkitenumtypes.c.template
 	 cd $(srcdir) && glib-mkenums --template polkitenumtypes.c.template $(enum_headers)) > \
 	   polkitenumtypes.c.tmp && mv polkitenumtypes.c.tmp polkitenumtypes.c
 
-# Build all the PolicyKit D-Bus code here, even the code we
-# only in the daemon for agent interaction
-#
-polkit-built-sources.stamp : Makefile.am $(top_srcdir)/data/org.freedesktop.PolicyKit1.Authority.xml $(top_srcdir)/data/org.freedesktop.PolicyKit1.AuthenticationAgent.xml
-	eggdbus-binding-tool											\
-		--namespace "_Polkit"										\
-		--dbus-namespace "org.freedesktop.PolicyKit1"							\
-		--introspection-xml $(top_srcdir)/data/org.freedesktop.PolicyKit1.Authority.xml 		\
-		--introspection-xml $(top_srcdir)/data/org.freedesktop.PolicyKit1.AuthenticationAgent.xml	\
-		--stamp-file polkit-built-sources.stamp								\
-	$(NULL)
-
-# keep in sync with contents of polkit-built-sources.stamp (Thanks autotools)
-#
-polkit_built_sources = _polkitactiondescription.c _polkitactiondescription.h _polkitauthenticationagent.c _polkitauthenticationagent.h _polkitauthority.c _polkitauthority.h _polkitauthorizationresult.c _polkitauthorizationresult.h _polkitbindings.c _polkitbindings.h _polkitbindingsmarshal.c _polkitbindingsmarshal.h _polkitbindingstypes.h _polkitcheckauthorizationflags.c _polkitcheckauthorizationflags.h _polkiterror.c _polkiterror.h _polkitidentity.c _polkitidentity.h _polkitimplicitauthorization.c _polkitimplicitauthorization.h _polkitsubject.c _polkitsubject.h _polkittemporaryauthorization.c _polkittemporaryauthorization.h docbook-interface-org.freedesktop.PolicyKit1.AuthenticationAgent.xml docbook-interface-org.freedesktop.PolicyKit1.Authority.xml _polkitbindingsmarshal.list _polkitauthorityfeatures.h _polkitauthorityfeatures.c
-
-noinst_LTLIBRARIES = libpolkit-private.la
-
-libpolkit_private_la_SOURCES = $(polkit_built_sources)
-
-libpolkit_private_la_CFLAGS =						\
-	-D_POLKIT_COMPILATION						\
-	$(GLIB_CFLAGS)							\
-	$(EGG_DBUS_CFLAGS)						\
-	$(NULL)
-
-libpolkit_private_la_LIBADD =						\
-	$(GLIB_LIBS)							\
-	$(EGG_DBUS_LIBS)						\
-	$(NULL)
-
 lib_LTLIBRARIES=libpolkit-gobject-1.la
 
 libpolkit_gobject_1includedir=$(includedir)/polkit-1/polkit
@@ -114,13 +81,10 @@ libpolkit_gobject_1_la_SOURCES =                                   			\
 libpolkit_gobject_1_la_CFLAGS =                                        	\
         -D_POLKIT_COMPILATION                                  		\
         $(GLIB_CFLAGS)							\
-        $(EGG_DBUS_CFLAGS)						\
         $(NULL)
 
 libpolkit_gobject_1_la_LIBADD =                               		\
         $(GLIB_LIBS)							\
-        $(EGG_DBUS_LIBS)						\
-	libpolkit-private.la						\
         $(NULL)
 
 libpolkit_gobject_1_la_LDFLAGS = -export-symbols-regex '(^polkit_.*)'
@@ -143,10 +107,8 @@ Polkit-1.0.gir: libpolkit-gobject-1.la $(G_IR_SCANNER) Makefile.am
 		--pkg=gobject-2.0 				\
 		--pkg=gio-2.0 					\
 		--libtool=$(top_builddir)/libtool		\
-	        $(EGG_DBUS_CFLAGS)				\
                 -I$(top_srcdir)/src	 			\
 	        -D_POLKIT_COMPILATION                   	\
-		-DEGG_DBUS_I_KNOW_API_IS_SUBJECT_TO_CHANGE	\
 		$(srcdir)/polkit.h 				\
 		$(srcdir)/polkittypes.h 			\
 		$(srcdir)/polkitactiondescription.h 		\
diff --git a/src/polkit/polkitactiondescription.c b/src/polkit/polkitactiondescription.c
index 222f7af..8c6581f 100644
--- a/src/polkit/polkitactiondescription.c
+++ b/src/polkit/polkitactiondescription.c
@@ -26,7 +26,6 @@
 #include <string.h>
 #include "polkitimplicitauthorization.h"
 #include "polkitactiondescription.h"
-#include "_polkitactiondescription.h"
 
 #include "polkitprivate.h"
 
@@ -46,9 +45,16 @@
 struct _PolkitActionDescription
 {
   GObject parent_instance;
-
-  _PolkitActionDescription *real;
-
+  gchar *action_id;
+  gchar *description;
+  gchar *message;
+  gchar *vendor_name;
+  gchar *vendor_url;
+  gchar *icon_name;
+  PolkitImplicitAuthorization implicit_any;
+  PolkitImplicitAuthorization implicit_inactive;
+  PolkitImplicitAuthorization implicit_active;
+  GHashTable *annotations;
   gchar **annotation_keys;
 };
 
@@ -62,6 +68,10 @@ G_DEFINE_TYPE (PolkitActionDescription, polkit_action_description, G_TYPE_OBJECT
 static void
 polkit_action_description_init (PolkitActionDescription *action_description)
 {
+  action_description->annotations = g_hash_table_new_full (g_str_hash,
+                                                           g_str_equal,
+                                                           g_free,
+                                                           g_free);
 }
 
 static void
@@ -71,9 +81,13 @@ polkit_action_description_finalize (GObject *object)
 
   action_description = POLKIT_ACTION_DESCRIPTION (object);
 
-  if (action_description->real != NULL)
-    g_object_unref (action_description->real);
-
+  g_free (action_description->action_id);
+  g_free (action_description->description);
+  g_free (action_description->message);
+  g_free (action_description->vendor_name);
+  g_free (action_description->vendor_url);
+  g_free (action_description->icon_name);
+  g_hash_table_unref (action_description->annotations);
   g_strfreev (action_description->annotation_keys);
 
   if (G_OBJECT_CLASS (polkit_action_description_parent_class)->finalize != NULL)
@@ -84,27 +98,9 @@ static void
 polkit_action_description_class_init (PolkitActionDescriptionClass *klass)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
   gobject_class->finalize = polkit_action_description_finalize;
 }
 
-PolkitActionDescription *
-polkit_action_description_new_for_real (_PolkitActionDescription *real)
-{
-  PolkitActionDescription *action_description;
-
-  action_description = POLKIT_ACTION_DESCRIPTION (g_object_new (POLKIT_TYPE_ACTION_DESCRIPTION, NULL));
-  action_description->real = g_object_ref (real);
-
-  return action_description;
-}
-
-_PolkitActionDescription *
-polkit_action_description_get_real (PolkitActionDescription *action_description)
-{
-  return g_object_ref (action_description->real);
-}
-
 /**
  * polkit_action_description_get_action_id:
  * @action_description: A #PolkitActionDescription.
@@ -116,7 +112,7 @@ polkit_action_description_get_real (PolkitActionDescription *action_description)
 const gchar  *
 polkit_action_description_get_action_id (PolkitActionDescription *action_description)
 {
-  return _polkit_action_description_get_action_id (action_description->real);
+  return action_description->action_id;
 }
 
 /**
@@ -130,7 +126,7 @@ polkit_action_description_get_action_id (PolkitActionDescription *action_descrip
 const gchar  *
 polkit_action_description_get_description (PolkitActionDescription *action_description)
 {
-  return _polkit_action_description_get_description (action_description->real);
+  return action_description->description;
 }
 
 /**
@@ -144,7 +140,7 @@ polkit_action_description_get_description (PolkitActionDescription *action_descr
 const gchar  *
 polkit_action_description_get_message (PolkitActionDescription *action_description)
 {
-  return _polkit_action_description_get_message (action_description->real);
+  return action_description->message;
 }
 
 /**
@@ -159,7 +155,7 @@ polkit_action_description_get_message (PolkitActionDescription *action_descripti
 const gchar  *
 polkit_action_description_get_vendor_name (PolkitActionDescription *action_description)
 {
-  return _polkit_action_description_get_vendor_name (action_description->real);
+  return action_description->vendor_name;
 }
 
 /**
@@ -174,7 +170,7 @@ polkit_action_description_get_vendor_name (PolkitActionDescription *action_descr
 const gchar  *
 polkit_action_description_get_vendor_url (PolkitActionDescription *action_description)
 {
-  return _polkit_action_description_get_vendor_url (action_description->real);
+  return action_description->vendor_url;
 }
 
 /**
@@ -189,7 +185,7 @@ polkit_action_description_get_vendor_url (PolkitActionDescription *action_descri
 PolkitImplicitAuthorization
 polkit_action_description_get_implicit_any (PolkitActionDescription *action_description)
 {
-  return _polkit_action_description_get_implicit_any (action_description->real);
+  return action_description->implicit_any;
 }
 
 /**
@@ -204,7 +200,7 @@ polkit_action_description_get_implicit_any (PolkitActionDescription *action_desc
 PolkitImplicitAuthorization
 polkit_action_description_get_implicit_inactive (PolkitActionDescription *action_description)
 {
-  return _polkit_action_description_get_implicit_inactive (action_description->real);
+  return action_description->implicit_inactive;
 }
 
 /**
@@ -219,7 +215,7 @@ polkit_action_description_get_implicit_inactive (PolkitActionDescription *action
 PolkitImplicitAuthorization
 polkit_action_description_get_implicit_active (PolkitActionDescription *action_description)
 {
-  return _polkit_action_description_get_implicit_active (action_description->real);
+  return action_description->implicit_active;
 }
 
 
@@ -235,7 +231,7 @@ polkit_action_description_get_implicit_active (PolkitActionDescription *action_d
 const gchar *
 polkit_action_description_get_icon_name (PolkitActionDescription *action_description)
 {
-  return _polkit_action_description_get_icon_name (action_description->real);
+  return action_description->icon_name;
 }
 
 /**
@@ -252,27 +248,9 @@ const gchar *
 polkit_action_description_get_annotation (PolkitActionDescription *action_description,
                                           const gchar             *key)
 {
-  EggDBusHashMap *annotations;
-
-  annotations = _polkit_action_description_get_annotations (action_description->real);
-
-  return egg_dbus_hash_map_lookup (annotations, key);
-}
-
-static gboolean
-collect_keys (EggDBusHashMap *hash_map,
-              gpointer        key,
-              gpointer        value,
-              gpointer        user_data)
-{
-  GPtrArray *p = user_data;
-
-  g_ptr_array_add (p, g_strdup (key));
-
-  return FALSE;
+  return g_hash_table_lookup (action_description->annotations, key);
 }
 
-
 /**
  * polkit_action_description_get_annotation_keys:
  * @action_description: A #PolkitActionDescription.
@@ -284,20 +262,20 @@ collect_keys (EggDBusHashMap *hash_map,
 const gchar * const *
 polkit_action_description_get_annotation_keys (PolkitActionDescription *action_description)
 {
-  EggDBusHashMap *annotations;
   GPtrArray *p;
+  GHashTableIter iter;
+  const gchar *key;
 
   if (action_description->annotation_keys != NULL)
     goto out;
 
-  annotations = _polkit_action_description_get_annotations (action_description->real);
-
   p = g_ptr_array_new ();
 
-  egg_dbus_hash_map_foreach (annotations, collect_keys, p);
+  g_hash_table_iter_init (&iter, action_description->annotations);
+  while (g_hash_table_iter_next (&iter, (gpointer) &key, NULL))
+    g_ptr_array_add (p, g_strdup (key));
 
   g_ptr_array_add (p, NULL);
-
   action_description->annotation_keys = (gchar **) g_ptr_array_free (p, FALSE);
 
  out:
@@ -305,85 +283,88 @@ polkit_action_description_get_annotation_keys (PolkitActionDescription *action_d
 }
 
 PolkitActionDescription *
+polkit_action_description_new (const gchar                 *action_id,
+                               const gchar                 *description,
+                               const gchar                 *message,
+                               const gchar                 *vendor_name,
+                               const gchar                 *vendor_url,
+                               const gchar                 *icon_name,
+                               PolkitImplicitAuthorization  implicit_any,
+                               PolkitImplicitAuthorization  implicit_inactive,
+                               PolkitImplicitAuthorization  implicit_active,
+                               GHashTable                  *annotations)
+{
+  PolkitActionDescription *ret;
+  ret = POLKIT_ACTION_DESCRIPTION (g_object_new (POLKIT_TYPE_ACTION_DESCRIPTION, NULL));
+  ret->action_id = g_strdup (action_id);
+  ret->description = g_strdup (description);
+  ret->message = g_strdup (message);
+  ret->vendor_name = g_strdup (vendor_name);
+  ret->vendor_url = g_strdup (vendor_url);
+  ret->icon_name = g_strdup (icon_name);
+  ret->implicit_any = implicit_any;
+  ret->implicit_inactive = implicit_inactive;
+  ret->implicit_active = implicit_active;
+  ret->annotations = g_hash_table_ref (annotations);
+  return ret;
+}
+
+PolkitActionDescription *
 polkit_action_description_new_for_gvariant (GVariant *value)
 {
   PolkitActionDescription *action_description;
   GVariantIter iter;
-  const gchar *action_id;
-  const gchar *description;
-  const gchar *message;
-  const gchar *vendor_name;
-  const gchar *vendor_url;
-  const gchar *icon_name;
-  PolkitImplicitAuthorization implicit_any;
-  PolkitImplicitAuthorization implicit_inactive;
-  PolkitImplicitAuthorization implicit_active;
   GVariant *annotations_dict;
   gchar *a_key;
   gchar *a_value;
-  EggDBusHashMap *hm;
 
   action_description = POLKIT_ACTION_DESCRIPTION (g_object_new (POLKIT_TYPE_ACTION_DESCRIPTION, NULL));
   g_variant_get (value,
-                 "(&s&s&s&s&s&suuu at a{ss})",
-                 &action_id,
-                 &description,
-                 &message,
-                 &vendor_name,
-                 &vendor_url,
-                 &icon_name,
-                 &implicit_any,
-                 &implicit_inactive,
-                 &implicit_active,
+                 "(ssssssuuu at a{ss})",
+                 &action_description->action_id,
+                 &action_description->description,
+                 &action_description->message,
+                 &action_description->vendor_name,
+                 &action_description->vendor_url,
+                 &action_description->icon_name,
+                 &action_description->implicit_any,
+                 &action_description->implicit_inactive,
+                 &action_description->implicit_active,
                  &annotations_dict);
-  hm = egg_dbus_hash_map_new (G_TYPE_STRING, g_free, G_TYPE_STRING, g_free);
   g_variant_iter_init (&iter, annotations_dict);
   while (g_variant_iter_next (&iter, "{ss}", &a_key, &a_value))
-    egg_dbus_hash_map_insert (hm, a_key, a_value);
+    g_hash_table_insert (action_description->annotations, a_key, a_value); /* adopts a_key and a_value */
   g_variant_unref (annotations_dict);
 
-  action_description->real = _polkit_action_description_new (action_id, description, message, vendor_name, vendor_url, icon_name, implicit_any, implicit_inactive, implicit_active, hm);
-  g_object_unref (hm);
-
   return action_description;
 }
 
-static gboolean
-add_annotation (EggDBusHashMap *hash_map,
-                gpointer        key,
-                gpointer        value,
-                gpointer        user_data)
-{
-  GVariantBuilder *builder = user_data;
-
-  g_variant_builder_add (builder, "{ss}", key, value);
-
-  return FALSE;
-}
-
 GVariant *
 polkit_action_description_to_gvariant (PolkitActionDescription *action_description)
 {
   GVariant *value;
   GVariantBuilder builder;
+  GHashTableIter iter;
+  const gchar *a_key;
+  const gchar *a_value;
 
   g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{ss}"));
 
-  egg_dbus_hash_map_foreach (_polkit_action_description_get_annotations (action_description->real),
-                             add_annotation,
-                             &builder);
+  g_hash_table_iter_init (&iter, action_description->annotations);
+  while (g_hash_table_iter_next (&iter, (gpointer) &a_key, (gpointer) &a_value))
+    g_variant_builder_add (&builder, "{ss}", a_key, a_value);
 
   /* TODO: note 'foo ? : ""' is a gcc specific extension (it's a short-hand for 'foo ? foo : ""') */
   value = g_variant_new ("(ssssssuuua{ss})",
-                         _polkit_action_description_get_action_id (action_description->real) ? : "",
-                         _polkit_action_description_get_description (action_description->real) ? : "",
-                         _polkit_action_description_get_message (action_description->real) ? : "",
-                         _polkit_action_description_get_vendor_name (action_description->real) ? : "",
-                         _polkit_action_description_get_vendor_url (action_description->real) ? : "",
-                         _polkit_action_description_get_icon_name (action_description->real) ? : "",
-                         _polkit_action_description_get_implicit_any (action_description->real),
-                         _polkit_action_description_get_implicit_inactive (action_description->real),
-                         _polkit_action_description_get_implicit_active (action_description->real),
+                         action_description->action_id ? : "",
+                         action_description->description ? : "",
+                         action_description->message ? : "",
+                         action_description->vendor_name ? : "",
+                         action_description->vendor_url ? : "",
+                         action_description->icon_name ? : "",
+                         action_description->implicit_any,
+                         action_description->implicit_inactive,
+                         action_description->implicit_active,
                          &builder);
 
   return value;
diff --git a/src/polkit/polkitauthorizationresult.c b/src/polkit/polkitauthorizationresult.c
index 334a6f3..85b039f 100644
--- a/src/polkit/polkitauthorizationresult.c
+++ b/src/polkit/polkitauthorizationresult.c
@@ -45,7 +45,8 @@ struct _PolkitAuthorizationResult
 {
   GObject parent_instance;
 
-  _PolkitAuthorizationResult *real;
+  gboolean is_authorized;
+  gboolean is_challenge;
 
   PolkitDetails *details;
 };
@@ -69,7 +70,6 @@ polkit_authorization_result_finalize (GObject *object)
 
   authorization_result = POLKIT_AUTHORIZATION_RESULT (object);
 
-  g_object_unref (authorization_result->real);
   if (authorization_result->details != NULL)
     g_object_unref (authorization_result->details);
 
@@ -85,24 +85,6 @@ polkit_authorization_result_class_init (PolkitAuthorizationResultClass *klass)
   gobject_class->finalize = polkit_authorization_result_finalize;
 }
 
-PolkitAuthorizationResult  *
-polkit_authorization_result_new_for_real (_PolkitAuthorizationResult *real)
-{
-  PolkitAuthorizationResult *authorization_result;
-
-  authorization_result = POLKIT_AUTHORIZATION_RESULT (g_object_new (POLKIT_TYPE_AUTHORIZATION_RESULT, NULL));
-
-  authorization_result->real = g_object_ref (real);
-
-  return authorization_result;
-}
-
-_PolkitAuthorizationResult *
-polkit_authorization_result_get_real (PolkitAuthorizationResult  *authorization_result)
-{
-  return g_object_ref (authorization_result->real);
-}
-
 /* ---------------------------------------------------------------------------------------------------- */
 
 /**
@@ -123,33 +105,11 @@ polkit_authorization_result_new (gboolean                   is_authorized,
                                  PolkitDetails             *details)
 {
   PolkitAuthorizationResult *authorization_result;
-  _PolkitAuthorizationResult *real;
-  EggDBusHashMap *real_details;
-
-  real_details = egg_dbus_hash_map_new (G_TYPE_STRING, g_free, G_TYPE_STRING, g_free);
-  if (details != NULL)
-    {
-      GHashTable *hash;
-      GHashTableIter iter;
-      gpointer key, value;
-
-      hash = polkit_details_get_hash (details);
-      if (hash != NULL)
-        {
-          g_hash_table_iter_init (&iter, hash);
-          while (g_hash_table_iter_next (&iter, &key, &value))
-            {
-              egg_dbus_hash_map_insert (real_details, g_strdup (key), g_strdup (value));
-            }
-        }
-    }
-
-  real = _polkit_authorization_result_new (is_authorized, is_challenge, real_details);
-  g_object_unref (real_details);
 
-  authorization_result = polkit_authorization_result_new_for_real (real);
-
-  g_object_unref (real);
+  authorization_result = POLKIT_AUTHORIZATION_RESULT (g_object_new (POLKIT_TYPE_AUTHORIZATION_RESULT, NULL));
+  authorization_result->is_authorized = is_authorized;
+  authorization_result->is_challenge = is_challenge;
+  authorization_result->details = g_object_ref (details);
 
   return authorization_result;
 }
@@ -168,7 +128,7 @@ polkit_authorization_result_new (gboolean                   is_authorized,
 gboolean
 polkit_authorization_result_get_is_authorized (PolkitAuthorizationResult *result)
 {
-  return _polkit_authorization_result_get_is_authorized (result->real);
+  return result->is_authorized;
 }
 
 /**
@@ -182,7 +142,7 @@ polkit_authorization_result_get_is_authorized (PolkitAuthorizationResult *result
 gboolean
 polkit_authorization_result_get_is_challenge (PolkitAuthorizationResult *result)
 {
-  return _polkit_authorization_result_get_is_challenge (result->real);
+  return result->is_challenge;
 }
 
 /**
@@ -197,16 +157,6 @@ polkit_authorization_result_get_is_challenge (PolkitAuthorizationResult *result)
 PolkitDetails *
 polkit_authorization_result_get_details (PolkitAuthorizationResult *result)
 {
-  EggDBusHashMap *real_details;
-
-  if (result->details != NULL)
-    goto out;
-
-  real_details = _polkit_authorization_result_get_details (result->real);
-  if (real_details != NULL)
-    result->details = result->details = polkit_details_new_for_hash (real_details->data);
-
- out:
   return result->details;
 }
 
diff --git a/src/polkit/polkitdetails.c b/src/polkit/polkitdetails.c
index 3490a71..19bdd36 100644
--- a/src/polkit/polkitdetails.c
+++ b/src/polkit/polkitdetails.c
@@ -102,7 +102,7 @@ polkit_details_new (void)
 }
 
 /* private */
-PolkitDetails *
+static PolkitDetails *
 polkit_details_new_for_hash (GHashTable *hash)
 {
   PolkitDetails *details;
@@ -114,13 +114,6 @@ polkit_details_new_for_hash (GHashTable *hash)
   return details;
 }
 
-/* private */
-GHashTable *
-polkit_details_get_hash (PolkitDetails *details)
-{
-  return details->hash;
-}
-
 /**
  * polkit_details_lookup:
  * @details: A #PolkitDetails.
diff --git a/src/polkit/polkitidentity.c b/src/polkit/polkitidentity.c
index 25c7123..3fad501 100644
--- a/src/polkit/polkitidentity.c
+++ b/src/polkit/polkitidentity.c
@@ -185,80 +185,6 @@ polkit_identity_from_string  (const gchar   *str,
   return identity;
 }
 
-PolkitIdentity *
-polkit_identity_new_for_real (_PolkitIdentity *real)
-{
-  PolkitIdentity *s;
-  const gchar *kind;
-  EggDBusHashMap *details;
-  EggDBusVariant *variant;
-
-  s = NULL;
-
-  kind = _polkit_identity_get_identity_kind (real);
-  details = _polkit_identity_get_identity_details (real);
-
-  if (strcmp (kind, "unix-user") == 0)
-    {
-      variant = egg_dbus_hash_map_lookup (details, "uid");
-      if (variant != NULL)
-        s = polkit_unix_user_new (egg_dbus_variant_get_uint (variant));
-    }
-  else if (strcmp (kind, "unix-group") == 0)
-    {
-      variant = egg_dbus_hash_map_lookup (details, "gid");
-      if (variant != NULL)
-        s = polkit_unix_group_new (egg_dbus_variant_get_uint (variant));
-    }
-  else
-    {
-      g_warning ("Unknown identity kind %s:", kind);
-    }
-
-  return s;
-}
-
-_PolkitIdentity *
-polkit_identity_get_real (PolkitIdentity *identity)
-{
-  _PolkitIdentity *real;
-  const gchar *kind;
-  EggDBusHashMap *details;
-
-  real = NULL;
-  kind = NULL;
-  details = egg_dbus_hash_map_new (G_TYPE_STRING, NULL, EGG_DBUS_TYPE_VARIANT, (GDestroyNotify) g_object_unref);
-
-  if (POLKIT_IS_UNIX_USER (identity))
-    {
-      kind = "unix-user";
-      egg_dbus_hash_map_insert (details,
-                                "uid",
-                                egg_dbus_variant_new_for_uint (polkit_unix_user_get_uid (POLKIT_UNIX_USER (identity))));
-    }
-  else if (POLKIT_IS_UNIX_GROUP (identity))
-    {
-      kind = "unix-group";
-      egg_dbus_hash_map_insert (details,
-                                "gid",
-                                egg_dbus_variant_new_for_uint (polkit_unix_group_get_gid (POLKIT_UNIX_GROUP (identity))));
-    }
-  else
-    {
-      g_warning ("Unknown class %s implementing PolkitIdentity", g_type_name (G_TYPE_FROM_INSTANCE (identity)));
-    }
-
-  if (kind != NULL)
-    {
-      real = _polkit_identity_new (kind, details);
-    }
-
-  if (details != NULL)
-    g_object_unref (details);
-
-  return real;
-}
-
 GVariant *
 polkit_identity_to_gvariant (PolkitIdentity *identity)
 {
diff --git a/src/polkit/polkitprivate.h b/src/polkit/polkitprivate.h
index d52f628..bdf03c1 100644
--- a/src/polkit/polkitprivate.h
+++ b/src/polkit/polkitprivate.h
@@ -27,17 +27,7 @@
 #include "polkitsubject.h"
 #include "polkitauthorizationresult.h"
 #include "polkittemporaryauthorization.h"
-#include "_polkitbindings.h"
 
-/* notes:
- *
- * - the _new_for_real() functions will ref the passed arg (you will still own the ref)
- * - the _get_real() functions will return a ref (you will own the ref)
- *
- */
-
-PolkitActionDescription  *polkit_action_description_new_for_real (_PolkitActionDescription *real);
-_PolkitActionDescription *polkit_action_description_get_real     (PolkitActionDescription  *action_description);
 PolkitActionDescription  *polkit_action_description_new_for_gvariant (GVariant *value);
 GVariant *polkit_action_description_to_gvariant (PolkitActionDescription *action_description);
 
@@ -47,25 +37,25 @@ GVariant *polkit_identity_to_gvariant (PolkitIdentity *identity);
 PolkitSubject  *polkit_subject_new_for_gvariant (GVariant *variant, GError **error);
 PolkitIdentity *polkit_identity_new_for_gvariant (GVariant *variant, GError **error);
 
-PolkitSubject  *polkit_subject_new_for_real (_PolkitSubject *real);
-_PolkitSubject *polkit_subject_get_real     (PolkitSubject  *subject);
-
-PolkitIdentity  *polkit_identity_new_for_real (_PolkitIdentity *real);
-_PolkitIdentity *polkit_identity_get_real     (PolkitIdentity  *identity);
-
-PolkitAuthorizationResult  *polkit_authorization_result_new_for_real (_PolkitAuthorizationResult *real);
-_PolkitAuthorizationResult *polkit_authorization_result_get_real (PolkitAuthorizationResult *authorization_result);
 PolkitAuthorizationResult  *polkit_authorization_result_new_for_gvariant (GVariant *value);
 GVariant *polkit_authorization_result_to_gvariant (PolkitAuthorizationResult *authorization_result);
 
-_PolkitTemporaryAuthorization *polkit_temporary_authorization_get_real (PolkitTemporaryAuthorization *authorization);
-PolkitTemporaryAuthorization *polkit_temporary_authorization_new_for_real (_PolkitTemporaryAuthorization *real);
 PolkitTemporaryAuthorization *polkit_temporary_authorization_new_for_gvariant (GVariant *value);
 GVariant *polkit_temporary_authorization_to_gvariant (PolkitTemporaryAuthorization *authorization);
 
-PolkitDetails *polkit_details_new_for_hash (GHashTable *hash);
-GHashTable *polkit_details_get_hash (PolkitDetails *details);
 GVariant *polkit_details_to_gvariant (PolkitDetails *details);
 PolkitDetails *polkit_details_new_for_gvariant (GVariant *value);
 
+PolkitActionDescription *
+polkit_action_description_new (const gchar                 *action_id,
+                               const gchar                 *description,
+                               const gchar                 *message,
+                               const gchar                 *vendor_name,
+                               const gchar                 *vendor_url,
+                               const gchar                 *icon_name,
+                               PolkitImplicitAuthorization  implicit_any,
+                               PolkitImplicitAuthorization  implicit_inactive,
+                               PolkitImplicitAuthorization  implicit_active,
+                               GHashTable                  *annotations);
+
 #endif /* __POLKIT_PRIVATE_H */
diff --git a/src/polkit/polkitsubject.c b/src/polkit/polkitsubject.c
index 139c5e7..99d49cd 100644
--- a/src/polkit/polkitsubject.c
+++ b/src/polkit/polkitsubject.c
@@ -260,107 +260,6 @@ polkit_subject_from_string  (const gchar   *str,
   return subject;
 }
 
-PolkitSubject *
-polkit_subject_new_for_real (_PolkitSubject *real)
-{
-  PolkitSubject *s;
-  const gchar *kind;
-  EggDBusHashMap *details;
-  EggDBusVariant *variant;
-  EggDBusVariant *variant2;
-
-  s = NULL;
-
-  kind = _polkit_subject_get_subject_kind (real);
-  details = _polkit_subject_get_subject_details (real);
-
-  if (strcmp (kind, "") == 0)
-    {
-      /* explicitly left blank (for subjects that are NULL) */
-    }
-  else if (strcmp (kind, "unix-process") == 0)
-    {
-      variant = egg_dbus_hash_map_lookup (details, "pid");
-      variant2 = egg_dbus_hash_map_lookup (details, "start-time");
-      if (variant != NULL && variant2 != NULL)
-        s = polkit_unix_process_new_full (egg_dbus_variant_get_uint (variant),
-                                          egg_dbus_variant_get_uint64 (variant2));
-    }
-  else if (strcmp (kind, "unix-session") == 0)
-    {
-      variant = egg_dbus_hash_map_lookup (details, "session-id");
-      if (variant != NULL)
-        s = polkit_unix_session_new (egg_dbus_variant_get_string (variant));
-    }
-  else if (strcmp (kind, "system-bus-name") == 0)
-    {
-      variant = egg_dbus_hash_map_lookup (details, "name");
-      if (variant != NULL)
-        s = polkit_system_bus_name_new (egg_dbus_variant_get_string (variant));
-    }
-  else
-    {
-      g_warning ("Unknown subject kind %s:", kind);
-    }
-
-  return s;
-}
-
-_PolkitSubject *
-polkit_subject_get_real (PolkitSubject *subject)
-{
-  _PolkitSubject *real;
-  const gchar *kind;
-  EggDBusHashMap *details;
-
-  real = NULL;
-  kind = NULL;
-  details = egg_dbus_hash_map_new (G_TYPE_STRING, NULL, EGG_DBUS_TYPE_VARIANT, (GDestroyNotify) g_object_unref);
-
-  if (subject == NULL)
-    {
-      kind = "";
-    }
-  else if (POLKIT_IS_UNIX_PROCESS (subject))
-    {
-      kind = "unix-process";
-      egg_dbus_hash_map_insert (details,
-                                "pid",
-                                egg_dbus_variant_new_for_uint (polkit_unix_process_get_pid (POLKIT_UNIX_PROCESS (subject))));
-      egg_dbus_hash_map_insert (details,
-                                "start-time",
-                                egg_dbus_variant_new_for_uint64 (polkit_unix_process_get_start_time (POLKIT_UNIX_PROCESS (subject))));
-    }
-  else if (POLKIT_IS_UNIX_SESSION (subject))
-    {
-      kind = "unix-session";
-      egg_dbus_hash_map_insert (details,
-                                "session-id",
-                                egg_dbus_variant_new_for_string (polkit_unix_session_get_session_id (POLKIT_UNIX_SESSION (subject))));
-    }
-  else if (POLKIT_IS_SYSTEM_BUS_NAME (subject))
-    {
-      kind = "system-bus-name";
-      egg_dbus_hash_map_insert (details,
-                                "name",
-                                egg_dbus_variant_new_for_string (polkit_system_bus_name_get_name (POLKIT_SYSTEM_BUS_NAME (subject))));
-    }
-  else
-    {
-      g_warning ("Unknown class %s implementing PolkitSubject", g_type_name (G_TYPE_FROM_INSTANCE (subject)));
-    }
-
-  if (kind != NULL)
-    {
-      real = _polkit_subject_new (kind, details);
-    }
-
-  if (details != NULL)
-    g_object_unref (details);
-
-  return real;
-}
-
 GVariant *
 polkit_subject_to_gvariant (PolkitSubject *subject)
 {
diff --git a/src/polkit/polkitsystembusname.c b/src/polkit/polkitsystembusname.c
index 4c9b812..bde6bca 100644
--- a/src/polkit/polkitsystembusname.c
+++ b/src/polkit/polkitsystembusname.c
@@ -226,38 +226,59 @@ polkit_system_bus_name_to_string (PolkitSubject *subject)
   return g_strdup_printf ("system-bus-name:%s", system_bus_name->name);
 }
 
+static gboolean
+polkit_system_bus_name_exists_sync (PolkitSubject   *subject,
+                                    GCancellable    *cancellable,
+                                    GError         **error)
+{
+  PolkitSystemBusName *name = POLKIT_SYSTEM_BUS_NAME (subject);
+  GDBusConnection *connection;
+  GVariant *result;
+  gboolean ret;
+
+  ret = FALSE;
+
+  connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, cancellable, error);
+  if (connection == NULL)
+    goto out;
+
+  result = g_dbus_connection_call_sync (connection,
+                                        "org.freedesktop.DBus",   /* name */
+                                        "/org/freedesktop/DBus",  /* object path */
+                                        "org.freedesktop.DBus",   /* interface name */
+                                        "NameHasOwner",           /* method */
+                                        g_variant_new ("(s)", name->name),
+                                        G_VARIANT_TYPE ("(b)"),
+                                        G_DBUS_CALL_FLAGS_NONE,
+                                        -1,
+                                        cancellable,
+                                        error);
+  if (result == NULL)
+    goto out;
+
+  g_variant_get (result, "(b)", &ret);
+  g_variant_unref (result);
+
+ out:
+  if (connection != NULL)
+    g_object_unref (connection);
+  return ret;
+}
 
 static void
-name_exists_cb (GObject      *source_object,
-                GAsyncResult *res,
-                gpointer      user_data)
+exists_in_thread_func (GSimpleAsyncResult *res,
+                       GObject            *object,
+                       GCancellable       *cancellable)
 {
-  GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (user_data);
-  EggDBusMessage *reply;
   GError *error;
-
   error = NULL;
-  reply = egg_dbus_connection_send_message_with_reply_finish (EGG_DBUS_CONNECTION (source_object),
-                                                              res,
-                                                              &error);
-  if (reply != NULL)
-    {
-      gboolean has_owner;
-      if (egg_dbus_message_extract_boolean (reply, &has_owner, &error))
-        {
-          g_simple_async_result_set_op_res_gboolean (simple, has_owner);
-        }
-      g_object_unref (reply);
-    }
-
-  if (error != NULL)
+  if (!polkit_system_bus_name_exists_sync (POLKIT_SUBJECT (object),
+                                           cancellable,
+                                           &error))
     {
-      g_simple_async_result_set_from_error (simple, error);
+      g_simple_async_result_set_from_error (res, error);
       g_error_free (error);
     }
-
-  g_simple_async_result_complete (simple);
-  g_object_unref (simple);
 }
 
 static void
@@ -266,88 +287,19 @@ polkit_system_bus_name_exists (PolkitSubject       *subject,
                                GAsyncReadyCallback  callback,
                                gpointer             user_data)
 {
-  PolkitSystemBusName *name = POLKIT_SYSTEM_BUS_NAME (subject);
-  EggDBusMessage *message;
-  EggDBusConnection *connection;
   GSimpleAsyncResult *simple;
 
-  message = NULL;
-  connection = NULL;
-
-  connection = egg_dbus_connection_get_for_bus (EGG_DBUS_BUS_TYPE_SYSTEM);
+  g_return_if_fail (POLKIT_IS_SYSTEM_BUS_NAME (subject));
 
-  message = egg_dbus_connection_new_message_for_method_call (connection,
-                                                             NULL,
-                                                             "org.freedesktop.DBus",
-                                                             "/org/freedesktop/DBus",
-                                                             "org.freedesktop.DBus",
-                                                             "NameHasOwner");
-  egg_dbus_message_append_string (message, name->name, NULL);
-
-  simple = g_simple_async_result_new (G_OBJECT (name),
+  simple = g_simple_async_result_new (G_OBJECT (subject),
                                       callback,
                                       user_data,
                                       polkit_system_bus_name_exists);
-
-  egg_dbus_connection_send_message_with_reply (connection,
-                                               EGG_DBUS_CALL_FLAGS_NONE,
-                                               message,
-                                               NULL,
-                                               cancellable,
-                                               name_exists_cb,
-                                               simple);
-
-  g_object_unref (message);
-  g_object_unref (connection);
-}
-
-static gboolean
-polkit_system_bus_name_exists_sync (PolkitSubject   *subject,
-                                    GCancellable    *cancellable,
-                                    GError         **error)
-{
-  PolkitSystemBusName *name = POLKIT_SYSTEM_BUS_NAME (subject);
-  EggDBusMessage *message;
-  EggDBusMessage *reply;
-  EggDBusConnection *connection;
-  gboolean ret;
-
-  message = NULL;
-  reply = NULL;
-  connection = NULL;
-  ret = FALSE;
-
-  connection = egg_dbus_connection_get_for_bus (EGG_DBUS_BUS_TYPE_SYSTEM);
-
-  message = egg_dbus_connection_new_message_for_method_call (connection,
-                                                             NULL,
-                                                             "org.freedesktop.DBus",
-                                                             "/org/freedesktop/DBus",
-                                                             "org.freedesktop.DBus",
-                                                             "NameHasOwner");
-  egg_dbus_message_append_string (message, name->name, NULL);
-
-  reply = egg_dbus_connection_send_message_with_reply_sync (connection,
-                                                            EGG_DBUS_CALL_FLAGS_NONE,
-                                                            message,
-                                                            NULL,
-                                                            cancellable,
-                                                            error);
-  if (reply == NULL)
-    goto out;
-
-  if (!egg_dbus_message_extract_boolean (reply, &ret, error))
-    goto out;
-
- out:
-  if (message != NULL)
-    g_object_unref (message);
-  if (reply != NULL)
-    g_object_unref (reply);
-  if (connection != NULL)
-    g_object_unref (connection);
-
-  return ret;
+  g_simple_async_result_run_in_thread (simple,
+                                       exists_in_thread_func,
+                                       G_PRIORITY_DEFAULT,
+                                       cancellable);
+  g_object_unref (simple);
 }
 
 static gboolean
@@ -399,27 +351,39 @@ polkit_system_bus_name_get_process_sync (PolkitSystemBusName  *system_bus_name,
                                          GCancellable         *cancellable,
                                          GError              **error)
 {
-  EggDBusConnection *connection;
+  GDBusConnection *connection;
   PolkitSubject *ret;
-  pid_t pid;
+  GVariant *result;
+  guint32 pid;
 
   ret = NULL;
 
-  connection = egg_dbus_connection_get_for_bus (EGG_DBUS_BUS_TYPE_SYSTEM);
-  if (!egg_dbus_bus_get_connection_unix_process_id_sync (egg_dbus_connection_get_bus (connection),
-                                                         EGG_DBUS_CALL_FLAGS_NONE,
-                                                         system_bus_name->name,
-                                                         &pid,
-                                                         cancellable,
-                                                         error))
-    {
-      goto out;
-    }
+  connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, cancellable, error);
+  if (connection == NULL)
+    goto out;
+
+  result = g_dbus_connection_call_sync (connection,
+                                        "org.freedesktop.DBus",       /* name */
+                                        "/org/freedesktop/DBus",      /* object path */
+                                        "org.freedesktop.DBus",       /* interface name */
+                                        "GetConnectionUnixProcessID", /* method */
+                                        g_variant_new ("(s)", system_bus_name->name),
+                                        G_VARIANT_TYPE ("(u)"),
+                                        G_DBUS_CALL_FLAGS_NONE,
+                                        -1,
+                                        cancellable,
+                                        error);
+  if (result == NULL)
+    goto out;
+
+  g_variant_get (result, "(u)", &pid);
+  g_variant_unref (result);
 
   ret = polkit_unix_process_new (pid);
 
  out:
-  g_object_unref (connection);
+  if (connection != NULL)
+    g_object_unref (connection);
   return ret;
 }
 
diff --git a/src/polkit/polkittemporaryauthorization.c b/src/polkit/polkittemporaryauthorization.c
index 3126b18..d6e946b 100644
--- a/src/polkit/polkittemporaryauthorization.c
+++ b/src/polkit/polkittemporaryauthorization.c
@@ -26,7 +26,6 @@
 #include <string.h>
 #include "polkitimplicitauthorization.h"
 #include "polkittemporaryauthorization.h"
-#include "_polkittemporaryauthorization.h"
 
 #include "polkitprivate.h"
 
@@ -47,9 +46,11 @@ struct _PolkitTemporaryAuthorization
 {
   GObject parent_instance;
 
-  _PolkitTemporaryAuthorization *real;
-
-  gchar **annotation_keys;
+  gchar *id;
+  gchar *action_id;
+  PolkitSubject *subject;
+  guint64 time_obtained;
+  guint64 time_expires;
 };
 
 struct _PolkitTemporaryAuthorizationClass
@@ -67,11 +68,11 @@ polkit_temporary_authorization_init (PolkitTemporaryAuthorization *authorization
 static void
 polkit_temporary_authorization_finalize (GObject *object)
 {
-  PolkitTemporaryAuthorization *authorization;
-
-  authorization = POLKIT_TEMPORARY_AUTHORIZATION (object);
+  PolkitTemporaryAuthorization *authorization = POLKIT_TEMPORARY_AUTHORIZATION (object);
 
-  g_object_unref (authorization->real);
+  g_free (authorization->id);
+  g_free (authorization->action_id);
+  g_object_unref (authorization->subject);
 
   if (G_OBJECT_CLASS (polkit_temporary_authorization_parent_class)->finalize != NULL)
     G_OBJECT_CLASS (polkit_temporary_authorization_parent_class)->finalize (object);
@@ -104,42 +105,16 @@ polkit_temporary_authorization_new (const gchar                  *id,
                                     guint64                       time_obtained,
                                     guint64                       time_expires)
 {
-  PolkitTemporaryAuthorization *ret;
-  _PolkitTemporaryAuthorization *real;
-  _PolkitSubject *real_subject;
-
-  real_subject = polkit_subject_get_real (subject);
-  real = _polkit_temporary_authorization_new (id,
-                                              action_id,
-                                              real_subject,
-                                              time_obtained,
-                                              time_expires);
-  g_object_unref (real_subject);
-
-  ret = polkit_temporary_authorization_new_for_real (real);
-  g_object_unref (real);
-
-  return ret;
-}
-
-
-PolkitTemporaryAuthorization *
-polkit_temporary_authorization_new_for_real (_PolkitTemporaryAuthorization *real)
-{
   PolkitTemporaryAuthorization *authorization;
-
   authorization = POLKIT_TEMPORARY_AUTHORIZATION (g_object_new (POLKIT_TYPE_TEMPORARY_AUTHORIZATION, NULL));
-  authorization->real = g_object_ref (real);
-
+  authorization->id = g_strdup (id);
+  authorization->action_id = g_strdup (action_id);
+  authorization->subject = g_object_ref (subject);
+  authorization->time_obtained = time_obtained;
+  authorization->time_expires = time_expires;
   return authorization;
 }
 
-_PolkitTemporaryAuthorization *
-polkit_temporary_authorization_get_real (PolkitTemporaryAuthorization *authorization)
-{
-  return g_object_ref (authorization->real);
-}
-
 /**
  * polkit_temporary_authorization_get_id:
  * @authorization: A #PolkitTemporaryAuthorization.
@@ -151,7 +126,7 @@ polkit_temporary_authorization_get_real (PolkitTemporaryAuthorization *authoriza
 const gchar *
 polkit_temporary_authorization_get_id (PolkitTemporaryAuthorization *authorization)
 {
-  return _polkit_temporary_authorization_get_id (authorization->real);
+  return authorization->id;
 }
 
 /**
@@ -165,7 +140,7 @@ polkit_temporary_authorization_get_id (PolkitTemporaryAuthorization *authorizati
 const gchar *
 polkit_temporary_authorization_get_action_id (PolkitTemporaryAuthorization *authorization)
 {
-  return _polkit_temporary_authorization_get_action_id (authorization->real);
+  return authorization->action_id;
 }
 
 /**
@@ -179,7 +154,7 @@ polkit_temporary_authorization_get_action_id (PolkitTemporaryAuthorization *auth
 PolkitSubject *
 polkit_temporary_authorization_get_subject (PolkitTemporaryAuthorization *authorization)
 {
-  return polkit_subject_new_for_real (_polkit_temporary_authorization_get_subject (authorization->real));
+  return g_object_ref (authorization->subject);
 }
 
 /**
@@ -193,7 +168,7 @@ polkit_temporary_authorization_get_subject (PolkitTemporaryAuthorization *author
 guint64
 polkit_temporary_authorization_get_time_obtained (PolkitTemporaryAuthorization *authorization)
 {
-  return _polkit_temporary_authorization_get_time_obtained (authorization->real);
+  return authorization->time_obtained;
 }
 
 /**
@@ -207,7 +182,7 @@ polkit_temporary_authorization_get_time_obtained (PolkitTemporaryAuthorization *
 guint64
 polkit_temporary_authorization_get_time_expires (PolkitTemporaryAuthorization *authorization)
 {
-  return _polkit_temporary_authorization_get_time_expires (authorization->real);
+  return authorization->time_expires;
 }
 
 PolkitTemporaryAuthorization *
@@ -220,31 +195,18 @@ polkit_temporary_authorization_new_for_gvariant (GVariant *value)
 GVariant *
 polkit_temporary_authorization_to_gvariant (PolkitTemporaryAuthorization *authorization)
 {
-  const gchar *id;
-  const gchar *action_id;
-  PolkitSubject *subject;
-  guint64 time_obtained;
-  guint64 time_expires;
   GVariant *ret;
   GVariant *subject_gvariant;
 
-  id = polkit_temporary_authorization_get_id (authorization);
-  action_id = polkit_temporary_authorization_get_action_id (authorization);
-  subject = polkit_temporary_authorization_get_subject (authorization);
-  time_obtained = polkit_temporary_authorization_get_time_obtained (authorization);
-  time_expires = polkit_temporary_authorization_get_time_expires (authorization);
-
-  subject_gvariant = polkit_subject_to_gvariant (subject);
+  subject_gvariant = polkit_subject_to_gvariant (authorization->subject);
   g_variant_ref_sink (subject_gvariant);
   ret = g_variant_new ("(ss@(sa{sv})tt)",
-                       id,
-                       action_id,
+                       authorization->id,
+                       authorization->action_id,
                        subject_gvariant,
-                       time_obtained,
-                       time_expires);
-
+                       authorization->time_obtained,
+                       authorization->time_expires);
   g_variant_unref (subject_gvariant);
-  g_object_unref (subject);
 
   return ret;
 }
diff --git a/src/polkit/polkitunixsession.c b/src/polkit/polkitunixsession.c
index cdf49d2..d9a6e8f 100644
--- a/src/polkit/polkitunixsession.c
+++ b/src/polkit/polkitunixsession.c
@@ -347,29 +347,59 @@ polkit_unix_session_to_string (PolkitSubject *subject)
   return g_strdup_printf ("unix-session:%s", session->session_id);
 }
 
+static gboolean
+polkit_unix_session_exists_sync (PolkitSubject   *subject,
+                                    GCancellable    *cancellable,
+                                    GError         **error)
+{
+  PolkitUnixSession *session = POLKIT_UNIX_SESSION (subject);
+  GDBusConnection *connection;
+  GVariant *result;
+  gboolean ret;
+
+  ret = FALSE;
+
+  connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, cancellable, error);
+  if (connection == NULL)
+    goto out;
+
+  result = g_dbus_connection_call_sync (connection,
+                                        "org.freedesktop.ConsoleKit",           /* name */
+                                        session->session_id,                    /* object path */
+                                        "org.freedesktop.ConsoleKit.Session",   /* interface name */
+                                        "GetUser",                              /* method */
+                                        NULL, /* parameters */
+                                        G_VARIANT_TYPE ("(u)"),
+                                        G_DBUS_CALL_FLAGS_NONE,
+                                        -1,
+                                        cancellable,
+                                        error);
+  if (result == NULL)
+    goto out;
+
+  ret = TRUE;
+  g_variant_unref (result);
+
+ out:
+  if (connection != NULL)
+    g_object_unref (connection);
+  return ret;
+}
+
 static void
-session_exists_cb (GObject      *source_object,
-                   GAsyncResult *res,
-                   gpointer      user_data)
+exists_in_thread_func (GSimpleAsyncResult *res,
+                       GObject            *object,
+                       GCancellable       *cancellable)
 {
-  GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (user_data);
-  EggDBusMessage *reply;
   GError *error;
-
   error = NULL;
-  reply = egg_dbus_connection_send_message_with_reply_finish (EGG_DBUS_CONNECTION (source_object),
-                                                              res,
-                                                              &error);
-  if (error != NULL)
+  if (!polkit_unix_session_exists_sync (POLKIT_SUBJECT (object),
+                                        cancellable,
+                                        &error))
     {
-      g_simple_async_result_set_from_error (simple, error);
+      g_simple_async_result_set_from_error (res, error);
       g_error_free (error);
     }
-  if (reply != NULL)
-    g_object_unref (reply);
-
-  g_simple_async_result_complete (simple);
-  g_object_unref (simple);
 }
 
 static void
@@ -378,91 +408,25 @@ polkit_unix_session_exists (PolkitSubject       *subject,
                             GAsyncReadyCallback  callback,
                             gpointer             user_data)
 {
-  PolkitUnixSession *session = POLKIT_UNIX_SESSION (subject);
-  EggDBusMessage *message;
-  EggDBusConnection *connection;
   GSimpleAsyncResult *simple;
 
-  message = NULL;
-  connection = NULL;
+  g_return_if_fail (POLKIT_IS_UNIX_SESSION (subject));
 
-  connection = egg_dbus_connection_get_for_bus (EGG_DBUS_BUS_TYPE_SYSTEM);
-
-  message = egg_dbus_connection_new_message_for_method_call (connection,
-                                                             NULL,
-                                                             "org.freedesktop.ConsoleKit",
-                                                             session->session_id,
-                                                             "org.freedesktop.ConsoleKit.Session",
-                                                             "GetUser");
-
-  simple = g_simple_async_result_new (G_OBJECT (session),
+  simple = g_simple_async_result_new (G_OBJECT (subject),
                                       callback,
                                       user_data,
                                       polkit_unix_session_exists);
-
-  egg_dbus_connection_send_message_with_reply (connection,
-                                               EGG_DBUS_CALL_FLAGS_NONE,
-                                               message,
-                                               NULL,
-                                               cancellable,
-                                               session_exists_cb,
-                                               simple);
-
-  g_object_unref (message);
-  g_object_unref (connection);
-}
-
-static gboolean
-polkit_unix_session_exists_sync (PolkitSubject   *subject,
-                                 GCancellable    *cancellable,
-                                 GError         **error)
-{
-  PolkitUnixSession *session = POLKIT_UNIX_SESSION (subject);
-  EggDBusMessage *message;
-  EggDBusMessage *reply;
-  EggDBusConnection *connection;
-  gboolean ret;
-
-  message = NULL;
-  reply = NULL;
-  connection = NULL;
-  ret = FALSE;
-
-  connection = egg_dbus_connection_get_for_bus (EGG_DBUS_BUS_TYPE_SYSTEM);
-
-  message = egg_dbus_connection_new_message_for_method_call (connection,
-                                                             NULL,
-                                                             "org.freedesktop.ConsoleKit",
-                                                             session->session_id,
-                                                             "org.freedesktop.ConsoleKit.Session",
-                                                             "GetUser");
-
-  reply = egg_dbus_connection_send_message_with_reply_sync (connection,
-                                                            EGG_DBUS_CALL_FLAGS_NONE,
-                                                            message,
-                                                            NULL,
-                                                            cancellable,
-                                                            error);
-  if (reply == NULL)
-    goto out;
-
-  ret = TRUE;
-
- out:
-  if (message != NULL)
-    g_object_unref (message);
-  if (reply != NULL)
-    g_object_unref (reply);
-  if (connection != NULL)
-    g_object_unref (connection);
-
-  return ret;
+  g_simple_async_result_run_in_thread (simple,
+                                       exists_in_thread_func,
+                                       G_PRIORITY_DEFAULT,
+                                       cancellable);
+  g_object_unref (simple);
 }
 
 static gboolean
 polkit_unix_session_exists_finish (PolkitSubject  *subject,
-                                   GAsyncResult   *res,
-                                   GError        **error)
+                                      GAsyncResult   *res,
+                                      GError        **error)
 {
   GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (res);
   gboolean ret;
@@ -474,7 +438,7 @@ polkit_unix_session_exists_finish (PolkitSubject  *subject,
   if (g_simple_async_result_propagate_error (simple, error))
     goto out;
 
-  ret = TRUE;
+  ret = g_simple_async_result_get_op_res_gboolean (simple);
 
  out:
   return ret;
@@ -497,45 +461,44 @@ polkit_unix_session_initable_init (GInitable     *initable,
                                    GError       **error)
 {
   PolkitUnixSession *session = POLKIT_UNIX_SESSION (initable);
-  EggDBusMessage *message;
-  EggDBusMessage *reply;
-  EggDBusConnection *connection;
+  GDBusConnection *connection;
+  GVariant *result;
   gboolean ret;
 
-  message = NULL;
-  reply = NULL;
   connection = NULL;
   ret = FALSE;
 
-  connection = egg_dbus_connection_get_for_bus (EGG_DBUS_BUS_TYPE_SYSTEM);
-
-  message = egg_dbus_connection_new_message_for_method_call (connection,
-                                                             NULL,
-                                                             "org.freedesktop.ConsoleKit",
-                                                             "/org/freedesktop/ConsoleKit/Manager",
-                                                             "org.freedesktop.ConsoleKit.Manager",
-                                                             "GetSessionForUnixProcess");
-  egg_dbus_message_append_uint (message, session->pid, NULL);
-
-  reply = egg_dbus_connection_send_message_with_reply_sync (connection,
-                                                            EGG_DBUS_CALL_FLAGS_NONE,
-                                                            message,
-                                                            NULL,
-                                                            cancellable,
-                                                            error);
-  if (reply == NULL)
+  if (session->session_id != NULL)
+    {
+      /* already set, nothing to do */
+      ret = TRUE;
+      goto out;
+    }
+
+  connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, cancellable, error);
+  if (connection == NULL)
     goto out;
 
-  if (!egg_dbus_message_extract_object_path (reply, &session->session_id, error))
+  result = g_dbus_connection_call_sync (connection,
+                                        "org.freedesktop.ConsoleKit",           /* name */
+                                        "/org/freedesktop/ConsoleKit/Manager",  /* object path */
+                                        "org.freedesktop.ConsoleKit.Manager",   /* interface name */
+                                        "GetSessionForUnixProcess",             /* method */
+                                        g_variant_new ("(u)", session->pid),    /* parameters */
+                                        G_VARIANT_TYPE ("(o)"),
+                                        G_DBUS_CALL_FLAGS_NONE,
+                                        -1,
+                                        cancellable,
+                                        error);
+  if (result == NULL)
     goto out;
 
+  g_variant_get (result, "(o)", &session->session_id);
+  g_variant_unref (result);
+
   ret = TRUE;
 
  out:
-  if (message != NULL)
-    g_object_unref (message);
-  if (reply != NULL)
-    g_object_unref (reply);
   if (connection != NULL)
     g_object_unref (connection);
 
@@ -549,109 +512,7 @@ initable_iface_init (GInitableIface *initable_iface)
 }
 
 static void
-async_init_cb (GObject      *source_object,
-               GAsyncResult *res,
-               gpointer      user_data)
-{
-  GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (user_data);
-  EggDBusMessage *reply;
-  GError *error;
-
-  error = NULL;
-  reply = egg_dbus_connection_send_message_with_reply_finish (EGG_DBUS_CONNECTION (source_object),
-                                                              res,
-                                                              &error);
-
-  if (reply != NULL)
-    {
-      gchar *session_id;
-      if (egg_dbus_message_extract_object_path (reply, &session_id, &error))
-        {
-          g_simple_async_result_set_op_res_gpointer (simple,
-                                                     session_id,
-                                                     g_free);
-        }
-      g_object_unref (reply);
-    }
-
-  if (error != NULL)
-    {
-      g_simple_async_result_set_from_error (simple, error);
-      g_error_free (error);
-    }
-
-  g_simple_async_result_complete (simple);
-  g_object_unref (simple);
-}
-
-static void
-polkit_unix_session_async_initable_init_async (GAsyncInitable      *async_initable,
-                                               gint                 io_priority,
-                                               GCancellable        *cancellable,
-                                               GAsyncReadyCallback  callback,
-                                               gpointer             user_data)
-{
-  PolkitUnixSession *session = POLKIT_UNIX_SESSION (async_initable);
-  EggDBusMessage *message;
-  EggDBusConnection *connection;
-  GSimpleAsyncResult *simple;
-
-  message = NULL;
-  connection = NULL;
-
-  connection = egg_dbus_connection_get_for_bus (EGG_DBUS_BUS_TYPE_SYSTEM);
-
-  message = egg_dbus_connection_new_message_for_method_call (connection,
-                                                             NULL,
-                                                             "org.freedesktop.ConsoleKit",
-                                                             "/org/freedesktop/ConsoleKit/Manager",
-                                                             "org.freedesktop.ConsoleKit.Manager",
-                                                             "GetSessionForUnixProcess");
-  egg_dbus_message_append_uint (message, session->pid, NULL);
-
-  simple = g_simple_async_result_new (G_OBJECT (session),
-                                      callback,
-                                      user_data,
-                                      polkit_unix_session_async_initable_init_async);
-
-  egg_dbus_connection_send_message_with_reply (connection,
-                                               EGG_DBUS_CALL_FLAGS_NONE,
-                                               message,
-                                               NULL,
-                                               cancellable,
-                                               async_init_cb,
-                                               simple);
-
-  g_object_unref (message);
-  g_object_unref (connection);
-}
-
-static gboolean
-polkit_unix_session_async_initable_init_finish (GAsyncInitable   *async_initable,
-                                                GAsyncResult     *res,
-                                                GError          **error)
-{
-  PolkitUnixSession *session = POLKIT_UNIX_SESSION (async_initable);
-  GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (res);
-  gboolean ret;
-
-  ret = FALSE;
-
-  g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == polkit_unix_session_async_initable_init_async);
-
-  if (g_simple_async_result_propagate_error (simple, error))
-    goto out;
-
-  session->session_id = g_strdup (g_simple_async_result_get_op_res_gpointer (simple));
-  ret = TRUE;
-
- out:
-  return ret;
-}
-
-static void
 async_initable_iface_init (GAsyncInitableIface *async_initable_iface)
 {
-  async_initable_iface->init_async = polkit_unix_session_async_initable_init_async;
-  async_initable_iface->init_finish = polkit_unix_session_async_initable_init_finish;
+  /* use default implementation to run GInitable code in a thread */
 }
diff --git a/src/polkitagent/Makefile.am b/src/polkitagent/Makefile.am
index 820be4d..8776599 100644
--- a/src/polkitagent/Makefile.am
+++ b/src/polkitagent/Makefile.am
@@ -14,7 +14,6 @@ INCLUDES =                                                      \
         -DPACKAGE_LIB_DIR=\""$(libdir)"\"                       \
         -D_POSIX_PTHREAD_SEMANTICS                              \
         -D_REENTRANT                                            \
-	-DEGG_DBUS_I_KNOW_API_IS_SUBJECT_TO_CHANGE		\
         $(NULL)
 
 BUILT_SOURCES = 						\
@@ -52,14 +51,11 @@ libpolkit_agent_1_la_CFLAGS =                                        	\
         -D_POLKIT_COMPILATION                                  		\
 	-D_POLKIT_AGENT_COMPILATION					\
         $(GLIB_CFLAGS)							\
-        $(EGG_DBUS_CFLAGS)						\
         $(NULL)
 
 libpolkit_agent_1_la_LIBADD =                               		\
         $(GLIB_LIBS)							\
-        $(EGG_DBUS_LIBS)						\
 	$(top_builddir)/src/polkit/libpolkit-gobject-1.la		\
-	$(top_builddir)/src/polkit/libpolkit-private.la			\
 	$(EXPAT_LIBS)							\
         $(NULL)
 
diff --git a/src/polkitbackend/Makefile.am b/src/polkitbackend/Makefile.am
index 968c1b8..2d3f487 100644
--- a/src/polkitbackend/Makefile.am
+++ b/src/polkitbackend/Makefile.am
@@ -14,7 +14,6 @@ INCLUDES =                                                      \
         -DPACKAGE_LIB_DIR=\""$(libdir)"\"                       \
         -D_POSIX_PTHREAD_SEMANTICS                              \
         -D_REENTRANT                                            \
-	-DEGG_DBUS_I_KNOW_API_IS_SUBJECT_TO_CHANGE		\
         $(NULL)
 
 lib_LTLIBRARIES=libpolkit-backend-1.la
@@ -53,14 +52,11 @@ libpolkit_backend_1_la_CFLAGS =                                        	\
         -D_POLKIT_COMPILATION                                  		\
         -D_POLKIT_BACKEND_COMPILATION                                  	\
         $(GLIB_CFLAGS)							\
-        $(EGG_DBUS_CFLAGS)						\
         $(NULL)
 
 libpolkit_backend_1_la_LIBADD =                               		\
         $(GLIB_LIBS)							\
-        $(EGG_DBUS_LIBS)						\
 	$(top_builddir)/src/polkit/libpolkit-gobject-1.la		\
-	$(top_builddir)/src/polkit/libpolkit-private.la			\
 	$(EXPAT_LIBS)							\
         $(NULL)
 
diff --git a/src/polkitbackend/polkitbackendactionpool.c b/src/polkitbackend/polkitbackendactionpool.c
index b59e549..30e9540 100644
--- a/src/polkitbackend/polkitbackendactionpool.c
+++ b/src/polkitbackend/polkitbackendactionpool.c
@@ -56,7 +56,7 @@ typedef struct
   GHashTable *localized_message;
 
   /* this maps from annotation key (string) to annotation value (also a string) */
-  EggDBusHashMap *annotations;
+  GHashTable *annotations;
 } ParsedAction;
 
 static void
@@ -72,7 +72,7 @@ parsed_action_free (ParsedAction *action)
   g_hash_table_unref (action->localized_description);
   g_hash_table_unref (action->localized_message);
 
-  g_object_unref (action->annotations);
+  g_hash_table_unref (action->annotations);
   g_free (action);
 }
 
@@ -365,7 +365,6 @@ polkit_backend_action_pool_get_action (PolkitBackendActionPool *pool,
 {
   PolkitBackendActionPoolPrivate *priv;
   PolkitActionDescription *ret;
-  _PolkitActionDescription *real;
   ParsedAction *parsed_action;
   const gchar *description;
   const gchar *message;
@@ -393,19 +392,16 @@ polkit_backend_action_pool_get_action (PolkitBackendActionPool *pool,
                        parsed_action->message,
                        locale);
 
-  real = _polkit_action_description_new (action_id,
-                                         description,
-                                         message,
-                                         parsed_action->vendor_name,
-                                         parsed_action->vendor_url,
-                                         parsed_action->icon_name,
-                                         parsed_action->implicit_authorization_any,
-                                         parsed_action->implicit_authorization_inactive,
-                                         parsed_action->implicit_authorization_active,
-                                         parsed_action->annotations);
-
-  ret = polkit_action_description_new_for_real (real);
-  g_object_unref (real);
+  ret = polkit_action_description_new (action_id,
+                                       description,
+                                       message,
+                                       parsed_action->vendor_name,
+                                       parsed_action->vendor_url,
+                                       parsed_action->icon_name,
+                                       parsed_action->implicit_authorization_any,
+                                       parsed_action->implicit_authorization_inactive,
+                                       parsed_action->implicit_authorization_active,
+                                       parsed_action->annotations);
 
  out:
   return ret;
@@ -615,7 +611,7 @@ typedef struct {
   char *elem_lang;
 
   char *annotate_key;
-  EggDBusHashMap *annotations;
+  GHashTable *annotations;
 
   PolkitBackendActionPool *pool;
 } ParserData;
@@ -651,7 +647,7 @@ pd_unref_action_data (ParserData *pd)
   pd->annotate_key = NULL;
   if (pd->annotations != NULL)
     {
-      g_object_unref (pd->annotations);
+      g_hash_table_unref (pd->annotations);
       pd->annotations = NULL;
     }
   g_free (pd->elem_lang);
@@ -712,7 +708,7 @@ _start (void *data, const char *el, const char **attr)
                                                        g_str_equal,
                                                        g_free,
                                                        g_free);
-          pd->annotations = egg_dbus_hash_map_new (G_TYPE_STRING, g_free, G_TYPE_STRING, g_free);
+          pd->annotations = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
           /* initialize defaults */
           pd->implicit_authorization_any = POLKIT_IMPLICIT_AUTHORIZATION_NOT_AUTHORIZED;
           pd->implicit_authorization_inactive = POLKIT_IMPLICIT_AUTHORIZATION_NOT_AUTHORIZED;
@@ -943,9 +939,7 @@ _cdata (void *data, const char *s, int len)
       break;
 
     case STATE_IN_ANNOTATE:
-      egg_dbus_hash_map_insert (pd->annotations,
-                                g_strdup (pd->annotate_key),
-                                str);
+      g_hash_table_insert (pd->annotations, g_strdup (pd->annotate_key), str);
       str = NULL;
       break;
 
diff --git a/src/polkitbackend/polkitbackendinteractiveauthority.c b/src/polkitbackend/polkitbackendinteractiveauthority.c
index a63d5e0..c4f993f 100644
--- a/src/polkitbackend/polkitbackendinteractiveauthority.c
+++ b/src/polkitbackend/polkitbackendinteractiveauthority.c
@@ -419,7 +419,7 @@ _polkit_subject_get_cmdline (PolkitSubject *subject)
                             &contents_len,
                             &error))
     {
-      g_warning ("Error openeing `%s': %s",
+      g_warning ("Error opening `%s': %s",
                  filename,
                  error->message);
       g_error_free (error);
diff --git a/src/polkitbackend/polkitbackendprivate.h b/src/polkitbackend/polkitbackendprivate.h
index 6e7946e..900de99 100644
--- a/src/polkitbackend/polkitbackendprivate.h
+++ b/src/polkitbackend/polkitbackendprivate.h
@@ -22,6 +22,4 @@
 #ifndef __POLKIT_BACKEND_PRIVATE_H
 #define __POLKIT_BACKEND_PRIVATE_H
 
-#include <polkit/_polkitbindings.h>
-
 #endif /* __POLKIT_BACKEND_PRIVATE_H */
commit d04cd425c6049da749516f37252264f96109e179
Author: David Zeuthen <davidz at redhat.com>
Date:   Thu Jul 29 16:56:59 2010 -0400

    Add generated docbook D-Bus API docs to git
    
    When we switch away from eggdbus these will no longer be
    autogenerated.
    
    Signed-off-by: David Zeuthen <davidz at redhat.com>

diff --git a/docs/polkit/Makefile.am b/docs/polkit/Makefile.am
index bf05b92..370fb56 100644
--- a/docs/polkit/Makefile.am
+++ b/docs/polkit/Makefile.am
@@ -57,8 +57,8 @@ content_files =  			    								\
 	overview.xml											\
 	../extensiondir.xml			    							\
 	../version.xml			    								\
-	../../src/polkit/docbook-interface-org.freedesktop.PolicyKit1.Authority.xml			\
-	../../src/polkit/docbook-interface-org.freedesktop.PolicyKit1.AuthenticationAgent.xml		\
+	docbook-interface-org.freedesktop.PolicyKit1.Authority.xml					\
+	docbook-interface-org.freedesktop.PolicyKit1.AuthenticationAgent.xml				\
 	../man/polkit.xml										\
 	../man/polkitd.xml										\
 	../man/pklocalauthority.xml									\
diff --git a/docs/polkit/docbook-interface-org.freedesktop.PolicyKit1.AuthenticationAgent.xml b/docs/polkit/docbook-interface-org.freedesktop.PolicyKit1.AuthenticationAgent.xml
new file mode 100644
index 0000000..85bbcf0
--- /dev/null
+++ b/docs/polkit/docbook-interface-org.freedesktop.PolicyKit1.AuthenticationAgent.xml
@@ -0,0 +1,116 @@
+<?xml version="1.0"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2 //EN"
+"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
+<refentry id="eggdbus-interface-org.freedesktop.PolicyKit1.AuthenticationAgent">
+  <refmeta>
+    <refentrytitle role="top_of_page">org.freedesktop.PolicyKit1.AuthenticationAgent Interface</refentrytitle>
+  </refmeta>
+  <refnamediv>
+    <refname>org.freedesktop.PolicyKit1.AuthenticationAgent Interface</refname>
+    <refpurpose>Authentication Agent Interface</refpurpose>
+  </refnamediv>
+  <refsynopsisdiv role="synopsis">
+    <title role="synopsis.title">Methods</title>
+    <synopsis>
+<link linkend="eggdbus-method-org.freedesktop.PolicyKit1.AuthenticationAgent.BeginAuthentication">BeginAuthentication</link>  (IN  String               action_id,
+                      IN  String               message,
+                      IN  String               icon_name,
+                      IN  Dict&lt;String,String&gt;  details,
+                      IN  String               cookie,
+                      IN  Array&lt;<link linkend="eggdbus-struct-Identity">Identity</link>&gt;      identities)
+<link linkend="eggdbus-method-org.freedesktop.PolicyKit1.AuthenticationAgent.CancelAuthentication">CancelAuthentication</link> (IN  String               cookie)
+    </synopsis>
+  </refsynopsisdiv>
+  <refsect1 role="desc" id="eggdbus-if-description-org.freedesktop.PolicyKit1.AuthenticationAgent">
+    <title role="desc.title">Description</title>
+      <para>
+<para>This D-Bus interface is used for communication between the system-wide PolicyKit daemon and one or more authentication agents each running in a user session.</para><para>An authentication agent must implement this interface and register (passing the object path of the object implementing the interface) using the <link linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.RegisterAuthenticationAgent">RegisterAuthenticationAgent()</link> and <link linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.UnregisterAuthenticationAgent">UnregisterAuthenticationAgent()</link> methods on the <link linkend="eggdbus-interface-org.freedesktop.PolicyKit1.Authority">org.freedesktop.PolicyKit1.Authority</link> interface of the PolicyKit daemon.</para>
+      </para>
+  </refsect1>
+  <refsect1 role="details" id="eggdbus-if-method-details-org.freedesktop.PolicyKit1.AuthenticationAgent">
+    <title role="details.title">Method Details</title>
+    <refsect2 role="function" id="eggdbus-method-org.freedesktop.PolicyKit1.AuthenticationAgent.BeginAuthentication">
+      <title>BeginAuthentication ()</title>
+    <programlisting>
+BeginAuthentication (IN  String               action_id,
+                     IN  String               message,
+                     IN  String               icon_name,
+                     IN  Dict&lt;String,String&gt;  details,
+                     IN  String               cookie,
+                     IN  Array&lt;<link linkend="eggdbus-struct-Identity">Identity</link>&gt;      identities)
+    </programlisting>
+    <para>
+<para>Called by the PolicyKit daemon when the authentication agent needs the user to authenticate as one of the identities in <parameter>identities</parameter> for the action with the identifier <parameter>action_id</parameter>.</para><para>Upon succesful authentication, the authentication agent must invoke the <link linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.AuthenticationAgentResponse">AuthenticationAgentResponse()</link> method on the <link linkend="eggdbus-interface-org.freedesktop.PolicyKit1.Authority">org.freedesktop.PolicyKit1.Authority</link> interface of the PolicyKit daemon before returning.</para><para>If the user dismisses the authentication dialog, the authentication agent should return an error.</para>
+    </para>
+<variablelist role="params">
+  <varlistentry>
+    <term><literal>IN  String <parameter>action_id</parameter></literal>:</term>
+    <listitem>
+      <para>
+The identifier for the action that the user is authentication for.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><literal>IN  String <parameter>message</parameter></literal>:</term>
+    <listitem>
+      <para>
+The message to display to the user. This is translated into the locale passed when registering the authentication agent using <link linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.RegisterAuthenticationAgent">RegisterAuthenticationAgent()</link>.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><literal>IN  String <parameter>icon_name</parameter></literal>:</term>
+    <listitem>
+      <para>
+The themed icon describing the action or the empty string if no icon is set.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><literal>IN  Dict&lt;String,String&gt; <parameter>details</parameter></literal>:</term>
+    <listitem>
+      <para>
+Details about the authentication request. This is a dictionary of key/value pairs where both key and value are strings. These strings are translated into the locale passed when registering the authentication agent using <link linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.RegisterAuthenticationAgent">RegisterAuthenticationAgent()</link>.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><literal>IN  String <parameter>cookie</parameter></literal>:</term>
+    <listitem>
+      <para>
+A cookie identifying the authentication request.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><literal>IN  Array&lt;<link linkend="eggdbus-struct-Identity">Identity</link>&gt; <parameter>identities</parameter></literal>:</term>
+    <listitem>
+      <para>
+An array of <link linkend="eggdbus-struct-Identity">Identity</link> structs that the user can use for authentication.
+      </para>
+    </listitem>
+  </varlistentry>
+</variablelist>
+    </refsect2>
+    <refsect2 role="function" id="eggdbus-method-org.freedesktop.PolicyKit1.AuthenticationAgent.CancelAuthentication">
+      <title>CancelAuthentication ()</title>
+    <programlisting>
+CancelAuthentication (IN  String  cookie)
+    </programlisting>
+    <para>
+Called by the PolicyKit daemon if the authentication agent needs to cancel an authentication dialog.
+    </para>
+<variablelist role="params">
+  <varlistentry>
+    <term><literal>IN  String <parameter>cookie</parameter></literal>:</term>
+    <listitem>
+      <para>
+The cookie identifying the authentication request.
+      </para>
+    </listitem>
+  </varlistentry>
+</variablelist>
+    </refsect2>
+  </refsect1>
+</refentry>
diff --git a/docs/polkit/docbook-interface-org.freedesktop.PolicyKit1.Authority.xml b/docs/polkit/docbook-interface-org.freedesktop.PolicyKit1.Authority.xml
new file mode 100644
index 0000000..8b76fa2
--- /dev/null
+++ b/docs/polkit/docbook-interface-org.freedesktop.PolicyKit1.Authority.xml
@@ -0,0 +1,897 @@
+<?xml version="1.0"?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2 //EN"
+"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
+<refentry id="eggdbus-interface-org.freedesktop.PolicyKit1.Authority">
+  <refmeta>
+    <refentrytitle role="top_of_page">org.freedesktop.PolicyKit1.Authority Interface</refentrytitle>
+  </refmeta>
+  <refnamediv>
+    <refname>org.freedesktop.PolicyKit1.Authority Interface</refname>
+    <refpurpose>Authority Interface</refpurpose>
+  </refnamediv>
+  <refsynopsisdiv role="synopsis">
+    <title role="synopsis.title">Methods</title>
+    <synopsis>
+Flags        <link linkend="eggdbus-enum-CheckAuthorizationFlags">CheckAuthorizationFlags</link>
+Enumeration  <link linkend="eggdbus-enum-ImplicitAuthorization">ImplicitAuthorization</link>
+ErrorDomain  <link linkend="eggdbus-errordomain-org.freedesktop.PolicyKit1.Error.">org.freedesktop.PolicyKit1.Error.*</link>
+Flags        <link linkend="eggdbus-enum-AuthorityFeatures">AuthorityFeatures</link>
+Structure    <link linkend="eggdbus-struct-Subject">Subject</link>
+Structure    <link linkend="eggdbus-struct-Identity">Identity</link>
+Structure    <link linkend="eggdbus-struct-ActionDescription">ActionDescription</link>
+Structure    <link linkend="eggdbus-struct-AuthorizationResult">AuthorizationResult</link>
+Structure    <link linkend="eggdbus-struct-TemporaryAuthorization">TemporaryAuthorization</link>
+
+<link linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.EnumerateActions">EnumerateActions</link>                 (IN  String                         locale,
+                                  OUT Array&lt;<link linkend="eggdbus-struct-ActionDescription">ActionDescription</link>&gt;       action_descriptions)
+<link linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.CheckAuthorization">CheckAuthorization</link>               (IN  <link linkend="eggdbus-struct-Subject">Subject</link>                        subject,
+                                  IN  String                         action_id,
+                                  IN  Dict&lt;String,String&gt;            details,
+                                  IN  <link linkend="eggdbus-enum-CheckAuthorizationFlags">CheckAuthorizationFlags</link>        flags,
+                                  IN  String                         cancellation_id,
+                                  OUT <link linkend="eggdbus-struct-AuthorizationResult">AuthorizationResult</link>            result)
+<link linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.CancelCheckAuthorization">CancelCheckAuthorization</link>         (IN  String                         cancellation_id)
+<link linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.RegisterAuthenticationAgent">RegisterAuthenticationAgent</link>      (IN  <link linkend="eggdbus-struct-Subject">Subject</link>                        subject,
+                                  IN  String                         locale,
+                                  IN  String                         object_path)
+<link linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.UnregisterAuthenticationAgent">UnregisterAuthenticationAgent</link>    (IN  <link linkend="eggdbus-struct-Subject">Subject</link>                        subject,
+                                  IN  String                         object_path)
+<link linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.AuthenticationAgentResponse">AuthenticationAgentResponse</link>      (IN  String                         cookie,
+                                  IN  <link linkend="eggdbus-struct-Identity">Identity</link>                       identity)
+<link linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.EnumerateTemporaryAuthorizations">EnumerateTemporaryAuthorizations</link> (IN  <link linkend="eggdbus-struct-Subject">Subject</link>                        subject,
+                                  OUT Array&lt;<link linkend="eggdbus-struct-TemporaryAuthorization">TemporaryAuthorization</link>&gt;  temporary_authorizations)
+<link linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.RevokeTemporaryAuthorizations">RevokeTemporaryAuthorizations</link>    (IN  <link linkend="eggdbus-struct-Subject">Subject</link>                        subject)
+<link linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.RevokeTemporaryAuthorizationById">RevokeTemporaryAuthorizationById</link> (IN  String                         id)
+<link linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.AddLockdownForAction">AddLockdownForAction</link>             (IN  String                         action_id)
+<link linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.RemoveLockdownForAction">RemoveLockdownForAction</link>          (IN  String                         action_id)
+    </synopsis>
+  </refsynopsisdiv>
+  <refsect1 role="signal_proto" id="eggdbus-if-signals-org.freedesktop.PolicyKit1.Authority">
+    <title role="signal_proto.title">Signals</title>
+    <synopsis>
+<link linkend="eggdbus-signal-org.freedesktop.PolicyKit1.Authority::Changed">Changed</link> ()
+    </synopsis>
+  </refsect1>
+  <refsect1 role="properties" id="eggdbus-if-properties-org.freedesktop.PolicyKit1.Authority">
+    <title role="properties.title">Properties</title>
+    <synopsis>
+<link linkend="eggdbus-property-org.freedesktop.PolicyKit1.Authority:BackendName">BackendName</link>         readable     String
+<link linkend="eggdbus-property-org.freedesktop.PolicyKit1.Authority:BackendVersion">BackendVersion</link>      readable     String
+<link linkend="eggdbus-property-org.freedesktop.PolicyKit1.Authority:BackendFeatures">BackendFeatures</link>     readable     <link linkend="eggdbus-enum-AuthorityFeatures">AuthorityFeatures</link>
+    </synopsis>
+  </refsect1>
+  <refsect1 role="desc" id="eggdbus-if-description-org.freedesktop.PolicyKit1.Authority">
+    <title role="desc.title">Description</title>
+      <para>
+This D-Bus interface is implemented by the <literal>/org/freedesktop/PoliycKit1/Authority</literal> object on the well-known name <literal>org.freedesktop.PolicyKit1</literal> on the system message bus.
+      </para>
+  </refsect1>
+  <refsect1 role="desc" id="eggdbus-if-enumerations-org.freedesktop.PolicyKit1.Authority">
+    <title role="desc.title">Enumerations</title>
+    <refsect2 role="enum" id="eggdbus-enum-CheckAuthorizationFlags">
+      <title>The CheckAuthorizationFlags Flags</title>
+        <para>
+          <programlisting>
+{
+  None                 = 0x00000000,
+  AllowUserInteraction = 0x00000001
+}
+          </programlisting>
+          <para>
+Flags used in the <link linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.CheckAuthorization">CheckAuthorization()</link> method.
+          </para>
+          <variablelist role="constant">
+  <varlistentry id="eggdbus-constant-CheckAuthorizationFlags.None" role="constant">
+    <term><literal>None</literal></term>
+    <listitem>
+      <para>
+No flags set.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry id="eggdbus-constant-CheckAuthorizationFlags.AllowUserInteraction" role="constant">
+    <term><literal>AllowUserInteraction</literal></term>
+    <listitem>
+      <para>
+If the <link linkend="eggdbus-struct-Subject">Subject</link> can obtain the authorization through authentication, and an authentication agent is available, then attempt to do so. Note, this means that the <link linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.CheckAuthorization">CheckAuthorization()</link> method will block while the user is being asked to authenticate.
+      </para>
+    </listitem>
+  </varlistentry>
+          </variablelist>
+        </para>
+    </refsect2>
+    <refsect2 role="enum" id="eggdbus-enum-ImplicitAuthorization">
+      <title>The ImplicitAuthorization Enumeration</title>
+        <para>
+          <programlisting>
+{
+  NotAuthorized                               = 0,
+  AuthenticationRequired                      = 1,
+  AdministratorAuthenticationRequired         = 2,
+  AuthenticationRequiredRetained              = 3,
+  AdministratorAuthenticationRequiredRetained = 4,
+  Authorized                                  = 5
+}
+          </programlisting>
+          <para>
+An enumeration for granting implicit authorizations.
+          </para>
+          <variablelist role="constant">
+  <varlistentry id="eggdbus-constant-ImplicitAuthorization.NotAuthorized" role="constant">
+    <term><literal>NotAuthorized</literal></term>
+    <listitem>
+      <para>
+The <link linkend="eggdbus-struct-Subject">Subject</link> is not authorized.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry id="eggdbus-constant-ImplicitAuthorization.AuthenticationRequired" role="constant">
+    <term><literal>AuthenticationRequired</literal></term>
+    <listitem>
+      <para>
+Authentication is required.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry id="eggdbus-constant-ImplicitAuthorization.AdministratorAuthenticationRequired" role="constant">
+    <term><literal>AdministratorAuthenticationRequired</literal></term>
+    <listitem>
+      <para>
+Authentication as an administrator is required.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry id="eggdbus-constant-ImplicitAuthorization.AuthenticationRequiredRetained" role="constant">
+    <term><literal>AuthenticationRequiredRetained</literal></term>
+    <listitem>
+      <para>
+Authentication is required. If the authorization is obtained, it is retained.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry id="eggdbus-constant-ImplicitAuthorization.AdministratorAuthenticationRequiredRetained" role="constant">
+    <term><literal>AdministratorAuthenticationRequiredRetained</literal></term>
+    <listitem>
+      <para>
+Authentication as an administrator is required. If the authorization is obtained, it is retained.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry id="eggdbus-constant-ImplicitAuthorization.Authorized" role="constant">
+    <term><literal>Authorized</literal></term>
+    <listitem>
+      <para>
+The subject is authorized.
+      </para>
+    </listitem>
+  </varlistentry>
+          </variablelist>
+        </para>
+    </refsect2>
+    <refsect2 role="enum" id="eggdbus-errordomain-org.freedesktop.PolicyKit1.Error.">      <title>The org.freedesktop.PolicyKit1.Error.* Error Domain</title>
+        <para>
+          <programlisting>
+{
+  org.freedesktop.PolicyKit1.Error.Failed,
+  org.freedesktop.PolicyKit1.Error.Cancelled,
+  org.freedesktop.PolicyKit1.Error.NotSupported,
+  org.freedesktop.PolicyKit1.Error.NotAuthorized,
+  org.freedesktop.PolicyKit1.Error.CancellationIdNotUnique
+}
+          </programlisting>
+          <para>
+Errors that can be returned by various method calls.
+          </para>
+          <variablelist role="constant">
+  <varlistentry id="eggdbus-constant-Error.org.freedesktop.PolicyKit1.Error.Failed" role="constant">
+    <term><literal>org.freedesktop.PolicyKit1.Error.Failed</literal></term>
+    <listitem>
+      <para>
+The operation failed.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry id="eggdbus-constant-Error.org.freedesktop.PolicyKit1.Error.Cancelled" role="constant">
+    <term><literal>org.freedesktop.PolicyKit1.Error.Cancelled</literal></term>
+    <listitem>
+      <para>
+The operation was cancelled.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry id="eggdbus-constant-Error.org.freedesktop.PolicyKit1.Error.NotSupported" role="constant">
+    <term><literal>org.freedesktop.PolicyKit1.Error.NotSupported</literal></term>
+    <listitem>
+      <para>
+The operation is not supported.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry id="eggdbus-constant-Error.org.freedesktop.PolicyKit1.Error.NotAuthorized" role="constant">
+    <term><literal>org.freedesktop.PolicyKit1.Error.NotAuthorized</literal></term>
+    <listitem>
+      <para>
+You are not authorized to perform the requested operation.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry id="eggdbus-constant-Error.org.freedesktop.PolicyKit1.Error.CancellationIdNotUnique" role="constant">
+    <term><literal>org.freedesktop.PolicyKit1.Error.CancellationIdNotUnique</literal></term>
+    <listitem>
+      <para>
+The passed <parameter>cancellation_id</parameter> is already in use.
+      </para>
+    </listitem>
+  </varlistentry>
+          </variablelist>
+        </para>
+    </refsect2>
+    <refsect2 role="enum" id="eggdbus-enum-AuthorityFeatures">
+      <title>The AuthorityFeatures Flags</title>
+        <para>
+          <programlisting>
+{
+  None                   = 0x00000000,
+  TemporaryAuthorization = 0x00000001,
+  Lockdown               = 0x00000002
+}
+          </programlisting>
+          <para>
+Flags describing features supported by the Authority implementation.
+          </para>
+          <variablelist role="constant">
+  <varlistentry id="eggdbus-constant-AuthorityFeatures.None" role="constant">
+    <term><literal>None</literal></term>
+    <listitem>
+      <para>
+No flags set.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry id="eggdbus-constant-AuthorityFeatures.TemporaryAuthorization" role="constant">
+    <term><literal>TemporaryAuthorization</literal></term>
+    <listitem>
+      <para>
+The authority supports temporary authorizations that can be obtained through authentication.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry id="eggdbus-constant-AuthorityFeatures.Lockdown" role="constant">
+    <term><literal>Lockdown</literal></term>
+    <listitem>
+      <para>
+The authority supports the <link linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.AddLockdownForAction">AddLockdownForAction()</link> and <link linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.RemoveLockdownForAction">RemoveLockdownForAction()</link> methods.
+      </para>
+    </listitem>
+  </varlistentry>
+          </variablelist>
+        </para>
+    </refsect2>
+  </refsect1>
+  <refsect1 role="desc" id="eggdbus-if-structures-org.freedesktop.PolicyKit1.Authority">
+    <title role="desc.title">Structures</title>
+    <refsect2 role="struct" id="eggdbus-struct-Subject">
+      <title>The Subject Structure</title>
+        <para>
+          <programlisting>
+{
+  String               subject_kind,
+  Dict&lt;String,Variant&gt; subject_details
+}
+          </programlisting>
+          <para>
+<para>This struct describes subjects such as UNIX processes. It is typically used to check if a given process is authorized for an action.</para><para>The following kinds of subjects are known:</para>                   <formalpara><title>Unix Process</title><para><literal>subject_kind</literal> should be set to <literal>unix-process</literal> with keys <literal>pid</literal> (of type <literal>uint32</literal>) and <literal>start-time</literal> (of type <literal>uint64</literal>).</para></formalpara>                   <formalpara><title>Unix Session</title><para><literal>subject_kind</literal> should be set to <literal>unix-session</literal> with the key <literal>session-id</literal> (of type <literal>string</literal>).</para></formalpara>                   <formalpara><title>System Bus Name</title><para><literal>subject_kind</literal> should be set to <literal>system-bus-name</literal> with the key <literal>name</literal> (of type <literal>string</literal>).</para></formalpa
 ra>
+          </para>
+          <variablelist role="struct">
+  <varlistentry>
+    <term><literal>String <structfield>subject_kind</structfield></literal></term>
+    <listitem>
+      <para>
+The type of the subject.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><literal>Dict&lt;String,Variant&gt; <structfield>subject_details</structfield></literal></term>
+    <listitem>
+      <para>
+Details about the subject. Depending of the value of <parameter>subject_kind</parameter>, a set of well-defined key/value pairs are guaranteed to be available.
+      </para>
+    </listitem>
+  </varlistentry>
+          </variablelist>
+        </para>
+    </refsect2>
+    <refsect2 role="struct" id="eggdbus-struct-Identity">
+      <title>The Identity Structure</title>
+        <para>
+          <programlisting>
+{
+  String               identity_kind,
+  Dict&lt;String,Variant&gt; identity_details
+}
+          </programlisting>
+          <para>
+<para>This struct describes identities such as UNIX users and UNIX groups. It is typically used to check if a given process is authorized for an action.</para><para>The following kinds of identities are known:</para>                   <formalpara><title>Unix User</title><para><literal>identity_kind</literal> should be set to <literal>unix-user</literal> with key <literal>uid</literal> (of type <literal>uint32</literal>).</para></formalpara>                   <formalpara><title>Unix Group</title><para><literal>identity_kind</literal> should be set to <literal>unix-group</literal> with key <literal>gid</literal> (of type <literal>uint32</literal>).</para></formalpara>  
+          </para>
+          <variablelist role="struct">
+  <varlistentry>
+    <term><literal>String <structfield>identity_kind</structfield></literal></term>
+    <listitem>
+      <para>
+Type of identity.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><literal>Dict&lt;String,Variant&gt; <structfield>identity_details</structfield></literal></term>
+    <listitem>
+      <para>
+Details about the identity. Depending of the value of <parameter>identity_kind</parameter>, a set of well-defined key/value pairs are guaranteed to be available.
+      </para>
+    </listitem>
+  </varlistentry>
+          </variablelist>
+        </para>
+    </refsect2>
+    <refsect2 role="struct" id="eggdbus-struct-ActionDescription">
+      <title>The ActionDescription Structure</title>
+        <para>
+          <programlisting>
+{
+  String                action_id,
+  String                description,
+  String                message,
+  String                vendor_name,
+  String                vendor_url,
+  String                icon_name,
+  <link linkend="eggdbus-enum-ImplicitAuthorization">ImplicitAuthorization</link> implicit_any,
+  <link linkend="eggdbus-enum-ImplicitAuthorization">ImplicitAuthorization</link> implicit_inactive,
+  <link linkend="eggdbus-enum-ImplicitAuthorization">ImplicitAuthorization</link> implicit_active,
+  Dict&lt;String,String&gt;   annotations
+}
+          </programlisting>
+          <para>
+This struct describes actions registered with the PolicyKit daemon.
+          </para>
+          <variablelist role="struct">
+  <varlistentry>
+    <term><literal>String <structfield>action_id</structfield></literal></term>
+    <listitem>
+      <para>
+Action Identifier.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><literal>String <structfield>description</structfield></literal></term>
+    <listitem>
+      <para>
+Localized description of the action.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><literal>String <structfield>message</structfield></literal></term>
+    <listitem>
+      <para>
+Localized message to be displayed when making the user authenticate for an action.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><literal>String <structfield>vendor_name</structfield></literal></term>
+    <listitem>
+      <para>
+Name of the provider of the action or the empty string.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><literal>String <structfield>vendor_url</structfield></literal></term>
+    <listitem>
+      <para>
+A URL pointing to a place with more information about the action or the empty string.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><literal>String <structfield>icon_name</structfield></literal></term>
+    <listitem>
+      <para>
+The themed icon describing the action or the empty string if no icon is set.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><literal><link linkend="eggdbus-enum-ImplicitAuthorization">ImplicitAuthorization</link> <structfield>implicit_any</structfield></literal></term>
+    <listitem>
+      <para>
+A value from the <link linkend="eggdbus-enum-ImplicitAuthorization">ImplicitAuthorization</link>. enumeration for implicit authorizations that apply to any <link linkend="eggdbus-struct-Subject">Subject</link>.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><literal><link linkend="eggdbus-enum-ImplicitAuthorization">ImplicitAuthorization</link> <structfield>implicit_inactive</structfield></literal></term>
+    <listitem>
+      <para>
+A value from the <link linkend="eggdbus-enum-ImplicitAuthorization">ImplicitAuthorization</link>. enumeration for implicit authorizations that apply any <link linkend="eggdbus-struct-Subject">Subject</link> in an inactive user session on the local console.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><literal><link linkend="eggdbus-enum-ImplicitAuthorization">ImplicitAuthorization</link> <structfield>implicit_active</structfield></literal></term>
+    <listitem>
+      <para>
+A value from the <link linkend="eggdbus-enum-ImplicitAuthorization">ImplicitAuthorization</link>. enumeration for implicit authorizations that apply any <link linkend="eggdbus-struct-Subject">Subject</link> in an active user session on the local console.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><literal>Dict&lt;String,String&gt; <structfield>annotations</structfield></literal></term>
+    <listitem>
+      <para>
+Annotations for the action.
+      </para>
+    </listitem>
+  </varlistentry>
+          </variablelist>
+        </para>
+    </refsect2>
+    <refsect2 role="struct" id="eggdbus-struct-AuthorizationResult">
+      <title>The AuthorizationResult Structure</title>
+        <para>
+          <programlisting>
+{
+  Boolean             is_authorized,
+  Boolean             is_challenge,
+  Dict&lt;String,String&gt; details
+}
+          </programlisting>
+          <para>
+Describes the result of calling <link linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.CheckAuthorization">CheckAuthorization()</link>.
+          </para>
+          <variablelist role="struct">
+  <varlistentry>
+    <term><literal>Boolean <structfield>is_authorized</structfield></literal></term>
+    <listitem>
+      <para>
+TRUE if the given <link linkend="eggdbus-struct-Subject">Subject</link> is authorized for the given action.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><literal>Boolean <structfield>is_challenge</structfield></literal></term>
+    <listitem>
+      <para>
+TRUE if the given <link linkend="eggdbus-struct-Subject">Subject</link> could be authorized if more information was provided, and <link linkend="eggdbus-constant-CheckAuthorizationFlags.AllowUserInteraction">CheckAuthorizationFlags.AllowUserInteraction</link> wasn't passed or no suitable authentication agent was available.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><literal>Dict&lt;String,String&gt; <structfield>details</structfield></literal></term>
+    <listitem>
+      <para>
+Details for the result or empty if not authorized. Known key/value-pairs include <literal>polkit.temporary_authorization_id</literal> (if the authorization is temporary, this is set to the opaque temporary authorization id), <literal>polkit.retains_authorization_after_challenge</literal> (Set to a non-empty string if the authorization will be retained after authentication (if is_challenge is TRUE)) and <literal>polkit.lockdown</literal> (set to a non-empty string if the action is locked down).
+      </para>
+    </listitem>
+  </varlistentry>
+          </variablelist>
+        </para>
+    </refsect2>
+    <refsect2 role="struct" id="eggdbus-struct-TemporaryAuthorization">
+      <title>The TemporaryAuthorization Structure</title>
+        <para>
+          <programlisting>
+{
+  String  id,
+  String  action_id,
+  <link linkend="eggdbus-struct-Subject">Subject</link> subject,
+  UInt64  time_obtained,
+  UInt64  time_expires
+}
+          </programlisting>
+          <para>
+This struct describes a temporary authorization.
+          </para>
+          <variablelist role="struct">
+  <varlistentry>
+    <term><literal>String <structfield>id</structfield></literal></term>
+    <listitem>
+      <para>
+An opaque identifier for the temporary authorization.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><literal>String <structfield>action_id</structfield></literal></term>
+    <listitem>
+      <para>
+The action the temporary authorization is for.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><literal><link linkend="eggdbus-struct-Subject">Subject</link> <structfield>subject</structfield></literal></term>
+    <listitem>
+      <para>
+The subject the temporary authorization is for.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><literal>UInt64 <structfield>time_obtained</structfield></literal></term>
+    <listitem>
+      <para>
+When the temporary authorization was obtained, in seconds since the Epoch Jan 1, 1970 0:00 UTC.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><literal>UInt64 <structfield>time_expires</structfield></literal></term>
+    <listitem>
+      <para>
+When the temporary authorization is set to expire, in seconds since the Epoch Jan 1, 1970 0:00 UTC.
+      </para>
+    </listitem>
+  </varlistentry>
+          </variablelist>
+        </para>
+    </refsect2>
+  </refsect1>
+  <refsect1 role="details" id="eggdbus-if-method-details-org.freedesktop.PolicyKit1.Authority">
+    <title role="details.title">Method Details</title>
+    <refsect2 role="function" id="eggdbus-method-org.freedesktop.PolicyKit1.Authority.EnumerateActions">
+      <title>EnumerateActions ()</title>
+    <programlisting>
+EnumerateActions (IN  String                    locale,
+                  OUT Array&lt;<link linkend="eggdbus-struct-ActionDescription">ActionDescription</link>&gt;  action_descriptions)
+    </programlisting>
+    <para>
+Enumerates all registered PolicyKit actions.
+    </para>
+<variablelist role="params">
+  <varlistentry>
+    <term><literal>IN  String <parameter>locale</parameter></literal>:</term>
+    <listitem>
+      <para>
+The locale to get descriptions in or the blank string to use the system locale.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><literal>OUT Array&lt;<link linkend="eggdbus-struct-ActionDescription">ActionDescription</link>&gt; <parameter>action_descriptions</parameter></literal>:</term>
+    <listitem>
+      <para>
+An array of <link linkend="eggdbus-struct-ActionDescription">ActionDescription</link> structs.
+      </para>
+    </listitem>
+  </varlistentry>
+</variablelist>
+    </refsect2>
+    <refsect2 role="function" id="eggdbus-method-org.freedesktop.PolicyKit1.Authority.CheckAuthorization">
+      <title>CheckAuthorization ()</title>
+    <programlisting>
+CheckAuthorization (IN  <link linkend="eggdbus-struct-Subject">Subject</link>                  subject,
+                    IN  String                   action_id,
+                    IN  Dict&lt;String,String&gt;      details,
+                    IN  <link linkend="eggdbus-enum-CheckAuthorizationFlags">CheckAuthorizationFlags</link>  flags,
+                    IN  String                   cancellation_id,
+                    OUT <link linkend="eggdbus-struct-AuthorizationResult">AuthorizationResult</link>      result)
+    </programlisting>
+    <para>
+<para>Checks if <parameter>subject</parameter> is authorized to perform the action with identifier <parameter>action_id</parameter>.</para><para>If <parameter>cancellation_id</parameter> is non-empty and already in use for the caller, the <link linkend="eggdbus-constant-Error.org.freedesktop.PolicyKit1.Error.CancellationIdNotUnique">org.freedesktop.PolicyKit1.Error.CancellationIdNotUnique</link> error is returned.</para><para>Note that <link linkend="eggdbus-constant-CheckAuthorizationFlags.AllowUserInteraction">CheckAuthorizationFlags.AllowUserInteraction</link> SHOULD be passed ONLY if the event that triggered the authorization check is stemming from an user action, e.g. the user pressing a button or attaching a device.</para>
+    </para>
+<variablelist role="params">
+  <varlistentry>
+    <term><literal>IN  <link linkend="eggdbus-struct-Subject">Subject</link> <parameter>subject</parameter></literal>:</term>
+    <listitem>
+      <para>
+A <link linkend="eggdbus-struct-Subject">Subject</link> struct.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><literal>IN  String <parameter>action_id</parameter></literal>:</term>
+    <listitem>
+      <para>
+Identifier for the action that <parameter>subject</parameter> is attempting to do.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><literal>IN  Dict&lt;String,String&gt; <parameter>details</parameter></literal>:</term>
+    <listitem>
+      <para>
+Details describing the action. Keys starting with <literal>polkit.</literal> are reserved for internal use and cannot be used.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><literal>IN  <link linkend="eggdbus-enum-CheckAuthorizationFlags">CheckAuthorizationFlags</link> <parameter>flags</parameter></literal>:</term>
+    <listitem>
+      <para>
+A set of <link linkend="eggdbus-enum-CheckAuthorizationFlags">CheckAuthorizationFlags</link>.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><literal>IN  String <parameter>cancellation_id</parameter></literal>:</term>
+    <listitem>
+      <para>
+A unique id used to cancel the the authentication check via <link linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.CancelCheckAuthorization">CancelCheckAuthorization()</link> or the empty string if cancellation is not needed.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><literal>OUT <link linkend="eggdbus-struct-AuthorizationResult">AuthorizationResult</link> <parameter>result</parameter></literal>:</term>
+    <listitem>
+      <para>
+An <link linkend="eggdbus-struct-AuthorizationResult">AuthorizationResult</link> structure.
+      </para>
+    </listitem>
+  </varlistentry>
+</variablelist>
+    </refsect2>
+    <refsect2 role="function" id="eggdbus-method-org.freedesktop.PolicyKit1.Authority.CancelCheckAuthorization">
+      <title>CancelCheckAuthorization ()</title>
+    <programlisting>
+CancelCheckAuthorization (IN  String  cancellation_id)
+    </programlisting>
+    <para>
+Cancels an authorization check.
+    </para>
+<variablelist role="params">
+  <varlistentry>
+    <term><literal>IN  String <parameter>cancellation_id</parameter></literal>:</term>
+    <listitem>
+      <para>
+The <parameter>cancellation_id</parameter> passed to <link linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.CheckAuthorization">CheckAuthorization()</link>.
+      </para>
+    </listitem>
+  </varlistentry>
+</variablelist>
+    </refsect2>
+    <refsect2 role="function" id="eggdbus-method-org.freedesktop.PolicyKit1.Authority.RegisterAuthenticationAgent">
+      <title>RegisterAuthenticationAgent ()</title>
+    <programlisting>
+RegisterAuthenticationAgent (IN  <link linkend="eggdbus-struct-Subject">Subject</link>  subject,
+                             IN  String   locale,
+                             IN  String   object_path)
+    </programlisting>
+    <para>
+<para>Register an authentication agent.</para><para>Note that current versions of PolicyKit will only work if <parameter>session_id</parameter> is set to the empty string. In the future it might work for non-empty strings if the caller is sufficiently privileged.</para>
+    </para>
+<variablelist role="params">
+  <varlistentry>
+    <term><literal>IN  <link linkend="eggdbus-struct-Subject">Subject</link> <parameter>subject</parameter></literal>:</term>
+    <listitem>
+      <para>
+The subject to register the authentication agent for, typically a session subject.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><literal>IN  String <parameter>locale</parameter></literal>:</term>
+    <listitem>
+      <para>
+The locale of the authentication agent.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><literal>IN  String <parameter>object_path</parameter></literal>:</term>
+    <listitem>
+      <para>
+The object path of authentication agent object on the unique name of the caller.
+      </para>
+    </listitem>
+  </varlistentry>
+</variablelist>
+    </refsect2>
+    <refsect2 role="function" id="eggdbus-method-org.freedesktop.PolicyKit1.Authority.UnregisterAuthenticationAgent">
+      <title>UnregisterAuthenticationAgent ()</title>
+    <programlisting>
+UnregisterAuthenticationAgent (IN  <link linkend="eggdbus-struct-Subject">Subject</link>  subject,
+                               IN  String   object_path)
+    </programlisting>
+    <para>
+Unregister an authentication agent.
+    </para>
+<variablelist role="params">
+  <varlistentry>
+    <term><literal>IN  <link linkend="eggdbus-struct-Subject">Subject</link> <parameter>subject</parameter></literal>:</term>
+    <listitem>
+      <para>
+The <parameter>subject</parameter> passed to <link linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.RegisterAuthenticationAgent">RegisterAuthenticationAgent()</link>.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><literal>IN  String <parameter>object_path</parameter></literal>:</term>
+    <listitem>
+      <para>
+The <parameter>object_path</parameter> passed to <link linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.RegisterAuthenticationAgent">RegisterAuthenticationAgent()</link>.
+      </para>
+    </listitem>
+  </varlistentry>
+</variablelist>
+    </refsect2>
+    <refsect2 role="function" id="eggdbus-method-org.freedesktop.PolicyKit1.Authority.AuthenticationAgentResponse">
+      <title>AuthenticationAgentResponse ()</title>
+    <programlisting>
+AuthenticationAgentResponse (IN  String    cookie,
+                             IN  <link linkend="eggdbus-struct-Identity">Identity</link>  identity)
+    </programlisting>
+    <para>
+Method for authentication agents to invoke on successful authentication. This method will fail unless a sufficiently privileged caller invokes it.
+    </para>
+<variablelist role="params">
+  <varlistentry>
+    <term><literal>IN  String <parameter>cookie</parameter></literal>:</term>
+    <listitem>
+      <para>
+The cookie identifying the authentication request that was passed to the authentication agent.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><literal>IN  <link linkend="eggdbus-struct-Identity">Identity</link> <parameter>identity</parameter></literal>:</term>
+    <listitem>
+      <para>
+A <link linkend="eggdbus-struct-Identity">Identity</link> struct describing what identity was authenticated.
+      </para>
+    </listitem>
+  </varlistentry>
+</variablelist>
+    </refsect2>
+    <refsect2 role="function" id="eggdbus-method-org.freedesktop.PolicyKit1.Authority.EnumerateTemporaryAuthorizations">
+      <title>EnumerateTemporaryAuthorizations ()</title>
+    <programlisting>
+EnumerateTemporaryAuthorizations (IN  <link linkend="eggdbus-struct-Subject">Subject</link>                        subject,
+                                  OUT Array&lt;<link linkend="eggdbus-struct-TemporaryAuthorization">TemporaryAuthorization</link>&gt;  temporary_authorizations)
+    </programlisting>
+    <para>
+Retrieves all temporary authorizations that applies to <parameter>subject</parameter>.
+    </para>
+<variablelist role="params">
+  <varlistentry>
+    <term><literal>IN  <link linkend="eggdbus-struct-Subject">Subject</link> <parameter>subject</parameter></literal>:</term>
+    <listitem>
+      <para>
+The subject to get temporary authorizations for.
+      </para>
+    </listitem>
+  </varlistentry>
+  <varlistentry>
+    <term><literal>OUT Array&lt;<link linkend="eggdbus-struct-TemporaryAuthorization">TemporaryAuthorization</link>&gt; <parameter>temporary_authorizations</parameter></literal>:</term>
+    <listitem>
+      <para>
+An array of <link linkend="eggdbus-struct-TemporaryAuthorization">TemporaryAuthorization</link> structs.
+      </para>
+    </listitem>
+  </varlistentry>
+</variablelist>
+    </refsect2>
+    <refsect2 role="function" id="eggdbus-method-org.freedesktop.PolicyKit1.Authority.RevokeTemporaryAuthorizations">
+      <title>RevokeTemporaryAuthorizations ()</title>
+    <programlisting>
+RevokeTemporaryAuthorizations (IN  <link linkend="eggdbus-struct-Subject">Subject</link>  subject)
+    </programlisting>
+    <para>
+Revokes all temporary authorizations that applies to <parameter>subject</parameter>.
+    </para>
+<variablelist role="params">
+  <varlistentry>
+    <term><literal>IN  <link linkend="eggdbus-struct-Subject">Subject</link> <parameter>subject</parameter></literal>:</term>
+    <listitem>
+      <para>
+The subject to revoke temporary authorizations from.
+      </para>
+    </listitem>
+  </varlistentry>
+</variablelist>
+    </refsect2>
+    <refsect2 role="function" id="eggdbus-method-org.freedesktop.PolicyKit1.Authority.RevokeTemporaryAuthorizationById">
+      <title>RevokeTemporaryAuthorizationById ()</title>
+    <programlisting>
+RevokeTemporaryAuthorizationById (IN  String  id)
+    </programlisting>
+    <para>
+Revokes all temporary authorizations that applies to <parameter>subject</parameter>.
+    </para>
+<variablelist role="params">
+  <varlistentry>
+    <term><literal>IN  String <parameter>id</parameter></literal>:</term>
+    <listitem>
+      <para>
+The opaque identifier of the temporary authorization.
+      </para>
+    </listitem>
+  </varlistentry>
+</variablelist>
+    </refsect2>
+    <refsect2 role="function" id="eggdbus-method-org.freedesktop.PolicyKit1.Authority.AddLockdownForAction">
+      <title>AddLockdownForAction ()</title>
+    <programlisting>
+AddLockdownForAction (IN  String  action_id)
+    </programlisting>
+    <para>
+Locks down an action so administrator authentication is always needed to obtain a temporary authorization for the action.
+    </para>
+<variablelist role="params">
+  <varlistentry>
+    <term><literal>IN  String <parameter>action_id</parameter></literal>:</term>
+    <listitem>
+      <para>
+Identifier for the action.
+      </para>
+    </listitem>
+  </varlistentry>
+</variablelist>
+    </refsect2>
+    <refsect2 role="function" id="eggdbus-method-org.freedesktop.PolicyKit1.Authority.RemoveLockdownForAction">
+      <title>RemoveLockdownForAction ()</title>
+    <programlisting>
+RemoveLockdownForAction (IN  String  action_id)
+    </programlisting>
+    <para>
+Removes the effect of a previous <link linkend="eggdbus-method-org.freedesktop.PolicyKit1.Authority.AddLockdownForAction">AddLockdownForAction()</link> call.
+    </para>
+<variablelist role="params">
+  <varlistentry>
+    <term><literal>IN  String <parameter>action_id</parameter></literal>:</term>
+    <listitem>
+      <para>
+Identifier for the action.
+      </para>
+    </listitem>
+  </varlistentry>
+</variablelist>
+    </refsect2>
+  </refsect1>
+  <refsect1 role="signals" id="eggdbus-if-signal-details-org.freedesktop.PolicyKit1.Authority">
+    <title role="signals.title">Signal Details</title>
+    <refsect2 role="signal" id="eggdbus-signal-org.freedesktop.PolicyKit1.Authority::Changed">
+      <title>The "Changed" signal</title>
+    <programlisting>
+Changed ()
+    </programlisting>
+    <para>
+This signal is emitted when actions and/or authorizations change
+    </para>
+<variablelist role="params">
+</variablelist>
+    </refsect2>
+  </refsect1>
+  <refsect1 role="property_details" id="eggdbus-if-property-details-org.freedesktop.PolicyKit1.Authority">
+    <title role="property_details.title">Property Details</title>
+    <refsect2 role="property" id="eggdbus-property-org.freedesktop.PolicyKit1.Authority:BackendName">
+      <title>The "BackendName" property</title>
+    <programlisting>
+BackendName     readable     String
+    </programlisting>
+    <para>
+The name of the currently used Authority backend.
+    </para>
+    </refsect2>
+    <refsect2 role="property" id="eggdbus-property-org.freedesktop.PolicyKit1.Authority:BackendVersion">
+      <title>The "BackendVersion" property</title>
+    <programlisting>
+BackendVersion     readable     String
+    </programlisting>
+    <para>
+The version of the currently used Authority backend.
+    </para>
+    </refsect2>
+    <refsect2 role="property" id="eggdbus-property-org.freedesktop.PolicyKit1.Authority:BackendFeatures">
+      <title>The "BackendFeatures" property</title>
+    <programlisting>
+BackendFeatures     readable     <link linkend="eggdbus-enum-AuthorityFeatures">AuthorityFeatures</link>
+    </programlisting>
+    <para>
+The features supported by the currently used Authority backend.
+    </para>
+    </refsect2>
+  </refsect1>
+</refentry>
diff --git a/docs/polkit/polkit-1-docs.xml b/docs/polkit/polkit-1-docs.xml
index 5d2ea73..4ddf9cd 100644
--- a/docs/polkit/polkit-1-docs.xml
+++ b/docs/polkit/polkit-1-docs.xml
@@ -61,8 +61,8 @@
 
   <part id="ref-dbus-api">
     <title>D-Bus API Reference</title>
-    <xi:include href="../../src/polkit/docbook-interface-org.freedesktop.PolicyKit1.Authority.xml"/>
-    <xi:include href="../../src/polkit/docbook-interface-org.freedesktop.PolicyKit1.AuthenticationAgent.xml"/>
+    <xi:include href="docbook-interface-org.freedesktop.PolicyKit1.Authority.xml"/>
+    <xi:include href="docbook-interface-org.freedesktop.PolicyKit1.AuthenticationAgent.xml"/>
   </part>
 
   <part id="ref-api">
commit 007b07f979b952744137b7a5b49712df87377014
Author: David Zeuthen <davidz at redhat.com>
Date:   Thu Jul 29 16:49:37 2010 -0400

    Port PolkitAgent to gdbus
    
    Signed-off-by: David Zeuthen <davidz at redhat.com>

diff --git a/docs/polkit/polkit-1-sections.txt b/docs/polkit/polkit-1-sections.txt
index ac902b6..6b03fa2 100644
--- a/docs/polkit/polkit-1-sections.txt
+++ b/docs/polkit/polkit-1-sections.txt
@@ -22,6 +22,7 @@ PolkitAuthority
 PolkitAuthorityFeatures
 PolkitCheckAuthorizationFlags
 polkit_authority_get
+polkit_authority_get_owner
 polkit_authority_get_backend_name
 polkit_authority_get_backend_version
 polkit_authority_get_backend_features
diff --git a/src/polkit/polkitauthority.c b/src/polkit/polkitauthority.c
index d224bcf..1a66add 100644
--- a/src/polkit/polkitauthority.c
+++ b/src/polkit/polkitauthority.c
@@ -85,6 +85,7 @@ enum
 enum
 {
   PROP_0,
+  PROP_OWNER,
   PROP_BACKEND_NAME,
   PROP_BACKEND_VERSION,
   PROP_BACKEND_FEATURES
@@ -109,6 +110,15 @@ on_proxy_signal (GDBusProxy   *proxy,
 }
 
 static void
+on_notify_g_name_owner (GObject    *object,
+                        GParamSpec *ppsec,
+                        gpointer    user_data)
+{
+  PolkitAuthority *authority = POLKIT_AUTHORITY (user_data);
+  g_object_notify (G_OBJECT (authority), "owner");
+}
+
+static void
 polkit_authority_init (PolkitAuthority *authority)
 {
   GError *error;
@@ -132,6 +142,10 @@ polkit_authority_init (PolkitAuthority *authority)
                     "g-signal",
                     G_CALLBACK (on_proxy_signal),
                     authority);
+  g_signal_connect (authority->proxy,
+                    "notify::g-name-owner",
+                    G_CALLBACK (on_notify_g_name_owner),
+                    authority);
 }
 
 static void
@@ -160,6 +174,10 @@ polkit_authority_get_property (GObject    *object,
 
   switch (prop_id)
     {
+    case PROP_OWNER:
+      g_value_take_string (value, polkit_authority_get_owner (authority));
+      break;
+
     case PROP_BACKEND_NAME:
       g_value_set_string (value, polkit_authority_get_backend_name (authority));
       break;
@@ -187,6 +205,24 @@ polkit_authority_class_init (PolkitAuthorityClass *klass)
   gobject_class->get_property = polkit_authority_get_property;
 
   /**
+   * PolkitAuthority:owner:
+   *
+   * The unique name of the owner of the org.freedesktop.PolicyKit1
+   * D-Bus service or %NULL if there is no owner. Connect to the
+   * #GObject::notify signal to track changes to this property.
+   */
+  g_object_class_install_property (gobject_class,
+                                   PROP_OWNER,
+                                   g_param_spec_string ("owner",
+                                                        "Owner",
+                                                        "Owner.",
+                                                        NULL,
+                                                        G_PARAM_READABLE |
+                                                        G_PARAM_STATIC_NAME |
+                                                        G_PARAM_STATIC_NICK |
+                                                        G_PARAM_STATIC_BLURB));
+
+  /**
    * PolkitAuthority:backend-name:
    *
    * The name of the currently used Authority backend.
@@ -330,6 +366,19 @@ call_sync_free (CallSyncData *data)
 
 /* ---------------------------------------------------------------------------------------------------- */
 
+static void
+generic_async_cb (GObject      *source_obj,
+                  GAsyncResult *res,
+                  gpointer      user_data)
+{
+  GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (user_data);
+  g_simple_async_result_set_op_res_gpointer (simple, g_object_ref (res), g_object_unref);
+  g_simple_async_result_complete (simple);
+  g_object_unref (simple);
+}
+
+/* ---------------------------------------------------------------------------------------------------- */
+
 /**
  * polkit_authority_enumerate_actions:
  * @authority: A #PolkitAuthority.
@@ -356,8 +405,11 @@ polkit_authority_enumerate_actions (PolkitAuthority     *authority,
                      G_DBUS_CALL_FLAGS_NONE,
                      -1,
                      cancellable,
-                     callback,
-                     user_data);
+                     generic_async_cb,
+                     g_simple_async_result_new (G_OBJECT (authority),
+                                                callback,
+                                                user_data,
+                                                polkit_authority_enumerate_actions));
 }
 
 /**
@@ -381,10 +433,14 @@ polkit_authority_enumerate_actions_finish (PolkitAuthority *authority,
   GVariantIter iter;
   GVariant *child;
   GVariant *array;
+  GAsyncResult *_res;
 
   ret = NULL;
 
-  value = g_dbus_proxy_call_finish (authority->proxy, res, error);
+  g_warn_if_fail (g_simple_async_result_get_source_tag (G_SIMPLE_ASYNC_RESULT (res)) == polkit_authority_enumerate_actions);
+  _res = G_ASYNC_RESULT (g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res)));
+
+  value = g_dbus_proxy_call_finish (authority->proxy, _res, error);
   if (value == NULL)
     goto out;
 
@@ -689,8 +745,11 @@ polkit_authority_register_authentication_agent (PolkitAuthority      *authority,
                      G_DBUS_CALL_FLAGS_NONE,
                      -1,
                      cancellable,
-                     callback,
-                     user_data);
+                     generic_async_cb,
+                     g_simple_async_result_new (G_OBJECT (authority),
+                                                callback,
+                                                user_data,
+                                                polkit_authority_register_authentication_agent));
   g_variant_unref (subject_value);
 }
 
@@ -711,10 +770,14 @@ polkit_authority_register_authentication_agent_finish (PolkitAuthority *authorit
 {
   gboolean ret;
   GVariant *value;
+  GAsyncResult *_res;
 
   ret = FALSE;
 
-  value = g_dbus_proxy_call_finish (authority->proxy, res, error);
+  g_warn_if_fail (g_simple_async_result_get_source_tag (G_SIMPLE_ASYNC_RESULT (res)) == polkit_authority_register_authentication_agent);
+  _res = G_ASYNC_RESULT (g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res)));
+
+  value = g_dbus_proxy_call_finish (authority->proxy, _res, error);
   if (value == NULL)
     goto out;
   ret = TRUE;
@@ -795,8 +858,11 @@ polkit_authority_unregister_authentication_agent (PolkitAuthority      *authorit
                      G_DBUS_CALL_FLAGS_NONE,
                      -1,
                      cancellable,
-                     callback,
-                     user_data);
+                     generic_async_cb,
+                     g_simple_async_result_new (G_OBJECT (authority),
+                                                callback,
+                                                user_data,
+                                                polkit_authority_unregister_authentication_agent));
   g_variant_unref (subject_value);
 }
 
@@ -817,10 +883,14 @@ polkit_authority_unregister_authentication_agent_finish (PolkitAuthority *author
 {
   gboolean ret;
   GVariant *value;
+  GAsyncResult *_res;
 
   ret = FALSE;
 
-  value = g_dbus_proxy_call_finish (authority->proxy, res, error);
+  g_warn_if_fail (g_simple_async_result_get_source_tag (G_SIMPLE_ASYNC_RESULT (res)) == polkit_authority_unregister_authentication_agent);
+  _res = G_ASYNC_RESULT (g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res)));
+
+  value = g_dbus_proxy_call_finish (authority->proxy, _res, error);
   if (value == NULL)
     goto out;
   ret = TRUE;
@@ -903,8 +973,11 @@ polkit_authority_authentication_agent_response (PolkitAuthority      *authority,
                      G_DBUS_CALL_FLAGS_NONE,
                      -1,
                      cancellable,
-                     callback,
-                     user_data);
+                     generic_async_cb,
+                     g_simple_async_result_new (G_OBJECT (authority),
+                                                callback,
+                                                user_data,
+                                                polkit_authority_authentication_agent_response));
   g_variant_unref (identity_value);
 }
 
@@ -925,10 +998,14 @@ polkit_authority_authentication_agent_response_finish (PolkitAuthority *authorit
 {
   gboolean ret;
   GVariant *value;
+  GAsyncResult *_res;
 
   ret = FALSE;
 
-  value = g_dbus_proxy_call_finish (authority->proxy, res, error);
+  g_warn_if_fail (g_simple_async_result_get_source_tag (G_SIMPLE_ASYNC_RESULT (res)) == polkit_authority_authentication_agent_response);
+  _res = G_ASYNC_RESULT (g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res)));
+
+  value = g_dbus_proxy_call_finish (authority->proxy, _res, error);
   if (value == NULL)
     goto out;
   ret = TRUE;
@@ -1005,8 +1082,11 @@ polkit_authority_enumerate_temporary_authorizations (PolkitAuthority     *author
                      G_DBUS_CALL_FLAGS_NONE,
                      -1,
                      cancellable,
-                     callback,
-                     user_data);
+                     generic_async_cb,
+                     g_simple_async_result_new (G_OBJECT (authority),
+                                                callback,
+                                                user_data,
+                                                polkit_authority_enumerate_temporary_authorizations));
   g_variant_unref (subject_value);
 }
 
@@ -1031,10 +1111,14 @@ polkit_authority_enumerate_temporary_authorizations_finish (PolkitAuthority *aut
   GVariantIter iter;
   GVariant *child;
   GVariant *array;
+  GAsyncResult *_res;
 
   ret = NULL;
 
-  value = g_dbus_proxy_call_finish (authority->proxy, res, error);
+  g_warn_if_fail (g_simple_async_result_get_source_tag (G_SIMPLE_ASYNC_RESULT (res)) == polkit_authority_enumerate_temporary_authorizations);
+  _res = G_ASYNC_RESULT (g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res)));
+
+  value = g_dbus_proxy_call_finish (authority->proxy, _res, error);
   if (value == NULL)
     goto out;
 
@@ -1116,8 +1200,11 @@ polkit_authority_revoke_temporary_authorizations (PolkitAuthority     *authority
                      G_DBUS_CALL_FLAGS_NONE,
                      -1,
                      cancellable,
-                     callback,
-                     user_data);
+                     generic_async_cb,
+                     g_simple_async_result_new (G_OBJECT (authority),
+                                                callback,
+                                                user_data,
+                                                polkit_authority_revoke_temporary_authorizations));
   g_variant_unref (subject_value);
 }
 
@@ -1138,10 +1225,14 @@ polkit_authority_revoke_temporary_authorizations_finish (PolkitAuthority *author
 {
   gboolean ret;
   GVariant *value;
+  GAsyncResult *_res;
 
   ret = FALSE;
 
-  value = g_dbus_proxy_call_finish (authority->proxy, res, error);
+  g_warn_if_fail (g_simple_async_result_get_source_tag (G_SIMPLE_ASYNC_RESULT (res)) == polkit_authority_revoke_temporary_authorizations);
+  _res = G_ASYNC_RESULT (g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res)));
+
+  value = g_dbus_proxy_call_finish (authority->proxy, _res, error);
   if (value == NULL)
     goto out;
   ret = TRUE;
@@ -1210,8 +1301,11 @@ polkit_authority_revoke_temporary_authorization_by_id (PolkitAuthority     *auth
                      G_DBUS_CALL_FLAGS_NONE,
                      -1,
                      cancellable,
-                     callback,
-                     user_data);
+                     generic_async_cb,
+                     g_simple_async_result_new (G_OBJECT (authority),
+                                                callback,
+                                                user_data,
+                                                polkit_authority_revoke_temporary_authorization_by_id));
 }
 
 /**
@@ -1231,10 +1325,14 @@ polkit_authority_revoke_temporary_authorization_by_id_finish (PolkitAuthority *a
 {
   gboolean ret;
   GVariant *value;
+  GAsyncResult *_res;
 
   ret = FALSE;
 
-  value = g_dbus_proxy_call_finish (authority->proxy, res, error);
+  g_warn_if_fail (g_simple_async_result_get_source_tag (G_SIMPLE_ASYNC_RESULT (res)) == polkit_authority_revoke_temporary_authorization_by_id);
+  _res = G_ASYNC_RESULT (g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res)));
+
+  value = g_dbus_proxy_call_finish (authority->proxy, _res, error);
   if (value == NULL)
     goto out;
   ret = TRUE;
@@ -1303,8 +1401,11 @@ polkit_authority_add_lockdown_for_action (PolkitAuthority     *authority,
                      G_DBUS_CALL_FLAGS_NONE,
                      -1,
                      cancellable,
-                     callback,
-                     user_data);
+                     generic_async_cb,
+                     g_simple_async_result_new (G_OBJECT (authority),
+                                                callback,
+                                                user_data,
+                                                polkit_authority_add_lockdown_for_action));
 }
 
 /**
@@ -1324,10 +1425,14 @@ polkit_authority_add_lockdown_for_action_finish (PolkitAuthority *authority,
 {
   gboolean ret;
   GVariant *value;
+  GAsyncResult *_res;
 
   ret = FALSE;
 
-  value = g_dbus_proxy_call_finish (authority->proxy, res, error);
+  g_warn_if_fail (g_simple_async_result_get_source_tag (G_SIMPLE_ASYNC_RESULT (res)) == polkit_authority_add_lockdown_for_action);
+  _res = G_ASYNC_RESULT (g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res)));
+
+  value = g_dbus_proxy_call_finish (authority->proxy, _res, error);
   if (value == NULL)
     goto out;
   ret = TRUE;
@@ -1396,8 +1501,11 @@ polkit_authority_remove_lockdown_for_action (PolkitAuthority     *authority,
                      G_DBUS_CALL_FLAGS_NONE,
                      -1,
                      cancellable,
-                     callback,
-                     user_data);
+                     generic_async_cb,
+                     g_simple_async_result_new (G_OBJECT (authority),
+                                                callback,
+                                                user_data,
+                                                polkit_authority_remove_lockdown_for_action));
 }
 
 /**
@@ -1417,10 +1525,14 @@ polkit_authority_remove_lockdown_for_action_finish (PolkitAuthority *authority,
 {
   gboolean ret;
   GVariant *value;
+  GAsyncResult *_res;
 
   ret = FALSE;
 
-  value = g_dbus_proxy_call_finish (authority->proxy, res, error);
+  g_warn_if_fail (g_simple_async_result_get_source_tag (G_SIMPLE_ASYNC_RESULT (res)) == polkit_authority_remove_lockdown_for_action);
+  _res = G_ASYNC_RESULT (g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (res)));
+
+  value = g_dbus_proxy_call_finish (authority->proxy, _res, error);
   if (value == NULL)
     goto out;
   ret = TRUE;
@@ -1462,6 +1574,23 @@ polkit_authority_remove_lockdown_for_action_sync (PolkitAuthority     *authority
 /* ---------------------------------------------------------------------------------------------------- */
 
 /**
+ * polkit_authority_get_owner:
+ * @authority: A #PolkitAuthority.
+ *
+ * The unique name on the system message bus of the owner of the name
+ * <literal>org.freedesktop.PolicyKit1</literal> or %NULL if no-one
+ * currently owns the name. You may connect to the #GObject::notify
+ * signal to track changes to the #PolkitAuthority::owner property.
+ *
+ * Returns: %NULL or a string that should be freed with g_free().
+ **/
+gchar *
+polkit_authority_get_owner (PolkitAuthority *authority)
+{
+  return g_dbus_proxy_get_name_owner (authority->proxy);
+}
+
+/**
  * polkit_authority_get_backend_name:
  * @authority: A #PolkitAuthority.
  *
diff --git a/src/polkit/polkitauthority.h b/src/polkit/polkitauthority.h
index e0ad31c..4140ff8 100644
--- a/src/polkit/polkitauthority.h
+++ b/src/polkit/polkitauthority.h
@@ -49,6 +49,7 @@ GType         polkit_authority_get_type         (void) G_GNUC_CONST;
 
 PolkitAuthority *polkit_authority_get (void);
 
+gchar                   *polkit_authority_get_owner            (PolkitAuthority *authority);
 const gchar             *polkit_authority_get_backend_name     (PolkitAuthority *authority);
 const gchar             *polkit_authority_get_backend_version  (PolkitAuthority *authority);
 PolkitAuthorityFeatures  polkit_authority_get_backend_features (PolkitAuthority *authority);
diff --git a/src/polkitagent/polkitagentlistener.c b/src/polkitagent/polkitagentlistener.c
index c2ab69a..d7bd5f0 100644
--- a/src/polkitagent/polkitagentlistener.c
+++ b/src/polkitagent/polkitagentlistener.c
@@ -44,27 +44,15 @@
  * To register a #PolkitAgentListener with the PolicyKit daemon, use polkit_agent_register_listener().
  */
 
-/* private class for exporting a D-Bus interface */
-
-#define TYPE_SERVER         (server_get_type ())
-#define SERVER(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_SERVER, Server))
-#define SERVER_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), POLKIT_AGENT_TYPE_LISTENER, ServerClass))
-#define SERVER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_SERVER, ServerClass))
-#define IS_SERVER(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_SERVER))
-#define IS_SERVER_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_SERVER))
-
-typedef struct _Server Server;
-typedef struct _ServerClass ServerClass;
-
-struct _Server
+typedef struct
 {
   GObject parent_instance;
 
-  EggDBusConnection *system_bus;
-
-  EggDBusObjectProxy *authority_proxy;
+  GDBusConnection *system_bus;
+  guint auth_agent_registration_id;
 
   PolkitAuthority *authority;
+  gulong notify_owner_handler_id;
 
   gboolean is_registered;
 
@@ -74,23 +62,46 @@ struct _Server
   gchar *object_path;
 
   GHashTable *cookie_to_pending_auth;
+} Server;
 
-};
-
-struct _ServerClass
+static void
+server_free (Server *server)
 {
-  GObjectClass parent_class;
+  if (server->is_registered)
+    {
+      GError *error;
+      error = NULL;
+      if (!polkit_authority_unregister_authentication_agent_sync (server->authority,
+                                                                  server->subject,
+                                                                  server->object_path,
+                                                                  NULL,
+                                                                  &error))
+        {
+          g_warning ("Error unregistering authentication agent: %s", error->message);
+          g_error_free (error);
+        }
+    }
 
-};
+  if (server->auth_agent_registration_id > 0)
+    g_dbus_connection_unregister_object (server->system_bus, server->auth_agent_registration_id);
+
+  if (server->notify_owner_handler_id > 0)
+    g_signal_handler_disconnect (server->authority, server->notify_owner_handler_id);
 
-static GType server_get_type (void) G_GNUC_CONST;
+  if (server->authority != NULL)
+    g_object_unref (server->authority);
 
-static void authentication_agent_iface_init (_PolkitAuthenticationAgentIface *agent_iface);
+  if (server->system_bus != NULL)
+    g_object_unref (server->system_bus);
 
-G_DEFINE_TYPE_WITH_CODE (Server, server, G_TYPE_OBJECT,
-                         G_IMPLEMENT_INTERFACE (_POLKIT_TYPE_AUTHENTICATION_AGENT,
-                                                authentication_agent_iface_init)
-                         );
+  if (server->cookie_to_pending_auth != NULL)
+    g_hash_table_unref (server->cookie_to_pending_auth);
+
+  if (server->subject != NULL)
+    g_object_unref (server->subject);
+
+  g_free (server->object_path);
+}
 
 static gboolean
 server_register (Server   *server,
@@ -122,15 +133,14 @@ server_register (Server   *server,
 }
 
 static void
-name_owner_notify (EggDBusObjectProxy *object_proxy,
-                   GParamSpec *pspec,
-                   gpointer user_data)
+on_notify_authority_owner (GObject    *object,
+                           GParamSpec *pspec,
+                           gpointer    user_data)
 {
-  Server *server = SERVER (user_data);
+  Server *server = user_data;
   gchar *owner;
 
-  owner = egg_dbus_object_proxy_get_name_owner (server->authority_proxy);
-
+  owner = polkit_authority_get_owner (server->authority);
   if (owner == NULL)
     {
       g_printerr ("PolicyKit daemon disconnected from the bus.\n");
@@ -162,85 +172,129 @@ name_owner_notify (EggDBusObjectProxy *object_proxy,
             }
         }
     }
-
   g_free (owner);
 }
 
-static void
-server_init (Server *server)
+static gboolean
+server_init_sync (Server        *server,
+                  GCancellable  *cancellable,
+                  GError       **error)
 {
-  server->cookie_to_pending_auth = g_hash_table_new (g_str_hash, g_str_equal);
+  gboolean ret;
+
+  ret = FALSE;
 
-  server->system_bus = egg_dbus_connection_get_for_bus (EGG_DBUS_BUS_TYPE_SYSTEM);
+  server->system_bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, cancellable, error);
+  if (server->system_bus == NULL)
+    goto out;
 
   server->authority = polkit_authority_get ();
+  if (server->authority == NULL)
+    goto out;
 
   /* the only use of this proxy is to re-register with the polkit daemon
    * if it jumps off the bus and comes back (which is useful for debugging)
    */
-  server->authority_proxy = egg_dbus_connection_get_object_proxy (server->system_bus,
-                                                                  "org.freedesktop.PolicyKit1",
-                                                                  "/org/freedesktop/PolicyKit1/Authority");
-
-  g_signal_connect (server->authority_proxy,
-                    "notify::name-owner",
-                    G_CALLBACK (name_owner_notify),
-                    server);
+  server->notify_owner_handler_id = g_signal_connect (server->authority,
+                                                      "notify::owner",
+                                                      G_CALLBACK (on_notify_authority_owner),
+                                                      server);
+
+  ret = TRUE;
+
+ out:
+  return ret;
 }
 
-static void
-server_finalize (GObject *object)
+static Server *
+server_new (PolkitSubject  *subject,
+            const gchar    *object_path,
+            GCancellable   *cancellable,
+            GError        **error)
 {
-  Server *server = SERVER (object);
+  Server *server;
 
-  if (server->is_registered)
-    {
-      GError *error;
+  server = g_new0 (Server, 1);
+  server->subject = g_object_ref (subject);
+  server->object_path = object_path != NULL ? g_strdup (object_path) :
+                                              g_strdup ("/org/freedesktop/PolicyKit1/AuthenticationAgent");
+  server->cookie_to_pending_auth = g_hash_table_new (g_str_hash, g_str_equal);
 
-      error = NULL;
-      if (!polkit_authority_unregister_authentication_agent_sync (server->authority,
-                                                                  server->subject,
-                                                                  server->object_path,
-                                                                  NULL,
-                                                                  &error))
-        {
-          g_warning ("Error unregistering authentication agent: %s", error->message);
-          g_error_free (error);
-        }
+  if (!server_init_sync (server, cancellable, error))
+    {
+      server_free (server);
+      goto out;
     }
 
-  g_object_unref (server->subject);
-  g_free (server->object_path);
-
-  g_object_unref (server->authority);
-
-  g_object_unref (server->authority_proxy);
-
-  g_object_unref (server->system_bus);
-
-  g_hash_table_unref (server->cookie_to_pending_auth);
-
-  if (G_OBJECT_CLASS (server_parent_class)->finalize != NULL)
-    G_OBJECT_CLASS (server_parent_class)->finalize (object);
+ out:
+  return server;
 }
 
 static void
-server_class_init (ServerClass *klass)
+listener_died (gpointer user_data,
+               GObject *where_the_object_was)
 {
-  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+  Server *server = user_data;
 
-  gobject_class->finalize = server_finalize;
+  server_free (server);
 }
 
+static void auth_agent_handle_begin_authentication (Server                 *server,
+                                                    GVariant               *parameters,
+                                                    GDBusMethodInvocation  *invocation);
+
+static void auth_agent_handle_cancel_authentication (Server                 *server,
+                                                     GVariant               *parameters,
+                                                     GDBusMethodInvocation  *invocation);
+
 static void
-listener_died (gpointer user_data,
-               GObject *where_the_object_was)
+auth_agent_handle_method_call (GDBusConnection        *connection,
+                               const gchar            *sender,
+                               const gchar            *object_path,
+                               const gchar            *interface_name,
+                               const gchar            *method_name,
+                               GVariant               *parameters,
+                               GDBusMethodInvocation  *invocation,
+                               gpointer                user_data)
 {
-  Server *server = SERVER (user_data);
+  Server *server = user_data;
+
+  /* The shipped D-Bus policy also ensures that only uid 0 can invoke
+   * methods on our interface. So no need to check the caller.
+   */
 
-  g_object_unref (server);
+  if (g_strcmp0 (method_name, "BeginAuthentication") == 0)
+    auth_agent_handle_begin_authentication (server, parameters, invocation);
+  else if (g_strcmp0 (method_name, "CancelAuthentication") == 0)
+    auth_agent_handle_cancel_authentication (server, parameters, invocation);
+  else
+    g_assert_not_reached ();
 }
 
+static const gchar *auth_agent_introspection_data =
+  "<node>"
+  "  <interface name='org.freedesktop.PolicyKit1.AuthenticationAgent'>"
+  "    <method name='BeginAuthentication'>"
+  "      <arg type='s' name='action_id' direction='in'/>"
+  "      <arg type='s' name='message' direction='in'/>"
+  "      <arg type='s' name='icon_name' direction='in'/>"
+  "      <arg type='a{ss}' name='details' direction='in'/>"
+  "      <arg type='s' name='cookie' direction='in'/>"
+  "      <arg type='a(sa{sv})' name='identities' direction='in'/>"
+  "    </method>"
+  "    <method name='CancelAuthentication'>"
+  "      <arg type='s' name='cookie' direction='in'/>"
+  "    </method>"
+  "  </interface>"
+  "</node>";
+
+static const GDBusInterfaceVTable auth_agent_vtable =
+{
+  auth_agent_handle_method_call,
+  NULL, /* _handle_get_property */
+  NULL  /* _handle_set_property */
+};
+
 /**
  * polkit_agent_register_listener:
  * @listener: An instance of a class that is derived from #PolkitAgentListener.
@@ -270,66 +324,69 @@ polkit_agent_register_listener (PolkitAgentListener  *listener,
                                 GError              **error)
 {
   Server *server;
+  gboolean ret;
+  GDBusNodeInfo *node_info;
 
-  server = SERVER (g_object_new (TYPE_SERVER, NULL));
-  server->subject = g_object_ref (subject);
-  server->object_path = object_path != NULL ? g_strdup (object_path) :
-                                              g_strdup ("/org/freedesktop/PolicyKit1/AuthenticationAgent");
-  server->listener = listener;
+  ret = FALSE;
+
+  server = server_new (subject, object_path, NULL, error);
+  if (server == NULL)
+    goto out;
 
-  egg_dbus_connection_register_interface (server->system_bus,
-                                          server->object_path,
-                                          _POLKIT_TYPE_AUTHENTICATION_AGENT,
-                                          G_OBJECT (server),
-                                          G_TYPE_INVALID);
+  node_info = g_dbus_node_info_new_for_xml (auth_agent_introspection_data, error);
+  if (node_info == NULL)
+    goto out;
+
+  server->listener = listener;
+  server->auth_agent_registration_id = g_dbus_connection_register_object (server->system_bus,
+                                                                          server->object_path,
+                                                                          g_dbus_node_info_lookup_interface (node_info, "org.freedesktop.PolicyKit1.AuthenticationAgent"),
+                                                                          &auth_agent_vtable,
+                                                                          server,
+                                                                          NULL, /* user_data GDestroyNotify */
+                                                                          error);
+  g_dbus_node_info_unref (node_info);
+
+  if (server->auth_agent_registration_id == 0)
+    {
+      server_free (server);
+      goto out;
+    }
 
   if (!server_register (server, error))
     {
-      g_object_unref (server);
-      return FALSE;
+      server_free (server);
+      goto out;
     }
 
   /* take a weak ref and kill server when listener dies */
   g_object_weak_ref (G_OBJECT (server->listener), listener_died, server);
 
-  return TRUE;
+  ret = TRUE;
+
+ out:
+  return ret;
 }
 
 typedef struct
 {
   Server *server;
   gchar *cookie;
-  EggDBusMethodInvocation *method_invocation;
+  GDBusMethodInvocation *invocation;
   GCancellable *cancellable;
 } AuthData;
 
-static AuthData *
-auth_data_new (Server                  *server,
-               const gchar             *cookie,
-               EggDBusMethodInvocation *method_invocation,
-               GCancellable            *cancellable)
-{
-  AuthData *data;
-
-  data = g_new0 (AuthData, 1);
-  data->server = g_object_ref (server);
-  data->cookie = g_strdup (cookie);
-  data->method_invocation = g_object_ref (method_invocation);
-  data->cancellable = g_object_ref (cancellable);
-
-  return data;
-}
-
 static void
 auth_data_free (AuthData *data)
 {
-  g_object_unref (data->server);
   g_free (data->cookie);
-  g_object_unref (data->method_invocation);
+  g_object_unref (data->invocation);
   g_object_unref (data->cancellable);
   g_free (data);
 }
 
+/* ---------------------------------------------------------------------------------------------------- */
+
 static void
 auth_cb (GObject      *source_object,
          GAsyncResult *res,
@@ -343,12 +400,12 @@ auth_cb (GObject      *source_object,
                                                              res,
                                                              &error))
     {
-      egg_dbus_method_invocation_return_gerror (data->method_invocation, error);
+      g_dbus_method_invocation_return_gerror (data->invocation, error);
       g_error_free (error);
     }
   else
     {
-      _polkit_authentication_agent_handle_begin_authentication_finish (data->method_invocation);
+      g_dbus_method_invocation_return_value (data->invocation, NULL);
     }
 
   g_hash_table_remove (data->server->cookie_to_pending_auth, data->cookie);
@@ -357,89 +414,117 @@ auth_cb (GObject      *source_object,
 }
 
 static void
-handle_begin_authentication (_PolkitAuthenticationAgent *instance,
-                             const gchar                *action_id,
-                             const gchar                *message,
-                             const gchar                *icon_name,
-                             EggDBusHashMap             *details,
-                             const gchar                *cookie,
-                             EggDBusArraySeq            *identities,
-                             EggDBusMethodInvocation    *method_invocation)
+auth_agent_handle_begin_authentication (Server                 *server,
+                                        GVariant               *parameters,
+                                        GDBusMethodInvocation  *invocation)
 {
-  Server *server = SERVER (instance);
-  AuthData *data;
-  GList *list;
+  const gchar *action_id;
+  const gchar *message;
+  const gchar *icon_name;
+  GVariant    *details_gvariant;
+  const gchar *cookie;
+  GVariant    *identities_gvariant;
+  GList *identities;
+  PolkitDetails *details;
+  GVariantIter iter;
+  GVariant *child;
   guint n;
-  GCancellable *cancellable;
-  PolkitDetails *_details;
+  AuthData *data;
+
+  identities = NULL;
+  details = NULL;
+
+  g_variant_get (parameters,
+                 "(&s&s&s at a{ss}&s at a(sa{sv}))",
+                 &action_id,
+                 &message,
+                 &icon_name,
+                 &details_gvariant,
+                 &cookie,
+                 &identities_gvariant);
 
-  list = NULL;
-  for (n = 0; n < identities->size; n++)
+  details = polkit_details_new_for_gvariant (details_gvariant);
+
+  g_variant_iter_init (&iter, identities_gvariant);
+  n = 0;
+  while ((child = g_variant_iter_next_value (&iter)) != NULL)
     {
-      _PolkitIdentity *real_identity = _POLKIT_IDENTITY (identities->data.v_ptr[n]);
+      PolkitIdentity *identity;
+      GError *error;
+      error = NULL;
+      identity = polkit_identity_new_for_gvariant (child, &error);
+      g_variant_unref (child);
 
-      list = g_list_prepend (list, polkit_identity_new_for_real (real_identity));
-    }
+      if (identity == NULL)
+        {
+          g_prefix_error (&error, "Error extracting identity %d: ", n);
+          g_dbus_method_invocation_return_gerror (invocation, error);
+          g_error_free (error);
+          goto out;
+        }
+      n++;
 
-  list = g_list_reverse (list);
+      identities = g_list_prepend (identities, identity);
+    }
+  identities = g_list_reverse (identities);
 
-  cancellable = g_cancellable_new ();
-  data = auth_data_new (server,
-                        cookie,
-                        method_invocation,
-                        cancellable);
-  g_object_unref (cancellable);
+  data = g_new0 (AuthData, 1);
+  data->server = server;
+  data->cookie = g_strdup (cookie);
+  data->invocation = g_object_ref (invocation);
+  data->cancellable = g_cancellable_new ();
 
   g_hash_table_insert (server->cookie_to_pending_auth, (gpointer) cookie, data);
 
-  _details = polkit_details_new_for_hash (details->data);
-
   polkit_agent_listener_initiate_authentication (server->listener,
                                                  action_id,
                                                  message,
                                                  icon_name,
-                                                 _details,
+                                                 details,
                                                  cookie,
-                                                 list,
+                                                 identities,
                                                  data->cancellable,
                                                  auth_cb,
                                                  data);
 
-  g_list_free (list);
-  g_object_unref (_details);
+ out:
+  g_list_foreach (identities, (GFunc) g_object_unref, NULL);
+  g_list_free (identities);
+  g_object_unref (details);
+  g_variant_unref (details_gvariant);
+  g_variant_unref (identities_gvariant);
 }
 
+/* ---------------------------------------------------------------------------------------------------- */
+
 static void
-handle_cancel_authentication (_PolkitAuthenticationAgent *instance,
-                              const gchar                *cookie,
-                              EggDBusMethodInvocation    *method_invocation)
+auth_agent_handle_cancel_authentication (Server                 *server,
+                                         GVariant               *parameters,
+                                         GDBusMethodInvocation  *invocation)
 {
-  Server *server = SERVER (instance);
   AuthData *data;
+  const gchar *cookie;
+
+  g_variant_get (parameters,
+                 "(&s)",
+                 &cookie);
 
   data = g_hash_table_lookup (server->cookie_to_pending_auth, cookie);
   if (data == NULL)
     {
-      egg_dbus_method_invocation_return_error (method_invocation,
-                                               POLKIT_ERROR,
-                                               POLKIT_ERROR_FAILED,
-                                               "No pending authentication request for cookie '%s'",
-                                               cookie);
+      g_dbus_method_invocation_return_error (invocation,
+                                             POLKIT_ERROR,
+                                             POLKIT_ERROR_FAILED,
+                                             "No pending authentication request for cookie '%s'",
+                                             cookie);
     }
   else
     {
       g_cancellable_cancel (data->cancellable);
-      _polkit_authentication_agent_handle_cancel_authentication_finish (method_invocation);
+      g_dbus_method_invocation_return_value (invocation, NULL);
     }
 }
 
-static void
-authentication_agent_iface_init (_PolkitAuthenticationAgentIface *agent_iface)
-{
-  agent_iface->handle_begin_authentication = handle_begin_authentication;
-  agent_iface->handle_cancel_authentication = handle_cancel_authentication;
-}
-
 /* ---------------------------------------------------------------------------------------------------- */
 
 G_DEFINE_ABSTRACT_TYPE (PolkitAgentListener, polkit_agent_listener, G_TYPE_OBJECT);
commit 6eeb077bc90c9c7783360a526b2f04645b1b0848
Author: David Zeuthen <davidz at redhat.com>
Date:   Thu Jul 29 11:37:07 2010 -0400

    Port PolkitBackendInteractiveAuthority to gdbus
    
    Signed-off-by: David Zeuthen <davidz at redhat.com>

diff --git a/src/polkit/polkitidentity.c b/src/polkit/polkitidentity.c
index b80c57f..25c7123 100644
--- a/src/polkit/polkitidentity.c
+++ b/src/polkit/polkitidentity.c
@@ -262,8 +262,34 @@ polkit_identity_get_real (PolkitIdentity *identity)
 GVariant *
 polkit_identity_to_gvariant (PolkitIdentity *identity)
 {
-  g_assert_not_reached ();
-  return NULL;
+  GVariantBuilder builder;
+  GVariant *dict;
+  GVariant *ret;
+  const gchar *kind;
+
+  kind = "";
+
+  g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
+  if (POLKIT_IS_UNIX_USER (identity))
+    {
+      kind = "unix-user";
+      g_variant_builder_add (&builder, "{sv}", "uid",
+                             g_variant_new_uint32 (polkit_unix_user_get_uid (POLKIT_UNIX_USER (identity))));
+    }
+  else if (POLKIT_IS_UNIX_GROUP (identity))
+    {
+      kind = "unix-group";
+      g_variant_builder_add (&builder, "{sv}", "gid",
+                             g_variant_new_uint32 (polkit_unix_group_get_gid (POLKIT_UNIX_GROUP (identity))));
+    }
+  else
+    {
+      g_warning ("Unknown class %s implementing PolkitIdentity", g_type_name (G_TYPE_FROM_INSTANCE (identity)));
+    }
+
+  dict = g_variant_builder_end (&builder);
+  ret = g_variant_new ("(s at a{sv})", kind, dict);
+  return ret;
 }
 
 static GVariant *
diff --git a/src/polkit/polkitsubject.c b/src/polkit/polkitsubject.c
index 0fab0d9..139c5e7 100644
--- a/src/polkit/polkitsubject.c
+++ b/src/polkit/polkitsubject.c
@@ -382,7 +382,7 @@ polkit_subject_to_gvariant (PolkitSubject *subject)
     }
   else if (POLKIT_IS_UNIX_SESSION (subject))
     {
-      kind = "unix-process";
+      kind = "unix-session";
       g_variant_builder_add (&builder, "{sv}", "session-id",
                              g_variant_new_string (polkit_unix_session_get_session_id (POLKIT_UNIX_SESSION (subject))));
     }
diff --git a/src/polkitbackend/polkitbackendinteractiveauthority.c b/src/polkitbackend/polkitbackendinteractiveauthority.c
index 3265eef..a63d5e0 100644
--- a/src/polkitbackend/polkitbackendinteractiveauthority.c
+++ b/src/polkitbackend/polkitbackendinteractiveauthority.c
@@ -356,7 +356,7 @@ struct AuthenticationAgent
   gchar *object_path;
   gchar *unique_system_bus_name;
 
-  EggDBusObjectProxy *object_proxy;
+  GDBusProxy *proxy;
 
   GList *active_sessions;
 };
@@ -704,9 +704,10 @@ polkit_backend_interactive_authority_check_authorization (PolkitBackendAuthority
   /* handle being called from ourselves */
   if (caller == NULL)
     {
-      EggDBusConnection *system_bus;
-      system_bus = egg_dbus_connection_get_for_bus (EGG_DBUS_BUS_TYPE_SYSTEM);
-      caller = polkit_system_bus_name_new (egg_dbus_connection_get_unique_name (system_bus));
+      /* TODO: this is kind of a hack */
+      GDBusConnection *system_bus;
+      system_bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL);
+      caller = polkit_system_bus_name_new (g_dbus_connection_get_unique_name (system_bus));
       g_object_unref (system_bus);
     }
 
@@ -1305,7 +1306,8 @@ authentication_agent_free (AuthenticationAgent *agent)
       g_list_free (active_sessions);
     }
 
-  g_object_unref (agent->object_proxy);
+  if (agent->proxy != NULL)
+    g_object_unref (agent->proxy);
 
   g_object_unref (agent->session);
   g_free (agent->locale);
@@ -1321,7 +1323,7 @@ authentication_agent_new (PolkitSubject *session,
                           const gchar *object_path)
 {
   AuthenticationAgent *agent;
-  EggDBusConnection *system_bus;
+  GError *error;
 
   agent = g_new0 (AuthenticationAgent, 1);
 
@@ -1330,13 +1332,22 @@ authentication_agent_new (PolkitSubject *session,
   agent->unique_system_bus_name = g_strdup (unique_system_bus_name);
   agent->locale = g_strdup (locale);
 
-  system_bus = egg_dbus_connection_get_for_bus (EGG_DBUS_BUS_TYPE_SYSTEM);
-
-  agent->object_proxy = egg_dbus_connection_get_object_proxy (system_bus,
-                                                              agent->unique_system_bus_name,
-                                                              agent->object_path);
-
-  g_object_unref (system_bus);
+  error = NULL;
+  agent->proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
+                                                G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES |
+                                                G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS,
+                                                NULL, /* GDBusInterfaceInfo* */
+                                                agent->unique_system_bus_name,
+                                                agent->object_path,
+                                                "org.freedesktop.PolicyKit1.AuthenticationAgent",
+                                                NULL, /* GCancellable* */
+                                                &error);
+  if (agent->proxy == NULL)
+    {
+      g_warning ("Error constructing proxy for agent: %s", error->message);
+      g_error_free (error);
+      /* TODO: Make authentication_agent_new() return NULL and set a GError */
+    }
 
   return agent;
 }
@@ -1500,19 +1511,18 @@ get_authentication_agent_by_unique_system_bus_name (PolkitBackendInteractiveAuth
 }
 
 static void
-authentication_agent_begin_callback (GObject *source_object,
-                                     GAsyncResult *res,
-                                     gpointer user_data)
+authentication_agent_begin_cb (GDBusProxy   *proxy,
+                               GAsyncResult *res,
+                               gpointer      user_data)
 {
-  _PolkitAuthenticationAgent *agent_dbus = _POLKIT_AUTHENTICATION_AGENT (source_object);
   AuthenticationSession *session = user_data;
-  GError *error;
   gboolean gained_authorization;
+  GError *error;
 
   error = NULL;
-  if (!_polkit_authentication_agent_begin_authentication_finish (agent_dbus,
-                                                                 res,
-                                                                 &error))
+  if (!g_dbus_proxy_call_finish (proxy,
+                                 res,
+                                 &error))
     {
       g_warning ("Error performing authentication: %s", error->message);
       g_error_free (error);
@@ -1521,7 +1531,6 @@ authentication_agent_begin_callback (GObject *source_object,
   else
     {
       gained_authorization = session->is_authenticated;
-
       g_debug ("Authentication complete, is_authenticated = %d", session->is_authenticated);
     }
 
@@ -1582,7 +1591,7 @@ get_localized_data_for_challenge (PolkitBackendInteractiveAuthority *authority,
                                   const gchar                 *locale,
                                   gchar                      **out_localized_message,
                                   gchar                      **out_localized_icon_name,
-                                  EggDBusHashMap             **out_localized_details)
+                                  PolkitDetails              **out_localized_details)
 {
   PolkitBackendInteractiveAuthorityPrivate *priv;
   PolkitActionDescription *action_desc;
@@ -1601,8 +1610,7 @@ get_localized_data_for_challenge (PolkitBackendInteractiveAuthority *authority,
 
   *out_localized_message = NULL;
   *out_localized_icon_name = NULL;
-  *out_localized_details = egg_dbus_hash_map_new (G_TYPE_STRING, NULL,
-                                                  G_TYPE_STRING, NULL);
+  *out_localized_details = NULL;
 
   action_desc = polkit_backend_action_pool_get_action (priv->action_pool,
                                                        action_id,
@@ -1659,25 +1667,6 @@ get_localized_data_for_challenge (PolkitBackendInteractiveAuthority *authority,
       icon_name = g_strdup (polkit_action_description_get_icon_name (action_desc));
     }
 
-
-  if (localized_details != NULL)
-    {
-      GHashTable *hash;
-      GHashTableIter iter;
-      const gchar *key;
-      const gchar *value;
-
-      hash = polkit_details_get_hash (localized_details);
-      if (hash != NULL)
-        {
-          g_hash_table_iter_init (&iter, hash);
-          while (g_hash_table_iter_next (&iter, (gpointer) &key, (gpointer) &value))
-            {
-              egg_dbus_hash_map_insert (*out_localized_details, key, value);
-            }
-        }
-    }
-
  out:
   if (message == NULL)
     message = g_strdup ("");
@@ -1685,6 +1674,7 @@ get_localized_data_for_challenge (PolkitBackendInteractiveAuthority *authority,
     icon_name = g_strdup ("");
   *out_localized_message = message;
   *out_localized_icon_name = icon_name;
+  *out_localized_details = localized_details;
   if (action_desc != NULL)
     g_object_unref (action_desc);
 }
@@ -1703,14 +1693,15 @@ authentication_agent_initiate_challenge (AuthenticationAgent         *agent,
                                          gpointer                     user_data)
 {
   AuthenticationSession *session;
-  _PolkitAuthenticationAgent *agent_dbus;
   gchar *cookie;
   GList *l;
   GList *identities;
-  EggDBusArraySeq *real_identities;
   gchar *localized_message;
   gchar *localized_icon_name;
-  EggDBusHashMap *localized_details;
+  PolkitDetails *localized_details;
+  GVariant *details_gvariant;
+  GVariantBuilder identities_builder;
+  GVariant *parameters;
 
   get_localized_data_for_challenge (authority,
                                     caller,
@@ -1759,69 +1750,73 @@ authentication_agent_initiate_challenge (AuthenticationAgent         *agent,
 
   agent->active_sessions = g_list_prepend (agent->active_sessions, session);
 
-  agent_dbus = _POLKIT_QUERY_INTERFACE_AUTHENTICATION_AGENT (agent->object_proxy);
+  details_gvariant = polkit_details_to_gvariant (localized_details);
+  g_variant_ref_sink (details_gvariant);
 
-  real_identities = egg_dbus_array_seq_new (EGG_DBUS_TYPE_STRUCTURE, g_object_unref, NULL, NULL);
+  g_variant_builder_init (&identities_builder, G_VARIANT_TYPE ("a(sa{sv})"));
   for (l = identities; l != NULL; l = l->next)
     {
       PolkitIdentity *identity = POLKIT_IDENTITY (l->data);
-      egg_dbus_array_seq_add (real_identities, polkit_identity_get_real (identity));
-    }
-
-  session->call_id = _polkit_authentication_agent_begin_authentication (agent_dbus,
-                                                                        EGG_DBUS_CALL_FLAGS_TIMEOUT_NONE,
-                                                                        action_id,
-                                                                        localized_message,
-                                                                        localized_icon_name,
-                                                                        localized_details,
-                                                                        session->cookie,
-                                                                        real_identities,
-                                                                        NULL,
-                                                                        authentication_agent_begin_callback,
-                                                                        session);
+      GVariant *value;
+      value = polkit_identity_to_gvariant (identity);
+      g_variant_ref_sink (value);
+      g_variant_builder_add_value (&identities_builder, value);
+      g_variant_unref (value);
+    }
+
+  parameters = g_variant_new ("(sss at a{ss}sa(sa{sv}))",
+                              action_id,
+                              localized_message,
+                              localized_icon_name,
+                              details_gvariant,
+                              session->cookie,
+                              &identities_builder);
+  g_variant_unref (details_gvariant);
+
+  g_dbus_proxy_call (agent->proxy,
+                     "BeginAuthentication",
+                     parameters, /* consumes the floating GVariant */
+                     G_DBUS_CALL_FLAGS_NONE,
+                     G_MAXINT, /* timeout_msec - no timeout */
+                     session->cancellable,
+                     (GAsyncReadyCallback) authentication_agent_begin_cb,
+                     session);
 
   g_list_foreach (identities, (GFunc) g_object_unref, NULL);
   g_list_free (identities);
-  g_object_unref (real_identities);
   g_free (cookie);
 
   g_free (localized_message);
   g_free (localized_icon_name);
-  g_object_unref (localized_details);
+  if (localized_details != NULL)
+    g_object_unref (localized_details);
 }
 
 static void
-authentication_agent_cancel_callback (GObject *source_object,
-                                      GAsyncResult *res,
-                                      gpointer user_data)
+authentication_agent_cancel_cb (GDBusProxy   *proxy,
+                                GAsyncResult *res,
+                                gpointer      user_data)
 {
-  _PolkitAuthenticationAgent *agent_dbus = _POLKIT_AUTHENTICATION_AGENT (source_object);
-
-  _polkit_authentication_agent_cancel_authentication_finish (agent_dbus,
-                                                             res,
-                                                             NULL);
+  GError *error;
+  error = NULL;
+  if (!g_dbus_proxy_call_finish (proxy, res, &error))
+    {
+      g_warning ("Error cancelling authentication: %s", error->message);
+      g_error_free (error);
+    }
 }
 
 static void
 authentication_session_cancel (AuthenticationSession *session)
 {
-  EggDBusConnection *system_bus;
-  _PolkitAuthenticationAgent *agent_dbus;
-
-  system_bus = egg_dbus_connection_get_for_bus (EGG_DBUS_BUS_TYPE_SYSTEM);
-
-  agent_dbus = _POLKIT_QUERY_INTERFACE_AUTHENTICATION_AGENT (session->agent->object_proxy);
-
-  _polkit_authentication_agent_cancel_authentication (agent_dbus,
-                                                      EGG_DBUS_CALL_FLAGS_NONE,
-                                                      session->cookie,
-                                                      NULL,
-                                                      authentication_agent_cancel_callback,
-                                                      NULL);
-
-  egg_dbus_connection_pending_call_cancel (system_bus, session->call_id);
-
-  g_object_unref (system_bus);
+  g_dbus_proxy_call (session->agent->proxy,
+                     "CancelAuthentication",
+                     g_variant_new ("(s)", session->cookie),
+                     G_DBUS_CALL_FLAGS_NONE,
+                     -1, /* timeout_msec */
+                     NULL, /* GCancellable* */
+                     (GAsyncReadyCallback) authentication_agent_cancel_cb,
+                     NULL);
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
commit 6486dea34072ac4b666d00fcfe8f620df3ccd7f8
Author: David Zeuthen <davidz at redhat.com>
Date:   Wed Jul 28 15:29:14 2010 -0400

    Port CK class to gdbus
    
    Also simplify the code it by using the on-disk database. Makes
    everything a lot simpler.
    
    Signed-off-by: David Zeuthen <davidz at redhat.com>

diff --git a/src/polkit/polkitauthority.c b/src/polkit/polkitauthority.c
index 11ebed8..d224bcf 100644
--- a/src/polkit/polkitauthority.c
+++ b/src/polkit/polkitauthority.c
@@ -262,6 +262,14 @@ polkit_authority_class_init (PolkitAuthorityClass *klass)
 PolkitAuthority *
 polkit_authority_get (void)
 {
+  static volatile GQuark error_quark = 0;
+
+  if (error_quark == 0)
+    {
+      error_quark = POLKIT_ERROR;
+    }
+
+
   if (the_authority != NULL)
     {
       g_object_ref (the_authority);
diff --git a/src/polkitbackend/Makefile.am b/src/polkitbackend/Makefile.am
index 4cb7310..968c1b8 100644
--- a/src/polkitbackend/Makefile.am
+++ b/src/polkitbackend/Makefile.am
@@ -17,22 +17,6 @@ INCLUDES =                                                      \
 	-DEGG_DBUS_I_KNOW_API_IS_SUBJECT_TO_CHANGE		\
         $(NULL)
 
-BUILT_SOURCES = 						\
-	ck-built-sources.stamp					\
-	$(NULL)
-
-ck-built-sources.stamp : Makefile.am $(srcdir)/org.freedesktop.ConsoleKit.xml
-	eggdbus-binding-tool										\
-	  --namespace       "Ck"									\
-	  --dbus-namespace  "org.freedesktop.ConsoleKit"						\
-	  --introspection-xml $(top_srcdir)/src/polkitbackend/org.freedesktop.ConsoleKit.xml		\
-	  --stamp-file ck-built-sources.stamp								\
-	  $(NULL)
-
-# keep in sync with contents of ck-built-sources.stamp (Thanks autotools)
-#
-ck_built_sources = ckbindingsmarshal.c ckbindingsmarshal.h ckbindingsmarshal.list ckbindings.c ckbindings.h ckbindingstypes.h cksession.c cksession.h docbook-interface-org.freedesktop.ConsoleKit.Session.xml ckseat.c ckseat.h docbook-interface-org.freedesktop.ConsoleKit.Seat.xml ckmanager.c ckmanager.h docbook-interface-org.freedesktop.ConsoleKit.Manager.xml ckerror.c ckerror.h docbook-enum-Error.xml ckdevice.c ckdevice.h docbook-struct-Device.xml
-
 lib_LTLIBRARIES=libpolkit-backend-1.la
 
 libpolkit_backend_1includedir=$(includedir)/polkit-1/polkitbackend
@@ -51,7 +35,6 @@ libpolkit_backend_1include_HEADERS =                        		\
         $(NULL)
 
 libpolkit_backend_1_la_SOURCES =                                   			\
-	$(ck_built_sources)								\
 	$(BUILT_SOURCES)								\
         polkitbackend.h									\
 	polkitbackendtypes.h								\
@@ -94,10 +77,10 @@ EXTRA_DIST =								\
 	$(NULL)
 
 dist-hook :
-	(for i in $(ck_built_sources) $(BUILT_SOURCES) ; do rm -f $(distdir)/$$i ; done)
+	(for i in $(BUILT_SOURCES) ; do rm -f $(distdir)/$$i ; done)
 
 clean-local :
-	rm -f *~ $(ck_built_sources) $(BUILT_SOURCES)
+	rm -f *~ $(BUILT_SOURCES)
 
 install-exec-hook:
 	mkdir -p $(DESTDIR)$(localstatedir)/lib/polkit-1
diff --git a/src/polkitbackend/org.freedesktop.ConsoleKit.xml b/src/polkitbackend/org.freedesktop.ConsoleKit.xml
deleted file mode 100644
index 89379b2..0000000
--- a/src/polkitbackend/org.freedesktop.ConsoleKit.xml
+++ /dev/null
@@ -1,278 +0,0 @@
-<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
-"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
-<node>
-
-  <!-- The error domain used for reporting errors -->
-  <annotation name="org.gtk.EggDBus.DeclareErrorDomain" value="Error">
-    <annotation name="org.gtk.EggDBus.ErrorDomain.Member" value="org.freedesktop.ConsoleKit.Manager.GeneralError">
-      <annotation name="org.gtk.EggDBus.ErrorDomain.Member.Value" value="0"/>
-    </annotation>
-    <annotation name="org.gtk.EggDBus.ErrorDomain.Member" value="org.freedesktop.ConsoleKit.Manager.NotPrivileged"/>
-
-    <annotation name="org.gtk.EggDBus.ErrorDomain.Member" value="org.freedesktop.ConsoleKit.Seat.GeneralError">
-      <annotation name="org.gtk.EggDBus.ErrorDomain.Member.Value" value="100"/>
-    </annotation>
-
-    <annotation name="org.gtk.EggDBus.ErrorDomain.Member" value="org.freedesktop.ConsoleKit.Session.GeneralError">
-      <annotation name="org.gtk.EggDBus.ErrorDomain.Member.Value" value="200"/>
-    </annotation>
-  </annotation>
-
-  <!-- Device -->
-  <annotation name="org.gtk.EggDBus.DeclareStruct" value="Device">
-    <annotation name="org.gtk.EggDBus.DocString" value="The #Device type represents devices that are associated with seats."/>
-    <annotation name="org.gtk.EggDBus.DocString.Summary" value="Devices"/>
-
-    <annotation name="org.gtk.EggDBus.Struct.Member"  value="String:id1">
-      <annotation name="org.gtk.EggDBus.DocString" value="The first device identifier"/>
-    </annotation>
-    <annotation name="org.gtk.EggDBus.Struct.Member" value="String:id2">
-      <annotation name="org.gtk.EggDBus.DocString" value="The second device identifier"/>
-    </annotation>
-  </annotation>
-
-  <!-- -->
-
-  <interface name="org.freedesktop.ConsoleKit.Manager">
-
-    <!-- All of these should probably be read-only properties instead of methods -->
-    <method name="GetSystemIdleSinceHint">
-      <arg name="iso8601_datetime" type="s" direction="out"/>
-    </method>
-    <method name="GetSystemIdleHint">
-      <arg name="idle_hint" type="b" direction="out"/>
-    </method>
-    <method name="GetSessions">
-      <arg name="sessions" type="ao" direction="out"/>
-    </method>
-    <method name="GetSeats">
-      <arg name="seats" type="ao" direction="out"/>
-    </method>
-    <method name="GetCurrentSession">
-      <arg name="ssid" type="o" direction="out"/>
-    </method>
-
-    <method name="GetSessionsForUser">
-      <arg name="uid" type="u" direction="in"/>
-      <arg name="sessions" type="ao" direction="out"/>
-    </method>
-    <method name="GetSessionsForUnixUser">
-      <arg name="uid" type="u" direction="in"/>
-      <arg name="sessions" type="ao" direction="out"/>
-    </method>
-    <method name="GetSessionForUnixProcess">
-      <arg name="pid" type="u" direction="in"/>
-      <arg name="ssid" type="o" direction="out"/>
-    </method>
-    <method name="GetSessionForCookie">
-      <arg name="cookie" type="s" direction="in"/>
-      <arg name="ssid" type="o" direction="out"/>
-    </method>
-
-    <method name="CloseSession">
-      <arg name="cookie" type="s" direction="in"/>
-      <arg name="result" type="b" direction="out"/>
-    </method>
-    <method name="OpenSessionWithParameters">
-      <arg name="parameters" type="a(sv)" direction="in">
-        <annotation name="org.gtk.EggDBus.Type" value="Array<Struct<String,Variant>>"/>
-      </arg>
-      <arg name="cookie" type="s" direction="out"/>
-    </method>
-    <method name="OpenSession">
-      <arg name="cookie" type="s" direction="out"/>
-    </method>
-    <method name="Stop">
-    </method>
-    <method name="Restart">
-    </method>
-
-    <!-- If the above Get*() methods are properties and we have org.fd.Properties.Changed() these signals
-         are not needed -->
-    <signal name="SystemIdleHintChanged">
-      <arg type="b"/>
-    </signal>
-    <signal name="SeatRemoved">
-      <arg type="o"/>
-    </signal>
-    <signal name="SeatAdded">
-      <arg type="o"/>
-    </signal>
-  </interface>
-
-  <interface name="org.freedesktop.ConsoleKit.Seat">
-    <method name="ActivateSession">
-      <arg name="ssid" type="o" direction="in"/>
-    </method>
-
-    <!-- All of these should probably be read-only properties instead of Get*() methods -->
-    <method name="CanActivateSessions">
-      <arg name="can_activate" type="b" direction="out"/>
-    </method>
-    <method name="GetActiveSession">
-      <arg name="ssid" type="o" direction="out"/>
-    </method>
-    <method name="GetDevices">
-      <arg name="devices" type="a(ss)" direction="out"/>
-    </method>
-    <method name="GetSessions">
-      <arg name="sessions" type="ao" direction="out"/>
-    </method>
-    <method name="GetId">
-      <arg name="sid" type="o" direction="out"/>
-    </method>
-
-    <signal name="DeviceRemoved">
-      <arg type="(ss)"/>
-    </signal>
-    <signal name="DeviceAdded">
-      <arg type="(ss)"/>
-    </signal>
-
-    <!-- If the above Get*() methods are properties and we have org.fd.Properties.Changed() these signals
-         are not needed -->
-    <signal name="SessionRemoved">
-      <arg type="o"/>
-    </signal>
-    <signal name="SessionAdded">
-      <arg type="o"/>
-    </signal>
-    <signal name="ActiveSessionChanged">
-      <arg type="s"/>
-    </signal>
-  </interface>
-
-  <interface name="org.freedesktop.ConsoleKit.Session">
-    <method name="SetIdleHint">
-      <arg name="idle_hint" type="b" direction="in"/>
-    </method>
-
-    <!-- This should really be a read-only property, not a method -->
-    <method name="GetIdleSinceHint">
-      <arg name="iso8601_datetime" type="s" direction="out"/>
-    </method>
-
-    <!-- superfluous: there's already :idle-hint
-       <method name="GetIdleHint">
-         <arg name="idle_hint" type="b" direction="out"/>
-       </method>
-    -->
-
-    <method name="Unlock">
-    </method>
-    <method name="Lock">
-    </method>
-    <method name="Activate">
-    </method>
-
-    <!-- This should really be a read-only property, not a method -->
-    <method name="GetCreationTime">
-      <arg name="iso8601_datetime" type="s" direction="out"/>
-    </method>
-
-    <!-- superfluous: there's already :is-local
-       <method name="IsLocal">
-         <arg name="local" type="b" direction="out"/>
-       </method>
-     -->
-
-    <!-- superfluous: there's already :is-active
-    <method name="IsActive">
-      <arg name="active" type="b" direction="out"/>
-    </method>
-    -->
-
-    <method name="GetLoginSessionId">
-      <arg name="login_session_id" type="s" direction="out"/>
-    </method>
-
-    <!-- superfluous: there's already :remote-host-name
-      <method name="GetRemoteHostName">
-        <arg name="remote_host_name" type="s" direction="out"/>
-       </method>
-    -->
-
-    <!-- superfluous: there's already :display-device
-      <method name="GetDisplayDevice">
-        <arg name="display_device" type="s" direction="out"/>
-      </method>
-    -->
-
-    <!-- superfluous: there's already :x11-display-device
-    <method name="GetX11DisplayDevice">
-      <arg name="x11_display_device" type="s" direction="out"/>
-    </method>
-    -->
-
-    <!-- superfluous: there's already :x11-display
-    <method name="GetX11Display">
-      <arg name="display" type="s" direction="out"/>
-    </method>
-    -->
-
-    <!-- superfluous: there's already :unix-user
-    <method name="GetUnixUser">
-      <arg name="uid" type="u" direction="out"/>
-    </method>
-    -->
-
-    <!-- superfluous: there's already :user
-    <method name="GetUser">
-      <arg name="uid" type="u" direction="out"/>
-    </method>
-    -->
-
-    <!-- superfluous: there's already :session-type
-    <method name="GetSessionType">
-      <arg name="type" type="s" direction="out"/>
-    </method>
-    -->
-
-    <!-- This should really be a read-only property, not a method -->
-    <method name="GetSeatId">
-      <arg name="sid" type="o" direction="out"/>
-    </method>
-
-    <!-- This should really be a read-only property, not a method -->
-    <method name="GetId">
-      <arg name="ssid" type="o" direction="out"/>
-    </method>
-
-    <!-- This should probably be called Unlocked -->
-    <signal name="Unlock">
-    </signal>
-
-    <!-- This should probably be called Locked -->
-    <signal name="Lock">
-    </signal>
-
-    <!-- superfluous if you have the org.fd.Properties.Changed() signal -->
-    <signal name="IdleHintChanged">
-      <arg type="b"/>
-    </signal>
-
-    <!-- superfluous if you have the org.fd.Properties.Changed() signal -->
-    <signal name="ActiveChanged">
-      <arg type="b"/>
-    </signal>
-
-    <!--
-       Note: ConsoleKit declares these as readwrite but since setting may fail (due to lack
-             of privilege) they shouldn't be properties [1]; instead use Set* methods.
-
-             [1] : most object systems, specifically GObject, don't have a way to return
-                   errors when setting properties
-      -->
-    <property name="idle-hint" type="b" access="read"/>
-    <property name="is-local" type="b" access="read"/>
-    <property name="active" type="b" access="read"/>
-    <property name="x11-display-device" type="s" access="read"/>
-    <property name="x11-display" type="s" access="read"/>
-    <property name="display-device" type="s" access="read"/>
-    <property name="remote-host-name" type="s" access="read"/>
-    <property name="session-type" type="s" access="read"/>
-    <property name="user" type="u" access="read"/>
-    <property name="unix-user" type="u" access="read"/>
-  </interface>
-
-</node>
diff --git a/src/polkitbackend/polkitbackendinteractiveauthority.c b/src/polkitbackend/polkitbackendinteractiveauthority.c
index 41e9017..3265eef 100644
--- a/src/polkitbackend/polkitbackendinteractiveauthority.c
+++ b/src/polkitbackend/polkitbackendinteractiveauthority.c
@@ -769,11 +769,22 @@ polkit_backend_interactive_authority_check_authorization (PolkitBackendAuthority
       if (!POLKIT_IS_UNIX_USER (user_of_caller) ||
           polkit_unix_user_get_uid (POLKIT_UNIX_USER (user_of_caller)) != 0)
         {
-          g_simple_async_result_set_error (simple,
-                                           POLKIT_ERROR,
-                                           POLKIT_ERROR_NOT_AUTHORIZED,
-                                           "Only trusted callers can use CheckAuthorization() for subjects "
-                                           "belonging to other identities and/or pass details");
+          if (has_details)
+            {
+              g_simple_async_result_set_error (simple,
+                                               POLKIT_ERROR,
+                                               POLKIT_ERROR_NOT_AUTHORIZED,
+                                               "Only trusted callers (e.g. uid 0) can use CheckAuthorization() and "
+                                               "pass details");
+            }
+          else
+            {
+              g_simple_async_result_set_error (simple,
+                                               POLKIT_ERROR,
+                                               POLKIT_ERROR_NOT_AUTHORIZED,
+                                               "Only trusted callers (e.g. uid 0) can use CheckAuthorization() for "
+                                               "subjects belonging to other identities");
+            }
           g_simple_async_result_complete (simple);
           g_object_unref (simple);
           goto out;
diff --git a/src/polkitbackend/polkitbackendsessionmonitor.c b/src/polkitbackend/polkitbackendsessionmonitor.c
index 2028250..2b63f3c 100644
--- a/src/polkitbackend/polkitbackendsessionmonitor.c
+++ b/src/polkitbackend/polkitbackendsessionmonitor.c
@@ -28,7 +28,8 @@
 
 #include <polkit/polkit.h>
 #include "polkitbackendsessionmonitor.h"
-#include "ckbindings.h"
+
+#define CKDB_PATH "/var/run/ConsoleKit/database"
 
 /**
  * SECTION:polkitbackendsessionmonitor
@@ -42,13 +43,10 @@ struct _PolkitBackendSessionMonitor
 {
   GObject parent_instance;
 
-  EggDBusConnection *system_bus;
-
-  EggDBusObjectProxy *ck_manager_object_proxy;
+  GDBusConnection *system_bus;
 
-  CkManager *ck_manager;
-  EggDBusHashMap *seat_object_path_to_object_proxy;
-  EggDBusHashMap *session_object_path_to_object_proxy;
+  GKeyFile *database;
+  GFileMonitor *database_monitor;
 };
 
 struct _PolkitBackendSessionMonitorClass
@@ -67,243 +65,111 @@ enum
 
 static guint signals[LAST_SIGNAL] = {0};
 
-static void seat_session_added (CkSeat      *seat,
-                                const gchar *object_path,
-                                gpointer     user_data);
-
-static void seat_session_removed (CkSeat      *seat,
-                                  const gchar *object_path,
-                                  gpointer     user_data);
-
-static void session_active_changed (CkSession   *session,
-                                    gboolean     is_active,
-                                    gpointer     user_data);
-
 G_DEFINE_TYPE (PolkitBackendSessionMonitor, polkit_backend_session_monitor, G_TYPE_OBJECT);
 
 /* ---------------------------------------------------------------------------------------------------- */
 
-static void
-add_seat (PolkitBackendSessionMonitor *monitor,
-          const gchar                 *object_path)
-{
-  CkSeat *seat;
-  EggDBusObjectProxy *object_proxy;
-
-  object_proxy = egg_dbus_connection_get_object_proxy (monitor->system_bus,
-                                                       "org.freedesktop.ConsoleKit",
-                                                       object_path);
-
-  egg_dbus_hash_map_insert (monitor->seat_object_path_to_object_proxy,
-                            g_strdup (object_path),
-                            object_proxy);
-
-  seat = CK_QUERY_INTERFACE_SEAT (object_proxy);
-
-  g_signal_connect (seat,
-                    "session-added",
-                    G_CALLBACK (seat_session_added),
-                    monitor);
-
-  g_signal_connect (seat,
-                    "session-removed",
-                    G_CALLBACK (seat_session_removed),
-                    monitor);
-}
-
-static void
-add_session (PolkitBackendSessionMonitor *monitor,
-             const gchar                 *object_path)
-{
-  CkSession *session;
-  EggDBusObjectProxy *object_proxy;
-
-  object_proxy = egg_dbus_connection_get_object_proxy (monitor->system_bus,
-                                                       "org.freedesktop.ConsoleKit",
-                                                       object_path);
-
-  egg_dbus_hash_map_insert (monitor->session_object_path_to_object_proxy,
-                            g_strdup (object_path),
-                            object_proxy);
-
-  session = CK_QUERY_INTERFACE_SESSION (object_proxy);
-
-  g_signal_connect (session,
-                    "active-changed",
-                    G_CALLBACK (session_active_changed),
-                    monitor);
-}
-
-static void
-remove_seat (PolkitBackendSessionMonitor *monitor,
-             const gchar                 *object_path)
-{
-  egg_dbus_hash_map_remove (monitor->seat_object_path_to_object_proxy,
-                            object_path);
-}
-
-static void
-remove_session (PolkitBackendSessionMonitor *monitor,
-                const gchar                 *object_path)
-{
-  egg_dbus_hash_map_remove (monitor->session_object_path_to_object_proxy,
-                            object_path);
-}
-
-/* ---------------------------------------------------------------------------------------------------- */
-
-/* D-Bus signal handlers */
-
-static void
-manager_seat_added (CkManager   *manager,
-                    const gchar *object_path,
-                    gpointer     user_data)
-{
-  PolkitBackendSessionMonitor *monitor = POLKIT_BACKEND_SESSION_MONITOR (user_data);
-
-  //g_debug ("seat %s added", object_path);
-
-  add_seat (monitor, object_path);
-
-  g_signal_emit (monitor, signals[CHANGED_SIGNAL], 0);
-}
-
-static void
-manager_seat_removed (CkManager   *manager,
-                      const gchar *object_path,
-                      gpointer     user_data)
+static gboolean
+reload_database (PolkitBackendSessionMonitor  *monitor,
+                 GError                      **error)
 {
-  PolkitBackendSessionMonitor *monitor = POLKIT_BACKEND_SESSION_MONITOR (user_data);
-
-  //g_debug ("seat %s removed", object_path);
-
-  remove_seat (monitor, object_path);
-
-  g_signal_emit (monitor, signals[CHANGED_SIGNAL], 0);
-}
+  gboolean ret;
 
-static void
-seat_session_added (CkSeat      *seat,
-                    const gchar *object_path,
-                    gpointer     user_data)
-{
-  PolkitBackendSessionMonitor *monitor = POLKIT_BACKEND_SESSION_MONITOR (user_data);
+  ret = FALSE;
 
-  //g_debug ("session %s added", object_path);
+  monitor->database = g_key_file_new ();
+  if (!g_key_file_load_from_file (monitor->database,
+                                  CKDB_PATH,
+                                  G_KEY_FILE_NONE,
+                                  error))
+    {
+      g_key_file_free (monitor->database);
+      monitor->database = NULL;
+      goto out;
+    }
 
-  add_session (monitor, object_path);
+  ret = TRUE;
 
-  g_signal_emit (monitor, signals[CHANGED_SIGNAL], 0);
+ out:
+  return ret;
 }
 
-static void
-seat_session_removed (CkSeat      *seat,
-                      const gchar *object_path,
-                      gpointer     user_data)
+static gboolean
+ensure_database (PolkitBackendSessionMonitor  *monitor,
+                 GError                      **error)
 {
-  PolkitBackendSessionMonitor *monitor = POLKIT_BACKEND_SESSION_MONITOR (user_data);
+  gboolean ret;
 
-  //g_debug ("session %s removed", object_path);
+  if (monitor->database != NULL)
+    {
+      ret = TRUE;
+      goto out;
+    }
 
-  remove_session (monitor, object_path);
+  ret = reload_database (monitor, error);
 
-  g_signal_emit (monitor, signals[CHANGED_SIGNAL], 0);
+ out:
+  return ret;
 }
 
 static void
-session_active_changed (CkSession   *session,
-                        gboolean     is_active,
-                        gpointer     user_data)
+on_file_monitor_changed (GFileMonitor     *file_monitor,
+                         GFile            *file,
+                         GFile            *other_file,
+                         GFileMonitorEvent event_type,
+                         gpointer          user_data)
 {
   PolkitBackendSessionMonitor *monitor = POLKIT_BACKEND_SESSION_MONITOR (user_data);
-  EggDBusObjectProxy *object_proxy;
-
-  object_proxy = egg_dbus_interface_proxy_get_object_proxy (EGG_DBUS_INTERFACE_PROXY (session));
-
-  //g_debug ("session %s active changed to %d", egg_dbus_object_proxy_get_object_path (object_proxy), is_active);
-
-  egg_dbus_object_proxy_invalidate_properties (object_proxy);
 
+  /* throw away cache */
+  if (monitor->database != NULL)
+    {
+      g_key_file_free (monitor->database);
+      monitor->database = NULL;
+    }
   g_signal_emit (monitor, signals[CHANGED_SIGNAL], 0);
 }
 
-/* ---------------------------------------------------------------------------------------------------- */
-
 static void
 polkit_backend_session_monitor_init (PolkitBackendSessionMonitor *monitor)
 {
   GError *error;
-  gchar **seats_object_paths;
-  gchar **sessions_object_paths;
-  guint n;
+  GFile *file;
 
   error = NULL;
-  seats_object_paths = NULL;
-  sessions_object_paths = NULL;
-
-  monitor->seat_object_path_to_object_proxy = egg_dbus_hash_map_new (G_TYPE_STRING,
-                                                                     g_free,
-                                                                     EGG_DBUS_TYPE_OBJECT_PROXY,
-                                                                     g_object_unref);
-
-  monitor->session_object_path_to_object_proxy = egg_dbus_hash_map_new (G_TYPE_STRING,
-                                                                        g_free,
-                                                                        EGG_DBUS_TYPE_OBJECT_PROXY,
-                                                                        g_object_unref);
-
-  monitor->system_bus = egg_dbus_connection_get_for_bus (EGG_DBUS_BUS_TYPE_SYSTEM);
-
-  monitor->ck_manager_object_proxy = egg_dbus_connection_get_object_proxy (monitor->system_bus,
-                                                                           "org.freedesktop.ConsoleKit",
-                                                                           "/org/freedesktop/ConsoleKit/Manager");
-
-  monitor->ck_manager = CK_QUERY_INTERFACE_MANAGER (monitor->ck_manager_object_proxy);
-
-  g_signal_connect (monitor->ck_manager,
-                    "seat-added",
-                    G_CALLBACK (manager_seat_added),
-                    monitor);
-
-  g_signal_connect (monitor->ck_manager,
-                    "seat-removed",
-                    G_CALLBACK (manager_seat_removed),
-                    monitor);
-
-  /* TODO: it would be a lot nicer to do all of this async; once we have
-   *       GFiber (bgo #565501) it will be a lot easier...
-   */
-  if (!ck_manager_get_seats_sync (monitor->ck_manager,
-                                  EGG_DBUS_CALL_FLAGS_NONE,
-                                  &seats_object_paths,
-                                  NULL,
-                                  &error))
+  monitor->system_bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error);
+  if (monitor->system_bus == NULL)
     {
-      g_warning ("Error getting seats: %s", error->message);
+      g_printerr ("Error getting system bus: %s", error->message);
       g_error_free (error);
-      goto out;
     }
 
-  for (n = 0; seats_object_paths[n] != NULL; n++)
-    add_seat (monitor, seats_object_paths[n]);
-
-  if (!ck_manager_get_sessions_sync (monitor->ck_manager,
-                                     EGG_DBUS_CALL_FLAGS_NONE,
-                                     &sessions_object_paths,
-                                     NULL,
-                                     &error))
+  error = NULL;
+  if (!ensure_database (monitor, &error))
     {
-      g_warning ("Error getting sessions: %s", error->message);
+      g_printerr ("Error loading " CKDB_PATH ": %s", error->message);
       g_error_free (error);
-      goto out;
     }
 
-  for (n = 0; sessions_object_paths[n] != NULL; n++)
-    add_session (monitor, sessions_object_paths[n]);
-
- out:
-
-  g_strfreev (seats_object_paths);
-  g_strfreev (sessions_object_paths);
+  error = NULL;
+  file = g_file_new_for_path (CKDB_PATH);
+  monitor->database_monitor = g_file_monitor_file (file,
+                                                   G_FILE_MONITOR_NONE,
+                                                   NULL,
+                                                   &error);
+  g_object_unref (file);
+  if (monitor->database_monitor == NULL)
+    {
+      g_printerr ("Error monitoring " CKDB_PATH ": %s", error->message);
+      g_error_free (error);
+    }
+  else
+    {
+      g_signal_connect (monitor->database_monitor,
+                        "changed",
+                        G_CALLBACK (on_file_monitor_changed),
+                        monitor);
+    }
 }
 
 static void
@@ -311,10 +177,14 @@ polkit_backend_session_monitor_finalize (GObject *object)
 {
   PolkitBackendSessionMonitor *monitor = POLKIT_BACKEND_SESSION_MONITOR (object);
 
-  g_object_unref (monitor->seat_object_path_to_object_proxy);
-  g_object_unref (monitor->session_object_path_to_object_proxy);
-  g_object_unref (monitor->ck_manager_object_proxy);
-  g_object_unref (monitor->system_bus);
+  if (monitor->system_bus != NULL)
+    g_object_unref (monitor->system_bus);
+
+  if (monitor->database_monitor != NULL)
+    g_object_unref (monitor->database_monitor);
+
+  if (monitor->database != NULL)
+    g_key_file_free (monitor->database);
 
   if (G_OBJECT_CLASS (polkit_backend_session_monitor_parent_class)->finalize != NULL)
     G_OBJECT_CLASS (polkit_backend_session_monitor_parent_class)->finalize (object);
@@ -356,42 +226,13 @@ polkit_backend_session_monitor_new (void)
   return monitor;
 }
 
-static gboolean
-get_sessions_foreach_cb (EggDBusHashMap *map,
-                         gpointer        key,
-                         gpointer        value,
-                         gpointer        user_data)
-{
-  GList **l;
-  const gchar *session_object_path;
-  PolkitSubject *session;
-
-  l = user_data;
-  session_object_path = key;
-
-  session = polkit_unix_session_new (session_object_path);
-
-  *l = g_list_prepend (*l, session);
-
-  return FALSE;
-}
-
 /* ---------------------------------------------------------------------------------------------------- */
 
 GList *
 polkit_backend_session_monitor_get_sessions (PolkitBackendSessionMonitor *monitor)
 {
-  GList *l;
-
-  l = NULL;
-
-  egg_dbus_hash_map_foreach (monitor->session_object_path_to_object_proxy,
-                             get_sessions_foreach_cb,
-                             &l);
-
-  l = g_list_reverse (l);
-
-  return l;
+  /* TODO */
+  return NULL;
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
@@ -411,76 +252,72 @@ polkit_backend_session_monitor_get_user_for_subject (PolkitBackendSessionMonitor
                                                      PolkitSubject                *subject,
                                                      GError                      **error)
 {
-  PolkitIdentity *user;
-  uid_t uid;
+  PolkitIdentity *ret;
+  GError *local_error;
+  gchar *group;
+  guint32 uid;
 
-  user = NULL;
+  ret = NULL;
 
   if (POLKIT_IS_UNIX_PROCESS (subject))
     {
-      GError *local_error;
-
       local_error = NULL;
       uid = polkit_unix_process_get_owner (POLKIT_UNIX_PROCESS (subject), &local_error);
       if (local_error != NULL)
         {
-          g_propagate_error (error, local_error);
+          g_propagate_prefixed_error (error, local_error, "Error getting user for process: ");
           g_error_free (local_error);
           goto out;
         }
-      user = polkit_unix_user_new (uid);
-    }
-  else if (POLKIT_IS_UNIX_SESSION (subject))
-    {
-      const gchar *session_id;
-      EggDBusObjectProxy *session_object_proxy;
-      CkSession *session;
-
-      session_id = polkit_unix_session_get_session_id (POLKIT_UNIX_SESSION (subject));
-
-      session_object_proxy = egg_dbus_hash_map_lookup (monitor->session_object_path_to_object_proxy,
-                                                       session_id);
-      if (session_object_proxy == NULL)
-        {
-          g_set_error (error,
-                       POLKIT_ERROR,
-                       POLKIT_ERROR_FAILED,
-                       "No ConsoleKit session with id %s",
-                       session_id);
-          goto out;
-        }
-
-      session = CK_QUERY_INTERFACE_SESSION (session_object_proxy);
 
-      uid = (uid_t) ck_session_get_user (session);
-
-      user = polkit_unix_user_new (uid);
+      ret = polkit_unix_user_new (uid);
     }
   else if (POLKIT_IS_SYSTEM_BUS_NAME (subject))
     {
-      /* TODO: cache this stuff */
-      if (!egg_dbus_bus_get_connection_unix_user_sync (egg_dbus_connection_get_bus (monitor->system_bus),
-                                                       EGG_DBUS_CALL_FLAGS_NONE,
-                                                       polkit_system_bus_name_get_name (POLKIT_SYSTEM_BUS_NAME (subject)),
-                                                       &uid,
-                                                       NULL,
-                                                       error))
+      GVariant *result;
+
+      result = g_dbus_connection_call_sync (monitor->system_bus,
+                                            "org.freedesktop.DBus",
+                                            "/org/freedesktop/DBus",
+                                            "org.freedesktop.DBus",
+                                            "GetConnectionUnixUser",
+                                            g_variant_new ("(s)", polkit_system_bus_name_get_name (POLKIT_SYSTEM_BUS_NAME (subject))),
+                                            G_VARIANT_TYPE ("(u)"),
+                                            G_DBUS_CALL_FLAGS_NONE,
+                                            -1, /* timeout_msec */
+                                            NULL, /* GCancellable */
+                                            error);
+      if (result == NULL)
         goto out;
+      g_variant_get (result, "(u)", &uid);
+      g_variant_unref (result);
 
-      user = polkit_unix_user_new (uid);
+      ret = polkit_unix_user_new (uid);
     }
-  else
+  else if (POLKIT_IS_UNIX_SESSION (subject))
     {
-      g_set_error (error,
-                   POLKIT_ERROR,
-                   POLKIT_ERROR_NOT_SUPPORTED,
-                   "Cannot get user for subject of type %s",
-                   g_type_name (G_TYPE_FROM_INSTANCE (subject)));
+      if (!ensure_database (monitor, error))
+        {
+          g_prefix_error (error, "Error getting user for session: Error ensuring CK database at " CKDB_PATH ": ");
+          goto out;
+        }
+
+      group = g_strdup_printf ("Session %s", polkit_unix_session_get_session_id (POLKIT_UNIX_SESSION (subject)));
+      local_error = NULL;
+      uid = g_key_file_get_integer (monitor->database, group, "uid", &local_error);
+      if (local_error != NULL)
+        {
+          g_propagate_prefixed_error (error, local_error, "Error getting uid using " CKDB_PATH ": ");
+          g_free (group);
+          goto out;
+        }
+      g_free (group);
+
+      ret = polkit_unix_user_new (uid);
     }
 
  out:
-
-  return user;
+  return ret;
 }
 
 /**
@@ -504,45 +341,63 @@ polkit_backend_session_monitor_get_session_for_subject (PolkitBackendSessionMoni
 
   if (POLKIT_IS_UNIX_PROCESS (subject))
     {
-      gchar *session_id;
-
-      if (!ck_manager_get_session_for_unix_process_sync (monitor->ck_manager,
-                                                         EGG_DBUS_CALL_FLAGS_NONE,
-                                                         polkit_unix_process_get_pid (POLKIT_UNIX_PROCESS (subject)),
-                                                         &session_id,
-                                                         NULL,
-                                                         error))
+      const gchar *session_id;
+      GVariant *result;
+      result = g_dbus_connection_call_sync (monitor->system_bus,
+                                            "org.freedesktop.ConsoleKit",
+                                            "/org/freedesktop/ConsoleKit/Manager",
+                                            "org.freedesktop.ConsoleKit.Manager",
+                                            "GetSessionForUnixProcess",
+                                            g_variant_new ("(u)", polkit_unix_process_get_pid (POLKIT_UNIX_PROCESS (subject))),
+                                            G_VARIANT_TYPE ("(o)"),
+                                            G_DBUS_CALL_FLAGS_NONE,
+                                            -1, /* timeout_msec */
+                                            NULL, /* GCancellable */
+                                            error);
+      if (result == NULL)
         goto out;
-
+      g_variant_get (result, "(&o)", &session_id);
       session = polkit_unix_session_new (session_id);
-
-      g_free (session_id);
+      g_variant_unref (result);
     }
   else if (POLKIT_IS_SYSTEM_BUS_NAME (subject))
     {
-      pid_t pid;
-      gchar *session_id;
-
-      /* TODO: cache this stuff */
-      if (!egg_dbus_bus_get_connection_unix_process_id_sync (egg_dbus_connection_get_bus (monitor->system_bus),
-                                                             EGG_DBUS_CALL_FLAGS_NONE,
-                                                             polkit_system_bus_name_get_name (POLKIT_SYSTEM_BUS_NAME (subject)),
-                                                             &pid,
-                                                             NULL,
-                                                             error))
+      guint32 pid;
+      const gchar *session_id;
+      GVariant *result;
+
+      result = g_dbus_connection_call_sync (monitor->system_bus,
+                                            "org.freedesktop.DBus",
+                                            "/org/freedesktop/DBus",
+                                            "org.freedesktop.DBus",
+                                            "GetConnectionUnixProcessID",
+                                            g_variant_new ("(s)", polkit_system_bus_name_get_name (POLKIT_SYSTEM_BUS_NAME (subject))),
+                                            G_VARIANT_TYPE ("(u)"),
+                                            G_DBUS_CALL_FLAGS_NONE,
+                                            -1, /* timeout_msec */
+                                            NULL, /* GCancellable */
+                                            error);
+      if (result == NULL)
         goto out;
-
-      if (!ck_manager_get_session_for_unix_process_sync (monitor->ck_manager,
-                                                         EGG_DBUS_CALL_FLAGS_NONE,
-                                                         pid,
-                                                         &session_id,
-                                                         NULL,
-                                                         error))
+      g_variant_get (result, "(u)", &pid);
+      g_variant_unref (result);
+
+      result = g_dbus_connection_call_sync (monitor->system_bus,
+                                            "org.freedesktop.ConsoleKit",
+                                            "/org/freedesktop/ConsoleKit/Manager",
+                                            "org.freedesktop.ConsoleKit.Manager",
+                                            "GetSessionForUnixProcess",
+                                            g_variant_new ("(u)", pid),
+                                            G_VARIANT_TYPE ("(o)"),
+                                            G_DBUS_CALL_FLAGS_NONE,
+                                            -1, /* timeout_msec */
+                                            NULL, /* GCancellable */
+                                            error);
+      if (result == NULL)
         goto out;
-
+      g_variant_get (result, "(&o)", &session_id);
       session = polkit_unix_session_new (session_id);
-
-      g_free (session_id);
+      g_variant_unref (result);
     }
   else
     {
@@ -558,58 +413,48 @@ polkit_backend_session_monitor_get_session_for_subject (PolkitBackendSessionMoni
   return session;
 }
 
-gboolean
-polkit_backend_session_monitor_is_session_local  (PolkitBackendSessionMonitor *monitor,
-                                                  PolkitSubject               *session)
+static gboolean
+get_boolean (PolkitBackendSessionMonitor *monitor,
+             PolkitSubject               *session,
+             const gchar                 *key_name)
 {
-  EggDBusObjectProxy *object_proxy;
-  const gchar *session_id;
-  CkSession *ck_session;
   gboolean ret;
-
-  g_return_val_if_fail (POLKIT_IS_UNIX_SESSION (session), FALSE);
+  gchar *group;
+  GError *error;
 
   ret = FALSE;
 
-  session_id = polkit_unix_session_get_session_id (POLKIT_UNIX_SESSION (session));
-
-  object_proxy = egg_dbus_hash_map_lookup (monitor->session_object_path_to_object_proxy, session_id);
-  if (object_proxy == NULL)
-    goto out;
+  group = g_strdup_printf ("Session %s", polkit_unix_session_get_session_id (POLKIT_UNIX_SESSION (session)));
 
-  ck_session = CK_QUERY_INTERFACE_SESSION (object_proxy);
-
-  ret = ck_session_get_is_local (ck_session);
+  error = NULL;
+  ret = g_key_file_get_boolean (monitor->database, group, key_name, &error);
+  if (error != NULL)
+    {
+      g_printerr ("Error looking %s using " CKDB_PATH " for %s: %s\n",
+                  key_name,
+                  group,
+                  error->message);
+      g_error_free (error);
+      goto out;
+    }
 
  out:
+  g_free (group);
   return ret;
 }
 
-
 gboolean
-polkit_backend_session_monitor_is_session_active (PolkitBackendSessionMonitor *monitor,
+polkit_backend_session_monitor_is_session_local  (PolkitBackendSessionMonitor *monitor,
                                                   PolkitSubject               *session)
 {
-  EggDBusObjectProxy *object_proxy;
-  const gchar *session_id;
-  CkSession *ck_session;
-  gboolean ret;
-
-  g_return_val_if_fail (POLKIT_IS_UNIX_SESSION (session), FALSE);
-
-  ret = FALSE;
-
-  session_id = polkit_unix_session_get_session_id (POLKIT_UNIX_SESSION (session));
-
-  object_proxy = egg_dbus_hash_map_lookup (monitor->session_object_path_to_object_proxy, session_id);
-  if (object_proxy == NULL)
-    goto out;
-
-  ck_session = CK_QUERY_INTERFACE_SESSION (object_proxy);
+  return get_boolean (monitor, session, "is_local");
+}
 
-  ret = ck_session_get_active (ck_session);
 
- out:
-  return ret;
+gboolean
+polkit_backend_session_monitor_is_session_active (PolkitBackendSessionMonitor *monitor,
+                                                  PolkitSubject               *session)
+{
+  return get_boolean (monitor, session, "is_active");
 }
 
commit 3fee22546b76d377c6238943f2f0bcfb00c8f79c
Author: David Zeuthen <davidz at redhat.com>
Date:   Wed Jul 28 12:16:42 2010 -0400

    Port core bits to gdbus
    
    Signed-off-by: David Zeuthen <davidz at redhat.com>

diff --git a/src/examples/cancel.c b/src/examples/cancel.c
index 2c6224c..fd94b0e 100644
--- a/src/examples/cancel.c
+++ b/src/examples/cancel.c
@@ -34,13 +34,23 @@
 
 #include <polkit/polkit.h>
 
+static gboolean
+on_tensec_timeout (gpointer user_data)
+{
+  GMainLoop *loop = user_data;
+  g_print ("Ten seconds has passed. Now exiting.\n");
+  g_main_loop_quit (loop);
+  return FALSE;
+}
+
 static void
 check_authorization_cb (PolkitAuthority *authority,
                         GAsyncResult    *res,
-                        GMainLoop       *loop)
+                        gpointer         user_data)
 {
-  GError *error;
+  GMainLoop *loop = user_data;
   PolkitAuthorizationResult *result;
+  GError *error;
 
   error = NULL;
   result = polkit_authority_check_authorization_finish (authority, res, &error);
@@ -68,7 +78,9 @@ check_authorization_cb (PolkitAuthority *authority,
       g_print ("Authorization result: %s\n", result_str);
     }
 
-  g_main_loop_quit (loop);
+  g_print ("Authorization check has been cancelled and the dialog should now be hidden.\n"
+           "This process will exit in ten seconds.\n");
+  g_timeout_add (10000, on_tensec_timeout, loop);
 }
 
 static gboolean
diff --git a/src/polkit/polkitactiondescription.c b/src/polkit/polkitactiondescription.c
index cc1a8b5..222f7af 100644
--- a/src/polkit/polkitactiondescription.c
+++ b/src/polkit/polkitactiondescription.c
@@ -71,7 +71,8 @@ polkit_action_description_finalize (GObject *object)
 
   action_description = POLKIT_ACTION_DESCRIPTION (object);
 
-  g_object_unref (action_description->real);
+  if (action_description->real != NULL)
+    g_object_unref (action_description->real);
 
   g_strfreev (action_description->annotation_keys);
 
@@ -302,3 +303,88 @@ polkit_action_description_get_annotation_keys (PolkitActionDescription *action_d
  out:
   return (const gchar * const *) action_description->annotation_keys;
 }
+
+PolkitActionDescription *
+polkit_action_description_new_for_gvariant (GVariant *value)
+{
+  PolkitActionDescription *action_description;
+  GVariantIter iter;
+  const gchar *action_id;
+  const gchar *description;
+  const gchar *message;
+  const gchar *vendor_name;
+  const gchar *vendor_url;
+  const gchar *icon_name;
+  PolkitImplicitAuthorization implicit_any;
+  PolkitImplicitAuthorization implicit_inactive;
+  PolkitImplicitAuthorization implicit_active;
+  GVariant *annotations_dict;
+  gchar *a_key;
+  gchar *a_value;
+  EggDBusHashMap *hm;
+
+  action_description = POLKIT_ACTION_DESCRIPTION (g_object_new (POLKIT_TYPE_ACTION_DESCRIPTION, NULL));
+  g_variant_get (value,
+                 "(&s&s&s&s&s&suuu at a{ss})",
+                 &action_id,
+                 &description,
+                 &message,
+                 &vendor_name,
+                 &vendor_url,
+                 &icon_name,
+                 &implicit_any,
+                 &implicit_inactive,
+                 &implicit_active,
+                 &annotations_dict);
+  hm = egg_dbus_hash_map_new (G_TYPE_STRING, g_free, G_TYPE_STRING, g_free);
+  g_variant_iter_init (&iter, annotations_dict);
+  while (g_variant_iter_next (&iter, "{ss}", &a_key, &a_value))
+    egg_dbus_hash_map_insert (hm, a_key, a_value);
+  g_variant_unref (annotations_dict);
+
+  action_description->real = _polkit_action_description_new (action_id, description, message, vendor_name, vendor_url, icon_name, implicit_any, implicit_inactive, implicit_active, hm);
+  g_object_unref (hm);
+
+  return action_description;
+}
+
+static gboolean
+add_annotation (EggDBusHashMap *hash_map,
+                gpointer        key,
+                gpointer        value,
+                gpointer        user_data)
+{
+  GVariantBuilder *builder = user_data;
+
+  g_variant_builder_add (builder, "{ss}", key, value);
+
+  return FALSE;
+}
+
+GVariant *
+polkit_action_description_to_gvariant (PolkitActionDescription *action_description)
+{
+  GVariant *value;
+  GVariantBuilder builder;
+
+  g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{ss}"));
+
+  egg_dbus_hash_map_foreach (_polkit_action_description_get_annotations (action_description->real),
+                             add_annotation,
+                             &builder);
+
+  /* TODO: note 'foo ? : ""' is a gcc specific extension (it's a short-hand for 'foo ? foo : ""') */
+  value = g_variant_new ("(ssssssuuua{ss})",
+                         _polkit_action_description_get_action_id (action_description->real) ? : "",
+                         _polkit_action_description_get_description (action_description->real) ? : "",
+                         _polkit_action_description_get_message (action_description->real) ? : "",
+                         _polkit_action_description_get_vendor_name (action_description->real) ? : "",
+                         _polkit_action_description_get_vendor_url (action_description->real) ? : "",
+                         _polkit_action_description_get_icon_name (action_description->real) ? : "",
+                         _polkit_action_description_get_implicit_any (action_description->real),
+                         _polkit_action_description_get_implicit_inactive (action_description->real),
+                         _polkit_action_description_get_implicit_active (action_description->real),
+                         &builder);
+
+  return value;
+}
diff --git a/src/polkit/polkitauthority.c b/src/polkit/polkitauthority.c
index f29be09..11ebed8 100644
--- a/src/polkit/polkitauthority.c
+++ b/src/polkit/polkitauthority.c
@@ -59,13 +59,10 @@ struct _PolkitAuthority
   /*< private >*/
   GObject parent_instance;
 
-  EggDBusConnection *system_bus;
-  EggDBusObjectProxy *authority_object_proxy;
-
-  _PolkitAuthority *real;
   gchar *name;
   gchar *version;
 
+  GDBusProxy *proxy;
   guint cancellation_id_counter;
 };
 
@@ -75,7 +72,7 @@ struct _PolkitAuthorityClass
 
 };
 
-/* TODO: locking */
+/* TODO: fix up locking */
 
 static PolkitAuthority *the_authority = NULL;
 
@@ -98,44 +95,56 @@ static guint signals[LAST_SIGNAL] = {0};
 G_DEFINE_TYPE (PolkitAuthority, polkit_authority, G_TYPE_OBJECT);
 
 static void
-real_authority_changed (_PolkitAuthority *real_authority,
-                        gpointer user_data)
+on_proxy_signal (GDBusProxy   *proxy,
+                 const gchar  *sender_name,
+                 const gchar  *signal_name,
+                 GVariant     *parameters,
+                 gpointer      user_data)
 {
   PolkitAuthority *authority = POLKIT_AUTHORITY (user_data);
-
-  g_signal_emit_by_name (authority, "changed");
+  if (g_strcmp0 (signal_name, "Changed") == 0)
+    {
+      g_signal_emit_by_name (authority, "changed");
+    }
 }
 
 static void
 polkit_authority_init (PolkitAuthority *authority)
 {
-  authority->system_bus = egg_dbus_connection_get_for_bus (EGG_DBUS_BUS_TYPE_SYSTEM);
-
-  authority->authority_object_proxy = egg_dbus_connection_get_object_proxy (authority->system_bus,
-                                                                            "org.freedesktop.PolicyKit1",
-                                                                            "/org/freedesktop/PolicyKit1/Authority");
-
-  authority->real = _POLKIT_QUERY_INTERFACE_AUTHORITY (authority->authority_object_proxy);
+  GError *error;
 
-  g_signal_connect (authority->real,
-                    "changed",
-                    (GCallback) real_authority_changed,
+  /* TODO: do this instead in GInitable and GAsyncInitable implementations */
+  error = NULL;
+  authority->proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
+                                                    G_DBUS_PROXY_FLAGS_NONE,
+                                                    NULL, /* GDBusInterfaceInfo* */
+                                                    "org.freedesktop.PolicyKit1",            /* name */
+                                                    "/org/freedesktop/PolicyKit1/Authority", /* path */
+                                                    "org.freedesktop.PolicyKit1.Authority",  /* interface */
+                                                    NULL, /* GCancellable */
+                                                    &error);
+  if (authority->proxy == NULL)
+    {
+      g_warning ("Error initializing authority: %s", error->message);
+      g_error_free (error);
+    }
+  g_signal_connect (authority->proxy,
+                    "g-signal",
+                    G_CALLBACK (on_proxy_signal),
                     authority);
 }
 
 static void
 polkit_authority_finalize (GObject *object)
 {
-  PolkitAuthority *authority;
+  PolkitAuthority *authority = POLKIT_AUTHORITY (object);
 
-  authority = POLKIT_AUTHORITY (object);
+  the_authority = NULL;
 
-  g_object_unref (authority->authority_object_proxy);
-  g_object_unref (authority->system_bus);
   g_free (authority->name);
   g_free (authority->version);
-
-  the_authority = NULL;
+  if (authority->proxy != NULL)
+    g_object_unref (authority->proxy);
 
   if (G_OBJECT_CLASS (polkit_authority_parent_class)->finalize != NULL)
     G_OBJECT_CLASS (polkit_authority_parent_class)->finalize (object);
@@ -253,10 +262,11 @@ polkit_authority_class_init (PolkitAuthorityClass *klass)
 PolkitAuthority *
 polkit_authority_get (void)
 {
-  if (the_authority != NULL) {
-    g_object_ref (the_authority);
-    goto out;
-  }
+  if (the_authority != NULL)
+    {
+      g_object_ref (the_authority);
+      goto out;
+    }
 
   the_authority = POLKIT_AUTHORITY (g_object_new (POLKIT_TYPE_AUTHORITY, NULL));
 
@@ -264,53 +274,54 @@ polkit_authority_get (void)
   return the_authority;
 }
 
-static void
-generic_cb (GObject      *source_obj,
-            GAsyncResult *res,
-            gpointer      user_data)
+/* ---------------------------------------------------------------------------------------------------- */
+
+typedef struct
 {
-  GAsyncResult **target_res = user_data;
+  GAsyncResult *res;
+  GMainContext *context;
+  GMainLoop *loop;
+} CallSyncData;
 
-  *target_res = g_object_ref (res);
+static CallSyncData *
+call_sync_new (void)
+{
+  CallSyncData *data;
+  data = g_new0 (CallSyncData, 1);
+  data->context = g_main_context_new ();
+  data->loop = g_main_loop_new (data->context, FALSE);
+  g_main_context_push_thread_default (data->context);
+  return data;
 }
 
 static void
-generic_async_cb (GObject      *source_obj,
-                  GAsyncResult *res,
-                  gpointer      user_data)
+call_sync_cb (GObject      *source_object,
+              GAsyncResult *res,
+              gpointer      user_data)
 {
-  GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (user_data);
-
-  g_simple_async_result_set_op_res_gpointer (simple, g_object_ref (res), g_object_unref);
-  g_simple_async_result_complete (simple);
+  CallSyncData *data = user_data;
+  data->res = g_object_ref (res);
+  g_main_loop_quit (data->loop);
 }
 
-/* ---------------------------------------------------------------------------------------------------- */
-
-static guint
-polkit_authority_enumerate_actions_async (PolkitAuthority     *authority,
-                                          GCancellable        *cancellable,
-                                          GAsyncReadyCallback  callback,
-                                          gpointer             user_data)
+static void
+call_sync_block (CallSyncData *data)
 {
-  guint call_id;
-  GSimpleAsyncResult *simple;
-
-  simple = g_simple_async_result_new (G_OBJECT (authority),
-                                      callback,
-                                      user_data,
-                                      polkit_authority_enumerate_actions_async);
-
-  call_id = _polkit_authority_enumerate_actions (authority->real,
-                                                 EGG_DBUS_CALL_FLAGS_NONE,
-                                                 "", /* TODO: use current locale */
-                                                 cancellable,
-                                                 generic_async_cb,
-                                                 simple);
+  g_main_loop_run (data->loop);
+}
 
-  return call_id;
+static void
+call_sync_free (CallSyncData *data)
+{
+  g_main_context_pop_thread_default (data->context);
+  g_main_context_unref (data->context);
+  g_main_loop_unref (data->loop);
+  g_object_unref (data->res);
+  g_free (data);
 }
 
+/* ---------------------------------------------------------------------------------------------------- */
+
 /**
  * polkit_authority_enumerate_actions:
  * @authority: A #PolkitAuthority.
@@ -330,7 +341,15 @@ polkit_authority_enumerate_actions (PolkitAuthority     *authority,
                                     GAsyncReadyCallback  callback,
                                     gpointer             user_data)
 {
-  polkit_authority_enumerate_actions_async (authority, cancellable, callback, user_data);
+  g_dbus_proxy_call (authority->proxy,
+                     "EnumerateActions",
+                     g_variant_new ("(s)",
+                                    ""), /* TODO: use system locale */
+                     G_DBUS_CALL_FLAGS_NONE,
+                     -1,
+                     cancellable,
+                     callback,
+                     user_data);
 }
 
 /**
@@ -349,44 +368,34 @@ polkit_authority_enumerate_actions_finish (PolkitAuthority *authority,
                                            GAsyncResult    *res,
                                            GError         **error)
 {
-  EggDBusArraySeq *array_seq;
-  GList *result;
-  guint n;
-  GSimpleAsyncResult *simple;
-  GAsyncResult *real_res;
+  GList *ret;
+  GVariant *value;
+  GVariantIter iter;
+  GVariant *child;
+  GVariant *array;
 
-  simple = G_SIMPLE_ASYNC_RESULT (res);
-  real_res = G_ASYNC_RESULT (g_simple_async_result_get_op_res_gpointer (simple));
+  ret = NULL;
 
-  g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == polkit_authority_enumerate_actions_async);
-
-  result = NULL;
-
-  if (!_polkit_authority_enumerate_actions_finish (authority->real,
-                                                   &array_seq,
-                                                   real_res,
-                                                   error))
+  value = g_dbus_proxy_call_finish (authority->proxy, res, error);
+  if (value == NULL)
     goto out;
 
-  for (n = 0; n < array_seq->size; n++)
+  array = g_variant_get_child_value (value, 0);
+  g_variant_iter_init (&iter, array);
+  while ((child = g_variant_iter_next_value (&iter)) != NULL)
     {
-      _PolkitActionDescription *real_ad;
-
-      real_ad = array_seq->data.v_ptr[n];
-
-      result = g_list_prepend (result, polkit_action_description_new_for_real (real_ad));
+      ret = g_list_prepend (ret, polkit_action_description_new_for_gvariant (child));
+      g_variant_ref_sink (child);
+      g_variant_unref (child);
     }
-
-  result = g_list_reverse (result);
-
-  g_object_unref (array_seq);
+  ret = g_list_reverse (ret);
+  g_variant_unref (array);
+  g_variant_unref (value);
 
  out:
-  g_object_unref (real_res);
-  return result;
+  return ret;
 }
 
-
 /**
  * polkit_authority_enumerate_actions_sync:
  * @authority: A #PolkitAuthority.
@@ -403,85 +412,95 @@ polkit_authority_enumerate_actions_sync (PolkitAuthority *authority,
                                          GCancellable    *cancellable,
                                          GError         **error)
 {
-  guint call_id;
-  GAsyncResult *res;
-  GList *result;
-
-  call_id = polkit_authority_enumerate_actions_async (authority, cancellable, generic_cb, &res);
-
-  egg_dbus_connection_pending_call_block (authority->system_bus, call_id);
-
-  result = polkit_authority_enumerate_actions_finish (authority, res, error);
+  GList *ret;
+  CallSyncData *data;
 
-  g_object_unref (res);
+  data = call_sync_new ();
+  polkit_authority_enumerate_actions (authority, cancellable, call_sync_cb, data);
+  call_sync_block (data);
+  ret = polkit_authority_enumerate_actions_finish (authority, data->res, error);
+  call_sync_free (data);
 
-  return result;
+  return ret;
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
 
-static guint
-polkit_authority_check_authorization_async (PolkitAuthority               *authority,
-                                            PolkitSubject                 *subject,
-                                            const gchar                   *action_id,
-                                            PolkitDetails                 *details,
-                                            PolkitCheckAuthorizationFlags  flags,
-                                            GCancellable                  *cancellable,
-                                            GAsyncReadyCallback            callback,
-                                            gpointer                       user_data)
+typedef struct
 {
-  _PolkitSubject *real_subject;
-  guint call_id;
+  PolkitAuthority *authority;
   GSimpleAsyncResult *simple;
   gchar *cancellation_id;
-  EggDBusHashMap *real_details;
+} CheckAuthData;
 
-  real_subject = polkit_subject_get_real (subject);
-
-  simple = g_simple_async_result_new (G_OBJECT (authority),
-                                      callback,
-                                      user_data,
-                                      polkit_authority_check_authorization_async);
+static void
+cancel_check_authorization_cb (GDBusProxy    *proxy,
+                               GAsyncResult  *res,
+                               gpointer       user_data)
+{
+  GVariant *value;
+  GError *error;
 
-  cancellation_id = NULL;
-  if (cancellable != NULL)
+  error = NULL;
+  value = g_dbus_proxy_call_finish (proxy, res, &error);
+  if (value == NULL)
     {
-      cancellation_id = g_strdup_printf ("cancellation-id-%d", authority->cancellation_id_counter++);
-      g_object_set_data_full (G_OBJECT (simple), "polkit-1-cancellation-id", cancellation_id, g_free);
+      g_warning ("Error cancelling authorization check: %s", error->message);
+      g_error_free (error);
     }
-
-  real_details = egg_dbus_hash_map_new (G_TYPE_STRING, NULL,
-                                        G_TYPE_STRING, NULL);
-  if (details != NULL)
+  else
     {
-      GHashTable *hash;
-      GHashTableIter iter;
-      const gchar *key;
-      const gchar *value;
+      g_variant_unref (value);
+    }
+}
+
+static void
+check_authorization_cb (GDBusProxy    *proxy,
+                        GAsyncResult  *res,
+                        gpointer       user_data)
+{
+  CheckAuthData *data = user_data;
+  GVariant *value;
+  GError *error;
 
-      hash = polkit_details_get_hash (details);
-      if (hash != NULL)
+  error = NULL;
+  value = g_dbus_proxy_call_finish (proxy, res, &error);
+  if (value == NULL)
+    {
+      if (data->cancellation_id != NULL &&
+          (!g_dbus_error_is_remote_error (error) &&
+           error->domain == G_IO_ERROR &&
+           error->code == G_IO_ERROR_CANCELLED))
         {
-          g_hash_table_iter_init (&iter, hash);
-          while (g_hash_table_iter_next (&iter, (gpointer) &key, (gpointer) &value))
-            egg_dbus_hash_map_insert (real_details, key, value);
+          g_dbus_proxy_call (data->authority->proxy,
+                             "CancelCheckAuthorization",
+                             g_variant_new ("(s)", data->cancellation_id),
+                             G_DBUS_CALL_FLAGS_NONE,
+                             -1,
+                             NULL, /* GCancellable */
+                             (GAsyncReadyCallback) cancel_check_authorization_cb,
+                             NULL);
         }
+      g_simple_async_result_set_from_error (data->simple, error);
+      g_error_free (error);
+    }
+  else
+    {
+      GVariant *result_value;
+      PolkitAuthorizationResult *result;
+      result_value = g_variant_get_child_value (value, 0);
+      result = polkit_authorization_result_new_for_gvariant (result_value);
+      g_variant_unref (result_value);
+      g_variant_unref (value);
+      g_simple_async_result_set_op_res_gpointer (data->simple, result, g_object_unref);
     }
 
-  call_id = _polkit_authority_check_authorization (authority->real,
-                                                   EGG_DBUS_CALL_FLAGS_TIMEOUT_NONE,
-                                                   real_subject,
-                                                   action_id,
-                                                   real_details,
-                                                   flags,
-                                                   cancellation_id,
-                                                   cancellable,
-                                                   generic_async_cb,
-                                                   simple);
-
-  g_object_unref (real_subject);
+  g_simple_async_result_complete (data->simple);
 
-  return call_id;
+  g_object_unref (data->authority);
+  g_object_unref (data->simple);
+  g_free (data->cancellation_id);
+  g_free (data);
 }
 
 /**
@@ -518,31 +537,39 @@ polkit_authority_check_authorization (PolkitAuthority               *authority,
                                       GAsyncReadyCallback            callback,
                                       gpointer                       user_data)
 {
-  polkit_authority_check_authorization_async (authority,
-                                              subject,
-                                              action_id,
-                                              details,
-                                              flags,
-                                              cancellable,
-                                              callback,
-                                              user_data);
-}
-
-static void
-authorization_check_cancelled_cb (GObject      *source_object,
-                                  GAsyncResult *res,
-                                  gpointer      user_data)
-{
-  GError *error;
-
-  error = NULL;
-  if (!_polkit_authority_cancel_check_authorization_finish (_POLKIT_AUTHORITY (source_object),
-                                                            res,
-                                                            &error))
-    {
-      g_warning ("Error cancelling authorization check: %s", error->message);
-      g_error_free (error);
-    }
+  GVariant *subject_value;
+  GVariant *details_value;
+  CheckAuthData *data;
+
+  subject_value = polkit_subject_to_gvariant (subject);
+  details_value = polkit_details_to_gvariant (details);
+  g_variant_ref_sink (subject_value);
+  g_variant_ref_sink (details_value);
+
+  data = g_new0 (CheckAuthData, 1);
+  data->authority = g_object_ref (authority);
+  data->simple = g_simple_async_result_new (G_OBJECT (authority),
+                                            callback,
+                                            user_data,
+                                            polkit_authority_check_authorization);
+  if (cancellable != NULL)
+    data->cancellation_id = g_strdup_printf ("cancellation-id-%d", authority->cancellation_id_counter++);
+
+  g_dbus_proxy_call (authority->proxy,
+                     "CheckAuthorization",
+                     g_variant_new ("(@(sa{sv})s at a{ss}us)",
+                                    subject_value,
+                                    action_id,
+                                    details_value,
+                                    flags,
+                                    data->cancellation_id != NULL ? data->cancellation_id : ""),
+                     G_DBUS_CALL_FLAGS_NONE,
+                     G_MAXINT, /* no timeout */
+                     cancellable,
+                     (GAsyncReadyCallback) check_authorization_cb,
+                     data);
+  g_variant_unref (subject_value);
+  g_variant_unref (details_value);
 }
 
 /**
@@ -560,66 +587,18 @@ polkit_authority_check_authorization_finish (PolkitAuthority          *authority
                                              GAsyncResult             *res,
                                              GError                  **error)
 {
-  PolkitAuthorizationResult *result;
-  _PolkitAuthorizationResult *real_result;
-  GSimpleAsyncResult *simple;
-  GAsyncResult *real_res;
-  GError *local_error;
+  GSimpleAsyncResult *simple = G_SIMPLE_ASYNC_RESULT (res);
+  PolkitAuthorizationResult *ret;
 
-  simple = G_SIMPLE_ASYNC_RESULT (res);
-  real_res = G_ASYNC_RESULT (g_simple_async_result_get_op_res_gpointer (simple));
+  ret = NULL;
 
-  g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == polkit_authority_check_authorization_async);
-
-  result = NULL;
-  real_result = NULL;
-
-  local_error = NULL;
-  _polkit_authority_check_authorization_finish (authority->real,
-                                                &real_result,
-                                                real_res,
-                                                &local_error);
-
-  if (local_error != NULL)
-    {
-      if (local_error->domain == EGG_DBUS_ERROR && local_error->code == EGG_DBUS_ERROR_CANCELLED)
-        {
-          const gchar *cancellation_id;
-
-          /* if the operation was cancelled locally, make sure to tell the daemon so the authentication
-           * dialog etc. can be removed
-           */
-          cancellation_id = g_object_get_data (G_OBJECT (simple), "polkit-1-cancellation-id");
-          if (cancellation_id != NULL)
-            {
-              _polkit_authority_cancel_check_authorization (authority->real,
-                                                            EGG_DBUS_CALL_FLAGS_NONE,
-                                                            cancellation_id,
-                                                            NULL,
-                                                            authorization_check_cancelled_cb,
-                                                            NULL);
-            }
-
-          g_set_error (error,
-                       POLKIT_ERROR,
-                       POLKIT_ERROR_CANCELLED,
-                       "The operation was cancelled");
-          g_error_free (local_error);
-        }
-      else
-        {
-          g_propagate_error (error, local_error);
-        }
-    }
-  g_object_unref (real_res);
+  if (g_simple_async_result_propagate_error (simple, error))
+    goto out;
 
-  if (real_result != NULL)
-    {
-      result = polkit_authorization_result_new_for_real (real_result);
-      g_object_unref (real_result);
-    }
+  ret = g_object_ref (g_simple_async_result_get_op_res_gpointer (simple));
 
-  return result;
+ out:
+  return ret;
 }
 
 /**
@@ -651,63 +630,20 @@ polkit_authority_check_authorization_sync (PolkitAuthority               *author
                                            GCancellable                  *cancellable,
                                            GError                       **error)
 {
-  guint call_id;
-  GAsyncResult *res;
-  PolkitAuthorizationResult *result;
-
-  call_id = polkit_authority_check_authorization_async (authority,
-                                                        subject,
-                                                        action_id,
-                                                        details,
-                                                        flags,
-                                                        cancellable,
-                                                        generic_cb,
-                                                        &res);
+  PolkitAuthorizationResult *ret;
+  CallSyncData *data;
 
-  egg_dbus_connection_pending_call_block (authority->system_bus, call_id);
+  data = call_sync_new ();
+  polkit_authority_check_authorization (authority, subject, action_id, details, flags, cancellable, call_sync_cb, data);
+  call_sync_block (data);
+  ret = polkit_authority_check_authorization_finish (authority, data->res, error);
+  call_sync_free (data);
 
-  result = polkit_authority_check_authorization_finish (authority, res, error);
-
-  g_object_unref (res);
-
-  return result;
+  return ret;
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
 
-static guint
-polkit_authority_register_authentication_agent_async (PolkitAuthority      *authority,
-                                                      PolkitSubject        *subject,
-                                                      const gchar          *locale,
-                                                      const gchar          *object_path,
-                                                      GCancellable         *cancellable,
-                                                      GAsyncReadyCallback   callback,
-                                                      gpointer              user_data)
-{
-  guint call_id;
-  GSimpleAsyncResult *simple;
-  _PolkitSubject *real_subject;
-
-  simple = g_simple_async_result_new (G_OBJECT (authority),
-                                      callback,
-                                      user_data,
-                                      polkit_authority_register_authentication_agent_async);
-
-  real_subject = polkit_subject_get_real (subject);
-
-  call_id = _polkit_authority_register_authentication_agent (authority->real,
-                                                             EGG_DBUS_CALL_FLAGS_NONE,
-                                                             real_subject,
-                                                             locale,
-                                                             object_path,
-                                                             cancellable,
-                                                             generic_async_cb,
-                                                             simple);
-  g_object_unref (real_subject);
-
-  return call_id;
-}
-
 /**
  * polkit_authority_register_authentication_agent:
  * @authority: A #PolkitAuthority.
@@ -733,13 +669,21 @@ polkit_authority_register_authentication_agent (PolkitAuthority      *authority,
                                                 GAsyncReadyCallback   callback,
                                                 gpointer              user_data)
 {
-  polkit_authority_register_authentication_agent_async (authority,
-                                                        subject,
-                                                        locale,
-                                                        object_path,
-                                                        cancellable,
-                                                        callback,
-                                                        user_data);
+  GVariant *subject_value;
+  subject_value = polkit_subject_to_gvariant (subject);
+  g_variant_ref_sink (subject_value);
+  g_dbus_proxy_call (authority->proxy,
+                     "RegisterAuthenticationAgent",
+                     g_variant_new ("(@(sa{sv})ss)",
+                                    subject_value,
+                                    locale,
+                                    object_path),
+                     G_DBUS_CALL_FLAGS_NONE,
+                     -1,
+                     cancellable,
+                     callback,
+                     user_data);
+  g_variant_unref (subject_value);
 }
 
 /**
@@ -757,24 +701,18 @@ polkit_authority_register_authentication_agent_finish (PolkitAuthority *authorit
                                                        GAsyncResult    *res,
                                                        GError         **error)
 {
-  GSimpleAsyncResult *simple;
-  GAsyncResult *real_res;
   gboolean ret;
+  GVariant *value;
 
-  simple = G_SIMPLE_ASYNC_RESULT (res);
-  real_res = G_ASYNC_RESULT (g_simple_async_result_get_op_res_gpointer (simple));
+  ret = FALSE;
 
-  g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == polkit_authority_register_authentication_agent_async);
-
-  ret = _polkit_authority_register_authentication_agent_finish (authority->real,
-                                                                real_res,
-                                                                error);
-
-  if (!ret)
+  value = g_dbus_proxy_call_finish (authority->proxy, res, error);
+  if (value == NULL)
     goto out;
+  ret = TRUE;
+  g_variant_unref (value);
 
  out:
-  g_object_unref (real_res);
   return ret;
 }
 
@@ -800,66 +738,26 @@ polkit_authority_register_authentication_agent_sync (PolkitAuthority     *author
                                                      GCancellable        *cancellable,
                                                      GError             **error)
 {
-  guint call_id;
-  GAsyncResult *res;
   gboolean ret;
+  CallSyncData *data;
 
-  call_id = polkit_authority_register_authentication_agent_async (authority,
-                                                                  subject,
-                                                                  locale,
-                                                                  object_path,
-                                                                  cancellable,
-                                                                  generic_cb,
-                                                                  &res);
-
-  egg_dbus_connection_pending_call_block (authority->system_bus, call_id);
-
-  ret = polkit_authority_register_authentication_agent_finish (authority, res, error);
-
-  g_object_unref (res);
+  data = call_sync_new ();
+  polkit_authority_register_authentication_agent (authority, subject, locale, object_path, cancellable, call_sync_cb, data);
+  call_sync_block (data);
+  ret = polkit_authority_register_authentication_agent_finish (authority, data->res, error);
+  call_sync_free (data);
 
   return ret;
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
 
-static guint
-polkit_authority_unregister_authentication_agent_async (PolkitAuthority      *authority,
-                                                        PolkitSubject        *subject,
-                                                        const gchar          *object_path,
-                                                        GCancellable         *cancellable,
-                                                        GAsyncReadyCallback   callback,
-                                                        gpointer              user_data)
-{
-  guint call_id;
-  GSimpleAsyncResult *simple;
-  _PolkitSubject *real_subject;
-
-  simple = g_simple_async_result_new (G_OBJECT (authority),
-                                      callback,
-                                      user_data,
-                                      polkit_authority_unregister_authentication_agent_async);
-
-  real_subject = polkit_subject_get_real (subject);
-
-  call_id = _polkit_authority_unregister_authentication_agent (authority->real,
-                                                               EGG_DBUS_CALL_FLAGS_NONE,
-                                                               real_subject,
-                                                               object_path,
-                                                               cancellable,
-                                                               generic_async_cb,
-                                                               simple);
-
-  g_object_unref (real_subject);
-
-  return call_id;
-}
-
 /**
  * polkit_authority_unregister_authentication_agent:
  * @authority: A #PolkitAuthority.
- * @subject: The #PolkitSubject passed when registering the agent.
- * @object_path: The object path that the authentication agent is registered at.
+ * @subject: The subject the authentication agent is for, typically a #PolkitUnixSession object.
+ * @locale: The locale of the authentication agent.
+ * @object_path: The object path for the authentication agent.
  * @cancellable: A #GCancellable or %NULL.
  * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
  * @user_data: The data to pass to @callback.
@@ -878,12 +776,20 @@ polkit_authority_unregister_authentication_agent (PolkitAuthority      *authorit
                                                   GAsyncReadyCallback   callback,
                                                   gpointer              user_data)
 {
-  polkit_authority_unregister_authentication_agent_async (authority,
-                                                          subject,
-                                                          object_path,
-                                                          cancellable,
-                                                          callback,
-                                                          user_data);
+  GVariant *subject_value;
+  subject_value = polkit_subject_to_gvariant (subject);
+  g_variant_ref_sink (subject_value);
+  g_dbus_proxy_call (authority->proxy,
+                     "UnregisterAuthenticationAgent",
+                     g_variant_new ("(@(sa{sv})s)",
+                                    subject_value,
+                                    object_path),
+                     G_DBUS_CALL_FLAGS_NONE,
+                     -1,
+                     cancellable,
+                     callback,
+                     user_data);
+  g_variant_unref (subject_value);
 }
 
 /**
@@ -901,32 +807,28 @@ polkit_authority_unregister_authentication_agent_finish (PolkitAuthority *author
                                                          GAsyncResult    *res,
                                                          GError         **error)
 {
-  GSimpleAsyncResult *simple;
-  GAsyncResult *real_res;
   gboolean ret;
+  GVariant *value;
 
-  simple = G_SIMPLE_ASYNC_RESULT (res);
-  real_res = G_ASYNC_RESULT (g_simple_async_result_get_op_res_gpointer (simple));
+  ret = FALSE;
 
-  g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == polkit_authority_unregister_authentication_agent_async);
-
-  ret = _polkit_authority_unregister_authentication_agent_finish (authority->real,
-                                                                real_res,
-                                                                error);
-
-  if (!ret)
+  value = g_dbus_proxy_call_finish (authority->proxy, res, error);
+  if (value == NULL)
     goto out;
+  ret = TRUE;
+  g_variant_unref (value);
 
  out:
-  g_object_unref (real_res);
   return ret;
 }
 
+
 /**
  * polkit_authority_unregister_authentication_agent_sync:
  * @authority: A #PolkitAuthority.
- * @subject: The #PolkitSubject passed when registering the agent.
- * @object_path: The object path that the authentication agent is registered at.
+ * @subject: The subject the authentication agent is for, typically a #PolkitUnixSession object.
+ * @locale: The locale of the authentication agent.
+ * @object_path: The object path for the authentication agent.
  * @cancellable: A #GCancellable or %NULL.
  * @error: Return location for error or %NULL.
  *
@@ -941,60 +843,20 @@ polkit_authority_unregister_authentication_agent_sync (PolkitAuthority     *auth
                                                        GCancellable        *cancellable,
                                                        GError             **error)
 {
-  guint call_id;
-  GAsyncResult *res;
   gboolean ret;
+  CallSyncData *data;
 
-  call_id = polkit_authority_unregister_authentication_agent_async (authority,
-                                                                    subject,
-                                                                    object_path,
-                                                                    cancellable,
-                                                                    generic_cb,
-                                                                    &res);
-
-  egg_dbus_connection_pending_call_block (authority->system_bus, call_id);
-
-  ret = polkit_authority_unregister_authentication_agent_finish (authority, res, error);
-
-  g_object_unref (res);
+  data = call_sync_new ();
+  polkit_authority_unregister_authentication_agent (authority, subject, object_path, cancellable, call_sync_cb, data);
+  call_sync_block (data);
+  ret = polkit_authority_unregister_authentication_agent_finish (authority, data->res, error);
+  call_sync_free (data);
 
   return ret;
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
 
-static guint
-polkit_authority_authentication_agent_response_async (PolkitAuthority      *authority,
-                                                      const gchar          *cookie,
-                                                      PolkitIdentity       *identity,
-                                                      GCancellable         *cancellable,
-                                                      GAsyncReadyCallback   callback,
-                                                      gpointer              user_data)
-{
-  guint call_id;
-  GSimpleAsyncResult *simple;
-  _PolkitIdentity *real_identity;
-
-  simple = g_simple_async_result_new (G_OBJECT (authority),
-                                      callback,
-                                      user_data,
-                                      polkit_authority_authentication_agent_response_async);
-
-  real_identity = polkit_identity_get_real (identity);
-
-  call_id = _polkit_authority_authentication_agent_response (authority->real,
-                                                             EGG_DBUS_CALL_FLAGS_NONE,
-                                                             cookie,
-                                                             real_identity,
-                                                             cancellable,
-                                                             generic_async_cb,
-                                                             simple);
-
-  g_object_unref (real_identity);
-
-  return call_id;
-}
-
 /**
  * polkit_authority_authentication_agent_response:
  * @authority: A #PolkitAuthority.
@@ -1022,12 +884,20 @@ polkit_authority_authentication_agent_response (PolkitAuthority      *authority,
                                                 GAsyncReadyCallback   callback,
                                                 gpointer              user_data)
 {
-  polkit_authority_authentication_agent_response_async (authority,
-                                                        cookie,
-                                                        identity,
-                                                        cancellable,
-                                                        callback,
-                                                        user_data);
+  GVariant *identity_value;
+  identity_value = polkit_identity_to_gvariant (identity);
+  g_variant_ref_sink (identity_value);
+  g_dbus_proxy_call (authority->proxy,
+                     "AuthenticationAgentResponse",
+                     g_variant_new ("(s@(sa{sv}))",
+                                    cookie,
+                                    identity_value),
+                     G_DBUS_CALL_FLAGS_NONE,
+                     -1,
+                     cancellable,
+                     callback,
+                     user_data);
+  g_variant_unref (identity_value);
 }
 
 /**
@@ -1045,24 +915,18 @@ polkit_authority_authentication_agent_response_finish (PolkitAuthority *authorit
                                                        GAsyncResult    *res,
                                                        GError         **error)
 {
-  GSimpleAsyncResult *simple;
-  GAsyncResult *real_res;
   gboolean ret;
+  GVariant *value;
 
-  simple = G_SIMPLE_ASYNC_RESULT (res);
-  real_res = G_ASYNC_RESULT (g_simple_async_result_get_op_res_gpointer (simple));
+  ret = FALSE;
 
-  g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == polkit_authority_authentication_agent_response_async);
-
-  ret = _polkit_authority_authentication_agent_response_finish (authority->real,
-                                                                real_res,
-                                                                error);
-
-  if (!ret)
+  value = g_dbus_proxy_call_finish (authority->proxy, res, error);
+  if (value == NULL)
     goto out;
+  ret = TRUE;
+  g_variant_unref (value);
 
  out:
-  g_object_unref (real_res);
   return ret;
 }
 
@@ -1088,58 +952,20 @@ polkit_authority_authentication_agent_response_sync (PolkitAuthority     *author
                                                      GCancellable        *cancellable,
                                                      GError             **error)
 {
-  guint call_id;
-  GAsyncResult *res;
   gboolean ret;
+  CallSyncData *data;
 
-  call_id = polkit_authority_authentication_agent_response_async (authority,
-                                                                  cookie,
-                                                                  identity,
-                                                                  cancellable,
-                                                                  generic_cb,
-                                                                  &res);
-
-  egg_dbus_connection_pending_call_block (authority->system_bus, call_id);
-
-  ret = polkit_authority_authentication_agent_response_finish (authority, res, error);
-
-  g_object_unref (res);
+  data = call_sync_new ();
+  polkit_authority_authentication_agent_response (authority, cookie, identity, cancellable, call_sync_cb, data);
+  call_sync_block (data);
+  ret = polkit_authority_authentication_agent_response_finish (authority, data->res, error);
+  call_sync_free (data);
 
   return ret;
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
 
-static guint
-polkit_authority_enumerate_temporary_authorizations_async (PolkitAuthority     *authority,
-                                                           PolkitSubject       *subject,
-                                                           GCancellable        *cancellable,
-                                                           GAsyncReadyCallback  callback,
-                                                           gpointer             user_data)
-{
-  guint call_id;
-  GSimpleAsyncResult *simple;
-  _PolkitSubject *real_subject;
-
-  simple = g_simple_async_result_new (G_OBJECT (authority),
-                                      callback,
-                                      user_data,
-                                      polkit_authority_enumerate_temporary_authorizations_async);
-
-  real_subject = polkit_subject_get_real (subject);
-
-  call_id = _polkit_authority_enumerate_temporary_authorizations (authority->real,
-                                                                  EGG_DBUS_CALL_FLAGS_NONE,
-                                                                  real_subject,
-                                                                  cancellable,
-                                                                  generic_async_cb,
-                                                                  simple);
-
-  g_object_unref (real_subject);
-
-  return call_id;
-}
-
 /**
  * polkit_authority_enumerate_temporary_authorizations:
  * @authority: A #PolkitAuthority.
@@ -1161,7 +987,19 @@ polkit_authority_enumerate_temporary_authorizations (PolkitAuthority     *author
                                                      GAsyncReadyCallback  callback,
                                                      gpointer             user_data)
 {
-  polkit_authority_enumerate_temporary_authorizations_async (authority, subject, cancellable, callback, user_data);
+  GVariant *subject_value;
+  subject_value = polkit_subject_to_gvariant (subject);
+  g_variant_ref_sink (subject_value);
+  g_dbus_proxy_call (authority->proxy,
+                     "EnumerateTemporaryAuthorizations",
+                     g_variant_new ("(@(sa{sv}))",
+                                    subject_value),
+                     G_DBUS_CALL_FLAGS_NONE,
+                     -1,
+                     cancellable,
+                     callback,
+                     user_data);
+  g_variant_unref (subject_value);
 }
 
 /**
@@ -1180,41 +1018,31 @@ polkit_authority_enumerate_temporary_authorizations_finish (PolkitAuthority *aut
                                                             GAsyncResult    *res,
                                                             GError         **error)
 {
-  EggDBusArraySeq *array_seq;
-  GList *result;
-  guint n;
-  GSimpleAsyncResult *simple;
-  GAsyncResult *real_res;
+  GList *ret;
+  GVariant *value;
+  GVariantIter iter;
+  GVariant *child;
+  GVariant *array;
 
-  simple = G_SIMPLE_ASYNC_RESULT (res);
-  real_res = G_ASYNC_RESULT (g_simple_async_result_get_op_res_gpointer (simple));
+  ret = NULL;
 
-  g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == polkit_authority_enumerate_temporary_authorizations_async);
-
-  result = NULL;
-
-  if (!_polkit_authority_enumerate_temporary_authorizations_finish (authority->real,
-                                                                    &array_seq,
-                                                                    real_res,
-                                                                    error))
+  value = g_dbus_proxy_call_finish (authority->proxy, res, error);
+  if (value == NULL)
     goto out;
 
-  for (n = 0; n < array_seq->size; n++)
+  array = g_variant_get_child_value (value, 0);
+  g_variant_iter_init (&iter, array);
+  while ((child = g_variant_iter_next_value (&iter)) != NULL)
     {
-      _PolkitTemporaryAuthorization *real_ta;
-
-      real_ta = array_seq->data.v_ptr[n];
-
-      result = g_list_prepend (result, polkit_temporary_authorization_new_for_real (real_ta));
+      ret = g_list_prepend (ret, polkit_temporary_authorization_new_for_gvariant (child));
+      g_variant_unref (child);
     }
-
-  result = g_list_reverse (result);
-
-  g_object_unref (array_seq);
+  ret = g_list_reverse (ret);
+  g_variant_unref (array);
+  g_variant_unref (value);
 
  out:
-  g_object_unref (real_res);
-  return result;
+  return ret;
 }
 
 /**
@@ -1235,53 +1063,20 @@ polkit_authority_enumerate_temporary_authorizations_sync (PolkitAuthority     *a
                                                           GCancellable        *cancellable,
                                                           GError             **error)
 {
-  guint call_id;
-  GAsyncResult *res;
-  GList *result;
+  GList *ret;
+  CallSyncData *data;
 
-  call_id = polkit_authority_enumerate_temporary_authorizations_async (authority, subject, cancellable, generic_cb, &res);
+  data = call_sync_new ();
+  polkit_authority_enumerate_temporary_authorizations (authority, subject, cancellable, call_sync_cb, data);
+  call_sync_block (data);
+  ret = polkit_authority_enumerate_temporary_authorizations_finish (authority, data->res, error);
+  call_sync_free (data);
 
-  egg_dbus_connection_pending_call_block (authority->system_bus, call_id);
-
-  result = polkit_authority_enumerate_temporary_authorizations_finish (authority, res, error);
-
-  g_object_unref (res);
-
-  return result;
+  return ret;
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
 
-static guint
-polkit_authority_revoke_temporary_authorizations_async (PolkitAuthority     *authority,
-                                                        PolkitSubject       *subject,
-                                                        GCancellable        *cancellable,
-                                                        GAsyncReadyCallback  callback,
-                                                        gpointer             user_data)
-{
-  guint call_id;
-  GSimpleAsyncResult *simple;
-  _PolkitSubject *real_subject;
-
-  simple = g_simple_async_result_new (G_OBJECT (authority),
-                                      callback,
-                                      user_data,
-                                      polkit_authority_revoke_temporary_authorizations_async);
-
-  real_subject = polkit_subject_get_real (subject);
-
-  call_id = _polkit_authority_revoke_temporary_authorizations (authority->real,
-                                                               EGG_DBUS_CALL_FLAGS_NONE,
-                                                               real_subject,
-                                                               cancellable,
-                                                               generic_async_cb,
-                                                               simple);
-
-  g_object_unref (real_subject);
-
-  return call_id;
-}
-
 /**
  * polkit_authority_revoke_temporary_authorizations:
  * @authority: A #PolkitAuthority.
@@ -1303,7 +1098,19 @@ polkit_authority_revoke_temporary_authorizations (PolkitAuthority     *authority
                                                   GAsyncReadyCallback  callback,
                                                   gpointer             user_data)
 {
-  polkit_authority_revoke_temporary_authorizations_async (authority, subject, cancellable, callback, user_data);
+  GVariant *subject_value;
+  subject_value = polkit_subject_to_gvariant (subject);
+  g_variant_ref_sink (subject_value);
+  g_dbus_proxy_call (authority->proxy,
+                     "RevokeTemporaryAuthorizations",
+                     g_variant_new ("(@(sa{sv}))",
+                                    subject_value),
+                     G_DBUS_CALL_FLAGS_NONE,
+                     -1,
+                     cancellable,
+                     callback,
+                     user_data);
+  g_variant_unref (subject_value);
 }
 
 /**
@@ -1321,24 +1128,18 @@ polkit_authority_revoke_temporary_authorizations_finish (PolkitAuthority *author
                                                          GAsyncResult    *res,
                                                          GError         **error)
 {
-  GSimpleAsyncResult *simple;
-  GAsyncResult *real_res;
   gboolean ret;
+  GVariant *value;
 
-  simple = G_SIMPLE_ASYNC_RESULT (res);
-  real_res = G_ASYNC_RESULT (g_simple_async_result_get_op_res_gpointer (simple));
-
-  g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == polkit_authority_revoke_temporary_authorizations_async);
+  ret = FALSE;
 
-  ret = _polkit_authority_revoke_temporary_authorizations_finish (authority->real,
-                                                                  real_res,
-                                                                  error);
-
-  if (!ret)
+  value = g_dbus_proxy_call_finish (authority->proxy, res, error);
+  if (value == NULL)
     goto out;
+  ret = TRUE;
+  g_variant_unref (value);
 
  out:
-  g_object_unref (real_res);
   return ret;
 }
 
@@ -1359,48 +1160,20 @@ polkit_authority_revoke_temporary_authorizations_sync (PolkitAuthority     *auth
                                                        GCancellable        *cancellable,
                                                        GError             **error)
 {
-  guint call_id;
-  GAsyncResult *res;
-  gboolean result;
-
-  call_id = polkit_authority_revoke_temporary_authorizations_async (authority, subject, cancellable, generic_cb, &res);
-
-  egg_dbus_connection_pending_call_block (authority->system_bus, call_id);
-
-  result = polkit_authority_revoke_temporary_authorizations_finish (authority, res, error);
+  gboolean ret;
+  CallSyncData *data;
 
-  g_object_unref (res);
+  data = call_sync_new ();
+  polkit_authority_revoke_temporary_authorizations (authority, subject, cancellable, call_sync_cb, data);
+  call_sync_block (data);
+  ret = polkit_authority_revoke_temporary_authorizations_finish (authority, data->res, error);
+  call_sync_free (data);
 
-  return result;
+  return ret;
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
 
-static guint
-polkit_authority_revoke_temporary_authorization_by_id_async (PolkitAuthority     *authority,
-                                                             const gchar         *id,
-                                                             GCancellable        *cancellable,
-                                                             GAsyncReadyCallback  callback,
-                                                             gpointer             user_data)
-{
-  guint call_id;
-  GSimpleAsyncResult *simple;
-
-  simple = g_simple_async_result_new (G_OBJECT (authority),
-                                      callback,
-                                      user_data,
-                                      polkit_authority_revoke_temporary_authorizations_async);
-
-  call_id = _polkit_authority_revoke_temporary_authorization_by_id (authority->real,
-                                                                    EGG_DBUS_CALL_FLAGS_NONE,
-                                                                    id,
-                                                                    cancellable,
-                                                                    generic_async_cb,
-                                                                    simple);
-
-  return call_id;
-}
-
 /**
  * polkit_authority_revoke_temporary_authorization_by_id:
  * @authority: A #PolkitAuthority.
@@ -1422,7 +1195,15 @@ polkit_authority_revoke_temporary_authorization_by_id (PolkitAuthority     *auth
                                                        GAsyncReadyCallback  callback,
                                                        gpointer             user_data)
 {
-  polkit_authority_revoke_temporary_authorization_by_id_async (authority, id, cancellable, callback, user_data);
+  g_dbus_proxy_call (authority->proxy,
+                     "RevokeTemporaryAuthorizationById",
+                     g_variant_new ("(s)",
+                                    id),
+                     G_DBUS_CALL_FLAGS_NONE,
+                     -1,
+                     cancellable,
+                     callback,
+                     user_data);
 }
 
 /**
@@ -1440,24 +1221,18 @@ polkit_authority_revoke_temporary_authorization_by_id_finish (PolkitAuthority *a
                                                               GAsyncResult    *res,
                                                               GError         **error)
 {
-  GSimpleAsyncResult *simple;
-  GAsyncResult *real_res;
   gboolean ret;
+  GVariant *value;
 
-  simple = G_SIMPLE_ASYNC_RESULT (res);
-  real_res = G_ASYNC_RESULT (g_simple_async_result_get_op_res_gpointer (simple));
-
-  g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == polkit_authority_revoke_temporary_authorizations_async);
+  ret = FALSE;
 
-  ret = _polkit_authority_revoke_temporary_authorization_by_id_finish (authority->real,
-                                                                       real_res,
-                                                                       error);
-
-  if (!ret)
+  value = g_dbus_proxy_call_finish (authority->proxy, res, error);
+  if (value == NULL)
     goto out;
+  ret = TRUE;
+  g_variant_unref (value);
 
  out:
-  g_object_unref (real_res);
   return ret;
 }
 
@@ -1478,48 +1253,20 @@ polkit_authority_revoke_temporary_authorization_by_id_sync (PolkitAuthority
                                                             GCancellable        *cancellable,
                                                             GError             **error)
 {
-  guint call_id;
-  GAsyncResult *res;
-  gboolean result;
-
-  call_id = polkit_authority_revoke_temporary_authorization_by_id_async (authority, id, cancellable, generic_cb, &res);
-
-  egg_dbus_connection_pending_call_block (authority->system_bus, call_id);
-
-  result = polkit_authority_revoke_temporary_authorization_by_id_finish (authority, res, error);
+  gboolean ret;
+  CallSyncData *data;
 
-  g_object_unref (res);
+  data = call_sync_new ();
+  polkit_authority_revoke_temporary_authorization_by_id (authority, id, cancellable, call_sync_cb, data);
+  call_sync_block (data);
+  ret = polkit_authority_revoke_temporary_authorization_by_id_finish (authority, data->res, error);
+  call_sync_free (data);
 
-  return result;
+  return ret;
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
 
-static guint
-polkit_authority_add_lockdown_for_action_async (PolkitAuthority     *authority,
-                                                const gchar         *action_id,
-                                                GCancellable        *cancellable,
-                                                GAsyncReadyCallback  callback,
-                                                gpointer             user_data)
-{
-  guint call_id;
-  GSimpleAsyncResult *simple;
-
-  simple = g_simple_async_result_new (G_OBJECT (authority),
-                                      callback,
-                                      user_data,
-                                      polkit_authority_add_lockdown_for_action_async);
-
-  call_id = _polkit_authority_add_lockdown_for_action (authority->real,
-                                                       EGG_DBUS_CALL_FLAGS_NONE,
-                                                       action_id,
-                                                       cancellable,
-                                                       generic_async_cb,
-                                                       simple);
-
-  return call_id;
-}
-
 /**
  * polkit_authority_add_lockdown_for_action:
  * @authority: A #PolkitAuthority.
@@ -1541,7 +1288,15 @@ polkit_authority_add_lockdown_for_action (PolkitAuthority     *authority,
                                           GAsyncReadyCallback  callback,
                                           gpointer             user_data)
 {
-  polkit_authority_add_lockdown_for_action_async (authority, action_id, cancellable, callback, user_data);
+  g_dbus_proxy_call (authority->proxy,
+                     "AddLockdownForAction",
+                     g_variant_new ("(s)",
+                                    action_id),
+                     G_DBUS_CALL_FLAGS_NONE,
+                     -1,
+                     cancellable,
+                     callback,
+                     user_data);
 }
 
 /**
@@ -1559,24 +1314,18 @@ polkit_authority_add_lockdown_for_action_finish (PolkitAuthority *authority,
                                                  GAsyncResult    *res,
                                                  GError         **error)
 {
-  GSimpleAsyncResult *simple;
-  GAsyncResult *real_res;
   gboolean ret;
+  GVariant *value;
 
-  simple = G_SIMPLE_ASYNC_RESULT (res);
-  real_res = G_ASYNC_RESULT (g_simple_async_result_get_op_res_gpointer (simple));
-
-  g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == polkit_authority_add_lockdown_for_action_async);
+  ret = FALSE;
 
-  ret = _polkit_authority_add_lockdown_for_action_finish (authority->real,
-                                                          real_res,
-                                                          error);
-
-  if (!ret)
+  value = g_dbus_proxy_call_finish (authority->proxy, res, error);
+  if (value == NULL)
     goto out;
+  ret = TRUE;
+  g_variant_unref (value);
 
  out:
-  g_object_unref (real_res);
   return ret;
 }
 
@@ -1597,48 +1346,20 @@ polkit_authority_add_lockdown_for_action_sync (PolkitAuthority     *authority,
                                                GCancellable        *cancellable,
                                                GError             **error)
 {
-  guint call_id;
-  GAsyncResult *res;
-  gboolean result;
-
-  call_id = polkit_authority_add_lockdown_for_action_async (authority, action_id, cancellable, generic_cb, &res);
-
-  egg_dbus_connection_pending_call_block (authority->system_bus, call_id);
-
-  result = polkit_authority_add_lockdown_for_action_finish (authority, res, error);
+  gboolean ret;
+  CallSyncData *data;
 
-  g_object_unref (res);
+  data = call_sync_new ();
+  polkit_authority_add_lockdown_for_action (authority, action_id, cancellable, call_sync_cb, data);
+  call_sync_block (data);
+  ret = polkit_authority_add_lockdown_for_action_finish (authority, data->res, error);
+  call_sync_free (data);
 
-  return result;
+  return ret;
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
 
-static guint
-polkit_authority_remove_lockdown_for_action_async (PolkitAuthority     *authority,
-                                                   const gchar         *action_id,
-                                                   GCancellable        *cancellable,
-                                                   GAsyncReadyCallback  callback,
-                                                   gpointer             user_data)
-{
-  guint call_id;
-  GSimpleAsyncResult *simple;
-
-  simple = g_simple_async_result_new (G_OBJECT (authority),
-                                      callback,
-                                      user_data,
-                                      polkit_authority_remove_lockdown_for_action_async);
-
-  call_id = _polkit_authority_remove_lockdown_for_action (authority->real,
-                                                       EGG_DBUS_CALL_FLAGS_NONE,
-                                                       action_id,
-                                                       cancellable,
-                                                       generic_async_cb,
-                                                       simple);
-
-  return call_id;
-}
-
 /**
  * polkit_authority_remove_lockdown_for_action:
  * @authority: A #PolkitAuthority.
@@ -1660,7 +1381,15 @@ polkit_authority_remove_lockdown_for_action (PolkitAuthority     *authority,
                                              GAsyncReadyCallback  callback,
                                              gpointer             user_data)
 {
-  polkit_authority_remove_lockdown_for_action_async (authority, action_id, cancellable, callback, user_data);
+  g_dbus_proxy_call (authority->proxy,
+                     "RemoveLockdownForAction",
+                     g_variant_new ("(s)",
+                                    action_id),
+                     G_DBUS_CALL_FLAGS_NONE,
+                     -1,
+                     cancellable,
+                     callback,
+                     user_data);
 }
 
 /**
@@ -1678,24 +1407,18 @@ polkit_authority_remove_lockdown_for_action_finish (PolkitAuthority *authority,
                                                     GAsyncResult    *res,
                                                     GError         **error)
 {
-  GSimpleAsyncResult *simple;
-  GAsyncResult *real_res;
   gboolean ret;
+  GVariant *value;
 
-  simple = G_SIMPLE_ASYNC_RESULT (res);
-  real_res = G_ASYNC_RESULT (g_simple_async_result_get_op_res_gpointer (simple));
-
-  g_warn_if_fail (g_simple_async_result_get_source_tag (simple) == polkit_authority_remove_lockdown_for_action_async);
+  ret = FALSE;
 
-  ret = _polkit_authority_remove_lockdown_for_action_finish (authority->real,
-                                                             real_res,
-                                                             error);
-
-  if (!ret)
+  value = g_dbus_proxy_call_finish (authority->proxy, res, error);
+  if (value == NULL)
     goto out;
+  ret = TRUE;
+  g_variant_unref (value);
 
  out:
-  g_object_unref (real_res);
   return ret;
 }
 
@@ -1716,19 +1439,16 @@ polkit_authority_remove_lockdown_for_action_sync (PolkitAuthority     *authority
                                                   GCancellable        *cancellable,
                                                   GError             **error)
 {
-  guint call_id;
-  GAsyncResult *res;
-  gboolean result;
-
-  call_id = polkit_authority_remove_lockdown_for_action_async (authority, action_id, cancellable, generic_cb, &res);
-
-  egg_dbus_connection_pending_call_block (authority->system_bus, call_id);
-
-  result = polkit_authority_remove_lockdown_for_action_finish (authority, res, error);
+  gboolean ret;
+  CallSyncData *data;
 
-  g_object_unref (res);
+  data = call_sync_new ();
+  polkit_authority_remove_lockdown_for_action (authority, action_id, cancellable, call_sync_cb, data);
+  call_sync_block (data);
+  ret = polkit_authority_remove_lockdown_for_action_finish (authority, data->res, error);
+  call_sync_free (data);
 
-  return result;
+  return ret;
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
@@ -1745,7 +1465,12 @@ const gchar *
 polkit_authority_get_backend_name (PolkitAuthority *authority)
 {
   if (authority->name == NULL)
-    authority->name = _polkit_authority_get_backend_name (authority->real);
+    {
+      GVariant *value;
+      value = g_dbus_proxy_get_cached_property (authority->proxy, "BackendName");
+      authority->name = g_variant_dup_string (value, NULL);
+      g_variant_unref (value);
+    }
   return authority->name;
 }
 
@@ -1755,13 +1480,18 @@ polkit_authority_get_backend_name (PolkitAuthority *authority)
  *
  * Gets the version of the authority backend.
  *
- * Returns: The name of the backend.
+ * Returns: The version string for the backend.
  */
 const gchar *
 polkit_authority_get_backend_version (PolkitAuthority *authority)
 {
   if (authority->version == NULL)
-    authority->version = _polkit_authority_get_backend_version (authority->real);
+    {
+      GVariant *value;
+      value = g_dbus_proxy_get_cached_property (authority->proxy, "BackendVersion");
+      authority->version = g_variant_dup_string (value, NULL);
+      g_variant_unref (value);
+    }
   return authority->version;
 }
 
@@ -1776,5 +1506,12 @@ polkit_authority_get_backend_version (PolkitAuthority *authority)
 PolkitAuthorityFeatures
 polkit_authority_get_backend_features (PolkitAuthority *authority)
 {
-  return _polkit_authority_get_backend_features (authority->real);
+  PolkitAuthorityFeatures ret;
+  GVariant *value;
+
+  value = g_dbus_proxy_get_cached_property (authority->proxy, "BackendFeatures");
+  ret = (PolkitAuthorityFeatures) g_variant_get_uint32 (value);
+  g_variant_unref (value);
+
+  return ret;
 }
diff --git a/src/polkit/polkitauthorizationresult.c b/src/polkit/polkitauthorizationresult.c
index 20c1434..334a6f3 100644
--- a/src/polkit/polkitauthorizationresult.c
+++ b/src/polkit/polkitauthorizationresult.c
@@ -302,3 +302,43 @@ polkit_authorization_result_get_locked_down (PolkitAuthorizationResult *result)
 
   return ret;
 }
+
+PolkitAuthorizationResult *
+polkit_authorization_result_new_for_gvariant (GVariant *value)
+{
+  gboolean is_authorized;
+  gboolean is_challenge;
+  GVariant *dict;
+  PolkitDetails *details;
+  PolkitAuthorizationResult *ret;
+
+  g_variant_get (value,
+                 "(bb at a{ss})",
+                 &is_authorized,
+                 &is_challenge,
+                 &dict);
+  details = polkit_details_new_for_gvariant (dict);
+  g_variant_unref (dict);
+
+  ret = polkit_authorization_result_new (is_authorized, is_challenge, details);
+  g_object_unref (details);
+
+  return ret;
+}
+
+GVariant *
+polkit_authorization_result_to_gvariant (PolkitAuthorizationResult *authorization_result)
+{
+  GVariant *ret;
+  GVariant *details_gvariant;
+
+  details_gvariant = polkit_details_to_gvariant (polkit_authorization_result_get_details (authorization_result));
+  g_variant_ref_sink (details_gvariant);
+  ret = g_variant_new ("(bb at a{ss})",
+                       polkit_authorization_result_get_is_authorized (authorization_result),
+                       polkit_authorization_result_get_is_challenge (authorization_result),
+                       details_gvariant);
+  g_variant_unref (details_gvariant);
+
+  return ret;
+}
diff --git a/src/polkit/polkitdetails.c b/src/polkit/polkitdetails.c
index 2ef9e78..3490a71 100644
--- a/src/polkit/polkitdetails.c
+++ b/src/polkit/polkitdetails.c
@@ -188,3 +188,43 @@ polkit_details_get_keys (PolkitDetails *details)
 
   return ret;
 }
+
+GVariant *
+polkit_details_to_gvariant (PolkitDetails *details)
+{
+  GVariant *ret;
+  GVariantBuilder builder;
+
+  g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{ss}"));
+  if (details != NULL && details->hash != NULL)
+    {
+      GHashTableIter hash_iter;
+      const gchar *key;
+      const gchar *value;
+
+      g_hash_table_iter_init (&hash_iter, details->hash);
+      while (g_hash_table_iter_next (&hash_iter, (gpointer) &key, (gpointer) &value))
+        g_variant_builder_add (&builder, "{ss}", key, value);
+    }
+  ret = g_variant_builder_end (&builder);
+  return ret;
+}
+
+PolkitDetails *
+polkit_details_new_for_gvariant (GVariant *value)
+{
+  PolkitDetails *ret;
+  GHashTable *hash;
+  GVariantIter iter;
+  gchar *hash_key;
+  gchar *hash_value;
+
+  hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+  g_variant_iter_init (&iter, value);
+  while (g_variant_iter_next (&iter, "{ss}", &hash_key, &hash_value))
+    g_hash_table_insert (hash, hash_key, hash_value);
+  ret = polkit_details_new_for_hash (hash);
+  g_hash_table_unref (hash);
+  return ret;
+}
+
diff --git a/src/polkit/polkiterror.c b/src/polkit/polkiterror.c
index 9a50d10..89b9007 100644
--- a/src/polkit/polkiterror.c
+++ b/src/polkit/polkiterror.c
@@ -34,9 +34,22 @@
  * Error codes.
  */
 
+static const GDBusErrorEntry polkit_error_entries[] =
+{
+  {POLKIT_ERROR_FAILED,         "org.freedesktop.PolicyKit1.Error.Failed"},
+  {POLKIT_ERROR_CANCELLED,      "org.freedesktop.PolicyKit1.Error.Cancelled"},
+  {POLKIT_ERROR_NOT_SUPPORTED,  "org.freedesktop.PolicyKit1.Error.NotSupported"},
+  {POLKIT_ERROR_NOT_AUTHORIZED, "org.freedesktop.PolicyKit1.Error.NotAuthorized"},
+};
+
 GQuark
 polkit_error_quark (void)
 {
-  return _polkit_error_quark ();
+  static volatile gsize quark_volatile = 0;
+  g_dbus_error_register_error_domain ("polkit-error-quark",
+                                      &quark_volatile,
+                                      polkit_error_entries,
+                                      G_N_ELEMENTS (polkit_error_entries));
+  G_STATIC_ASSERT (G_N_ELEMENTS (polkit_error_entries) - 1 == POLKIT_ERROR_NOT_AUTHORIZED);
+  return (GQuark) quark_volatile;
 }
-
diff --git a/src/polkit/polkitidentity.c b/src/polkit/polkitidentity.c
index 6e33136..b80c57f 100644
--- a/src/polkit/polkitidentity.c
+++ b/src/polkit/polkitidentity.c
@@ -259,3 +259,125 @@ polkit_identity_get_real (PolkitIdentity *identity)
   return real;
 }
 
+GVariant *
+polkit_identity_to_gvariant (PolkitIdentity *identity)
+{
+  g_assert_not_reached ();
+  return NULL;
+}
+
+static GVariant *
+lookup_asv (GVariant            *dict,
+            const gchar         *given_key,
+            const GVariantType  *given_type,
+            GError             **error)
+{
+  GVariantIter iter;
+  const gchar *key;
+  GVariant *value;
+  GVariant *ret;
+
+  ret = NULL;
+
+  g_variant_iter_init (&iter, dict);
+  while (g_variant_iter_next (&iter, "{&sv}", &key, &value))
+    {
+      if (g_strcmp0 (key, given_key) == 0)
+        {
+          if (!g_variant_is_of_type (value, given_type))
+            {
+              gchar *type_string;
+              type_string = g_variant_type_dup_string (given_type);
+              g_set_error (error,
+                           POLKIT_ERROR,
+                           POLKIT_ERROR_FAILED,
+                           "Value for key `%s' found but is of type %s and type %s was expected",
+                           given_key,
+                           g_variant_get_type_string (value),
+                           type_string);
+              g_free (type_string);
+              goto out;
+            }
+          ret = value;
+          goto out;
+        }
+      g_variant_unref (value);
+    }
+
+ out:
+  if (ret == NULL)
+    {
+      gchar *type_string;
+      type_string = g_variant_type_dup_string (given_type);
+      g_set_error (error,
+                   POLKIT_ERROR,
+                   POLKIT_ERROR_FAILED,
+                   "Didn't find value for key `%s' of type %s",
+                   given_key,
+                   type_string);
+      g_free (type_string);
+    }
+
+  return ret;
+}
+
+PolkitIdentity *
+polkit_identity_new_for_gvariant (GVariant  *variant,
+                                  GError    **error)
+{
+  PolkitIdentity *ret;
+  const gchar *kind;
+  GVariant *details_gvariant;
+
+  ret = NULL;
+
+  g_variant_get (variant,
+                 "(&s at a{sv})",
+                 &kind,
+                 &details_gvariant);
+
+  if (g_strcmp0 (kind, "unix-user") == 0)
+    {
+      GVariant *v;
+      guint32 uid;
+
+      v = lookup_asv (details_gvariant, "uid", G_VARIANT_TYPE_UINT32, error);
+      if (v == NULL)
+        {
+          g_prefix_error (error, "Error parsing unix-user identity: ");
+          goto out;
+        }
+      uid = g_variant_get_uint32 (v);
+      g_variant_unref (v);
+
+      ret = polkit_unix_user_new (uid);
+    }
+  else if (g_strcmp0 (kind, "unix-group") == 0)
+    {
+      GVariant *v;
+      guint32 gid;
+
+      v = lookup_asv (details_gvariant, "gid", G_VARIANT_TYPE_UINT32, error);
+      if (v == NULL)
+        {
+          g_prefix_error (error, "Error parsing unix-user identity: ");
+          goto out;
+        }
+      gid = g_variant_get_uint32 (v);
+      g_variant_unref (v);
+
+      ret = polkit_unix_group_new (gid);
+    }
+  else
+    {
+      g_set_error (error,
+                   POLKIT_ERROR,
+                   POLKIT_ERROR_FAILED,
+                   "Unknown identity of kind `%s'",
+                   kind);
+    }
+
+ out:
+  g_variant_unref (details_gvariant);
+  return ret;
+}
diff --git a/src/polkit/polkitprivate.h b/src/polkit/polkitprivate.h
index 3d4ed16..d52f628 100644
--- a/src/polkit/polkitprivate.h
+++ b/src/polkit/polkitprivate.h
@@ -38,6 +38,14 @@
 
 PolkitActionDescription  *polkit_action_description_new_for_real (_PolkitActionDescription *real);
 _PolkitActionDescription *polkit_action_description_get_real     (PolkitActionDescription  *action_description);
+PolkitActionDescription  *polkit_action_description_new_for_gvariant (GVariant *value);
+GVariant *polkit_action_description_to_gvariant (PolkitActionDescription *action_description);
+
+GVariant *polkit_subject_to_gvariant (PolkitSubject *subject);
+GVariant *polkit_identity_to_gvariant (PolkitIdentity *identity);
+
+PolkitSubject  *polkit_subject_new_for_gvariant (GVariant *variant, GError **error);
+PolkitIdentity *polkit_identity_new_for_gvariant (GVariant *variant, GError **error);
 
 PolkitSubject  *polkit_subject_new_for_real (_PolkitSubject *real);
 _PolkitSubject *polkit_subject_get_real     (PolkitSubject  *subject);
@@ -47,11 +55,17 @@ _PolkitIdentity *polkit_identity_get_real     (PolkitIdentity  *identity);
 
 PolkitAuthorizationResult  *polkit_authorization_result_new_for_real (_PolkitAuthorizationResult *real);
 _PolkitAuthorizationResult *polkit_authorization_result_get_real (PolkitAuthorizationResult *authorization_result);
+PolkitAuthorizationResult  *polkit_authorization_result_new_for_gvariant (GVariant *value);
+GVariant *polkit_authorization_result_to_gvariant (PolkitAuthorizationResult *authorization_result);
 
 _PolkitTemporaryAuthorization *polkit_temporary_authorization_get_real (PolkitTemporaryAuthorization *authorization);
 PolkitTemporaryAuthorization *polkit_temporary_authorization_new_for_real (_PolkitTemporaryAuthorization *real);
+PolkitTemporaryAuthorization *polkit_temporary_authorization_new_for_gvariant (GVariant *value);
+GVariant *polkit_temporary_authorization_to_gvariant (PolkitTemporaryAuthorization *authorization);
 
 PolkitDetails *polkit_details_new_for_hash (GHashTable *hash);
 GHashTable *polkit_details_get_hash (PolkitDetails *details);
+GVariant *polkit_details_to_gvariant (PolkitDetails *details);
+PolkitDetails *polkit_details_new_for_gvariant (GVariant *value);
 
 #endif /* __POLKIT_PRIVATE_H */
diff --git a/src/polkit/polkitsubject.c b/src/polkit/polkitsubject.c
index d5039a5..0fab0d9 100644
--- a/src/polkit/polkitsubject.c
+++ b/src/polkit/polkitsubject.c
@@ -360,3 +360,193 @@ polkit_subject_get_real (PolkitSubject *subject)
 
   return real;
 }
+
+GVariant *
+polkit_subject_to_gvariant (PolkitSubject *subject)
+{
+  GVariantBuilder builder;
+  GVariant *dict;
+  GVariant *ret;
+  const gchar *kind;
+
+  kind = "";
+
+  g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
+  if (POLKIT_IS_UNIX_PROCESS (subject))
+    {
+      kind = "unix-process";
+      g_variant_builder_add (&builder, "{sv}", "pid",
+                             g_variant_new_uint32 (polkit_unix_process_get_pid (POLKIT_UNIX_PROCESS (subject))));
+      g_variant_builder_add (&builder, "{sv}", "start-time",
+                             g_variant_new_uint64 (polkit_unix_process_get_start_time (POLKIT_UNIX_PROCESS (subject))));
+    }
+  else if (POLKIT_IS_UNIX_SESSION (subject))
+    {
+      kind = "unix-process";
+      g_variant_builder_add (&builder, "{sv}", "session-id",
+                             g_variant_new_string (polkit_unix_session_get_session_id (POLKIT_UNIX_SESSION (subject))));
+    }
+  else if (POLKIT_IS_SYSTEM_BUS_NAME (subject))
+    {
+      kind = "system-bus-name";
+      g_variant_builder_add (&builder, "{sv}", "name",
+                             g_variant_new_string (polkit_system_bus_name_get_name (POLKIT_SYSTEM_BUS_NAME (subject))));
+    }
+  else
+    {
+      g_warning ("Unknown class %s implementing PolkitSubject", g_type_name (G_TYPE_FROM_INSTANCE (subject)));
+    }
+
+  dict = g_variant_builder_end (&builder);
+  ret = g_variant_new ("(s at a{sv})", kind, dict);
+  return ret;
+}
+
+static GVariant *
+lookup_asv (GVariant            *dict,
+            const gchar         *given_key,
+            const GVariantType  *given_type,
+            GError             **error)
+{
+  GVariantIter iter;
+  const gchar *key;
+  GVariant *value;
+  GVariant *ret;
+
+  ret = NULL;
+
+  g_variant_iter_init (&iter, dict);
+  while (g_variant_iter_next (&iter, "{&sv}", &key, &value))
+    {
+      if (g_strcmp0 (key, given_key) == 0)
+        {
+          if (!g_variant_is_of_type (value, given_type))
+            {
+              gchar *type_string;
+              type_string = g_variant_type_dup_string (given_type);
+              g_set_error (error,
+                           POLKIT_ERROR,
+                           POLKIT_ERROR_FAILED,
+                           "Value for key `%s' found but is of type %s and type %s was expected",
+                           given_key,
+                           g_variant_get_type_string (value),
+                           type_string);
+              g_free (type_string);
+              goto out;
+            }
+          ret = value;
+          goto out;
+        }
+      g_variant_unref (value);
+    }
+
+ out:
+  if (ret == NULL)
+    {
+      gchar *type_string;
+      type_string = g_variant_type_dup_string (given_type);
+      g_set_error (error,
+                   POLKIT_ERROR,
+                   POLKIT_ERROR_FAILED,
+                   "Didn't find value for key `%s' of type %s",
+                   given_key,
+                   type_string);
+      g_free (type_string);
+    }
+
+  return ret;
+}
+
+PolkitSubject *
+polkit_subject_new_for_gvariant (GVariant  *variant,
+                                 GError    **error)
+{
+  PolkitSubject *ret;
+  const gchar *kind;
+  GVariant *details_gvariant;
+
+  ret = NULL;
+
+  g_variant_get (variant,
+                 "(&s at a{sv})",
+                 &kind,
+                 &details_gvariant);
+
+  if (g_strcmp0 (kind, "unix-process") == 0)
+    {
+      GVariant *v;
+      guint32 pid;
+      guint64 start_time;
+
+      v = lookup_asv (details_gvariant, "pid", G_VARIANT_TYPE_UINT32, error);
+      if (v == NULL)
+        {
+          g_prefix_error (error, "Error parsing unix-process subject: ");
+          goto out;
+        }
+      pid = g_variant_get_uint32 (v);
+      g_variant_unref (v);
+
+      v = lookup_asv (details_gvariant, "start-time", G_VARIANT_TYPE_UINT64, error);
+      if (v == NULL)
+        {
+          g_prefix_error (error, "Error parsing unix-process subject: ");
+          goto out;
+        }
+      start_time = g_variant_get_uint64 (v);
+      g_variant_unref (v);
+
+      ret = polkit_unix_process_new_full (pid, start_time);
+    }
+  else if (g_strcmp0 (kind, "unix-session") == 0)
+    {
+      GVariant *v;
+      const gchar *session_id;
+
+      v = lookup_asv (details_gvariant, "session-id", G_VARIANT_TYPE_STRING, error);
+      if (v == NULL)
+        {
+          g_prefix_error (error, "Error parsing unix-session subject: ");
+          goto out;
+        }
+      session_id = g_variant_get_string (v, NULL);
+      ret = polkit_unix_session_new (session_id);
+      g_variant_unref (v);
+    }
+  else if (g_strcmp0 (kind, "system-bus-name") == 0)
+    {
+      GVariant *v;
+      const gchar *name;
+
+      v = lookup_asv (details_gvariant, "name", G_VARIANT_TYPE_STRING, error);
+      if (v == NULL)
+        {
+          g_prefix_error (error, "Error parsing system-bus-name subject: ");
+          goto out;
+        }
+      name = g_variant_get_string (v, NULL);
+      if (!g_dbus_is_unique_name (name))
+        {
+          g_set_error (error,
+                       POLKIT_ERROR,
+                       POLKIT_ERROR_FAILED,
+                       "Error parsing system-bus-name subject: `%s' is not a valid unique name",
+                       name);
+          goto out;
+        }
+      ret = polkit_system_bus_name_new (name);
+      g_variant_unref (v);
+    }
+  else
+    {
+      g_set_error (error,
+                   POLKIT_ERROR,
+                   POLKIT_ERROR_FAILED,
+                   "Unknown subject of kind `%s'",
+                   kind);
+    }
+
+ out:
+  g_variant_unref (details_gvariant);
+  return ret;
+}
diff --git a/src/polkit/polkittemporaryauthorization.c b/src/polkit/polkittemporaryauthorization.c
index 409a5ec..3126b18 100644
--- a/src/polkit/polkittemporaryauthorization.c
+++ b/src/polkit/polkittemporaryauthorization.c
@@ -209,3 +209,43 @@ polkit_temporary_authorization_get_time_expires (PolkitTemporaryAuthorization *a
 {
   return _polkit_temporary_authorization_get_time_expires (authorization->real);
 }
+
+PolkitTemporaryAuthorization *
+polkit_temporary_authorization_new_for_gvariant (GVariant *value)
+{
+  g_assert_not_reached ();
+  return NULL;
+}
+
+GVariant *
+polkit_temporary_authorization_to_gvariant (PolkitTemporaryAuthorization *authorization)
+{
+  const gchar *id;
+  const gchar *action_id;
+  PolkitSubject *subject;
+  guint64 time_obtained;
+  guint64 time_expires;
+  GVariant *ret;
+  GVariant *subject_gvariant;
+
+  id = polkit_temporary_authorization_get_id (authorization);
+  action_id = polkit_temporary_authorization_get_action_id (authorization);
+  subject = polkit_temporary_authorization_get_subject (authorization);
+  time_obtained = polkit_temporary_authorization_get_time_obtained (authorization);
+  time_expires = polkit_temporary_authorization_get_time_expires (authorization);
+
+  subject_gvariant = polkit_subject_to_gvariant (subject);
+  g_variant_ref_sink (subject_gvariant);
+  ret = g_variant_new ("(ss@(sa{sv})tt)",
+                       id,
+                       action_id,
+                       subject_gvariant,
+                       time_obtained,
+                       time_expires);
+
+  g_variant_unref (subject_gvariant);
+  g_object_unref (subject);
+
+  return ret;
+}
+
diff --git a/src/polkitbackend/polkitbackendauthority.c b/src/polkitbackend/polkitbackendauthority.c
index 44de079..4373315 100644
--- a/src/polkitbackend/polkitbackendauthority.c
+++ b/src/polkitbackend/polkitbackendauthority.c
@@ -648,212 +648,219 @@ polkit_backend_authority_remove_lockdown_for_action_finish (PolkitBackendAuthori
 
 /* ---------------------------------------------------------------------------------------------------- */
 
-#define TYPE_SERVER         (server_get_type ())
-#define SERVER(o)           (G_TYPE_CHECK_INSTANCE_CAST ((o), TYPE_SERVER, Server))
-#define SERVER_CLASS(k)     (G_TYPE_CHECK_CLASS_CAST ((k), TYPE_SERVER, ServerClass))
-#define SERVER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), TYPE_SERVER,ServerClass))
-#define IS_SERVER(o)        (G_TYPE_CHECK_INSTANCE_TYPE ((o), TYPE_SERVER))
-#define IS_SERVER_CLASS(k)  (G_TYPE_CHECK_CLASS_TYPE ((k), TYPE_SERVER))
-
-typedef struct _Server Server;
-typedef struct _ServerClass ServerClass;
-
-GType server_get_type (void) G_GNUC_CONST;
-
-struct _Server
+typedef struct
 {
-  GObject parent_instance;
-
-  PolkitBackendAuthority *authority;
-
-  EggDBusConnection *system_bus;
+  guint authority_registration_id;
+  guint name_owner_changed_signal_id;
 
-  EggDBusObjectProxy *bus_proxy;
+  GDBusNodeInfo *introspection_info;
 
-  EggDBusBus *bus;
+  PolkitBackendAuthority *authority;
 
-  gulong name_owner_changed_id;
+  GDBusConnection *system_bus;
 
   gulong authority_changed_id;
 
   gchar *well_known_name;
+  gchar *object_path;
 
-  GHashTable *cancellation_id_to_cancellable;
-};
-
-struct _ServerClass
-{
-  GObjectClass parent_class;
-};
-
-enum
-{
-  PROP_0,
-  PROP_BACKEND_NAME,
-  PROP_BACKEND_VERSION,
-  PROP_BACKEND_FEATURES
-};
-
-static void authority_iface_init         (_PolkitAuthorityIface        *authority_iface);
-
-G_DEFINE_TYPE_WITH_CODE (Server, server, G_TYPE_OBJECT,
-                         G_IMPLEMENT_INTERFACE (_POLKIT_TYPE_AUTHORITY, authority_iface_init)
-                         );
+  GHashTable *cancellation_id_to_check_auth_data;
+} Server;
 
 static void
-server_init (Server *server)
+server_free (Server *server)
 {
-  server->cancellation_id_to_cancellable = g_hash_table_new_full (g_str_hash,
-                                                                  g_str_equal,
-                                                                  g_free,
-                                                                  g_object_unref);
-}
-
-static void
-server_finalize (GObject *object)
-{
-  Server *server;
-
-  server = SERVER (object);
-
   g_free (server->well_known_name);
+  g_free (server->object_path);
 
   /* TODO: release well_known_name if not NULL */
 
-  g_signal_handler_disconnect (server->bus, server->name_owner_changed_id);
-
-  g_object_unref (server->bus_proxy);
-
-  g_object_unref (server->system_bus);
+  //g_signal_handler_disconnect (server->bus, server->name_owner_changed_id);
 
-  g_signal_handler_disconnect (server->authority, server->authority_changed_id);
+  if (server->authority_registration_id > 0)
+    g_dbus_connection_unregister_object (server->system_bus, server->authority_registration_id);
 
-  g_hash_table_unref (server->cancellation_id_to_cancellable);
-}
+  if (server->name_owner_changed_signal_id > 0)
+    g_dbus_connection_signal_unsubscribe (server->system_bus, server->name_owner_changed_signal_id);
 
-static void
-server_get_property (GObject    *object,
-                     guint       prop_id,
-                     GValue     *value,
-                     GParamSpec *pspec)
-{
-  Server *server = SERVER (object);
+  if (server->system_bus != NULL)
+    g_object_unref (server->system_bus);
 
-  switch (prop_id)
-    {
-    case PROP_BACKEND_NAME:
-      g_value_set_string (value, polkit_backend_authority_get_name (server->authority));
-      break;
+  if (server->introspection_info != NULL)
+    g_dbus_node_info_unref (server->introspection_info);
 
-    case PROP_BACKEND_VERSION:
-      g_value_set_string (value, polkit_backend_authority_get_version (server->authority));
-      break;
+  if (server->authority != NULL && server->authority_changed_id > 0)
+    g_signal_handler_disconnect (server->authority, server->authority_changed_id);
 
-    case PROP_BACKEND_FEATURES:
-      g_value_set_flags (value, polkit_backend_authority_get_features (server->authority));
-      break;
+  if (server->cancellation_id_to_check_auth_data != NULL)
+    g_hash_table_unref (server->cancellation_id_to_check_auth_data);
 
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-      break;
-    }
+  g_free (server);
 }
 
-
 static void
-server_class_init (ServerClass *klass)
+on_authority_changed (PolkitBackendAuthority *authority,
+                      gpointer                user_data)
 {
-  GObjectClass *gobject_class;
-
-  gobject_class = G_OBJECT_CLASS (klass);
-
-  gobject_class->finalize = server_finalize;
-  gobject_class->get_property = server_get_property;
+  Server *server = user_data;
+  GError *error;
 
-  g_assert (_polkit_authority_override_properties (gobject_class, PROP_BACKEND_NAME) == PROP_BACKEND_FEATURES);
+  error = NULL;
+  if (!g_dbus_connection_emit_signal (server->system_bus,
+                                      NULL, /* destination bus name */
+                                      server->object_path,
+                                      "org.freedesktop.PolicyKit1.Authority",
+                                      "Changed",
+                                      NULL,
+                                      &error))
+    {
+      g_warning ("Error emitting Changed() signal: %s", error->message);
+      g_error_free (error);
+    }
 }
 
 static void
-name_owner_changed (EggDBusBus *instance,
-                    gchar      *name,
-                    gchar      *old_owner,
-                    gchar      *new_owner,
-                    Server     *server)
+authority_died (gpointer user_data,
+                GObject *where_the_object_was)
 {
-  polkit_backend_authority_system_bus_name_owner_changed (server->authority, name, old_owner, new_owner);
+  Server *server = user_data;
+  server_free (server);
 }
 
-static void
-authority_changed (PolkitBackendAuthority *authority,
-                   Server                 *server)
-{
-  _polkit_authority_emit_signal_changed (_POLKIT_AUTHORITY (server), NULL);
-}
+static const gchar *server_introspection_data =
+  "<node>"
+  "  <interface name='org.freedesktop.PolicyKit1.Authority'>"
+  "    <method name='EnumerateActions'>"
+  "      <arg type='s' name='locale' direction='in'/>"
+  "      <arg type='a(ssssssuuua{ss})' name='action_descriptions' direction='out'/>"
+  "    </method>"
+  "    <method name='CheckAuthorization'>"
+  "      <arg type='(sa{sv})' name='subject' direction='in'/>"
+  "      <arg type='s' name='action_id' direction='in'/>"
+  "      <arg type='a{ss}' name='details' direction='in'/>"
+  "      <arg type='u' name='flags' direction='in'/>"
+  "      <arg type='s' name='cancellation_id' direction='in'/>"
+  "      <arg type='(bba{ss})' name='result' direction='out'/>"
+  "    </method>"
+  "    <method name='CancelCheckAuthorization'>"
+  "      <arg type='s' name='cancellation_id' direction='in'/>"
+  "    </method>"
+  "    <method name='RegisterAuthenticationAgent'>"
+  "      <arg type='(sa{sv})' name='subject' direction='in'/>"
+  "      <arg type='s' name='locale' direction='in'/>"
+  "      <arg type='s' name='object_path' direction='in'/>"
+  "    </method>"
+  "    <method name='UnregisterAuthenticationAgent'>"
+  "      <arg type='(sa{sv})' name='subject' direction='in'/>"
+  "      <arg type='s' name='object_path' direction='in'/>"
+  "    </method>"
+  "    <method name='AuthenticationAgentResponse'>"
+  "      <arg type='s' name='cookie' direction='in'/>"
+  "      <arg type='(sa{sv})' name='identity' direction='in'/>"
+  "    </method>"
+  "    <method name='EnumerateTemporaryAuthorizations'>"
+  "      <arg type='(sa{sv})' name='subject' direction='in'/>"
+  "      <arg type='a(ss(sa{sv})tt)' name='temporary_authorizations' direction='out'/>"
+  "    </method>"
+  "    <method name='RevokeTemporaryAuthorizations'>"
+  "      <arg type='(sa{sv})' name='subject' direction='in'/>"
+  "    </method>"
+  "    <method name='RevokeTemporaryAuthorizationById'>"
+  "      <arg type='s' name='id' direction='in'/>"
+  "    </method>"
+  "    <method name='AddLockdownForAction'>"
+  "      <arg type='s' name='action_id' direction='in'/>"
+  "    </method>"
+  "    <method name='RemoveLockdownForAction'>"
+  "      <arg type='s' name='action_id' direction='in'/>"
+  "    </method>"
+  "    <signal name='Changed'/>"
+  "    <property type='s' name='BackendName' access='read'/>"
+  "    <property type='s' name='BackendVersion' access='read'/>"
+  "    <property type='u' name='BackendFeatures' access='read'/>"
+  "  </interface>"
+  "</node>";
 
 /* ---------------------------------------------------------------------------------------------------- */
 
 static void
-authority_handle_enumerate_actions (_PolkitAuthority        *instance,
-                                    const gchar             *locale,
-                                    EggDBusMethodInvocation *method_invocation)
+server_handle_enumerate_actions (Server                 *server,
+                                 GVariant               *parameters,
+                                 PolkitSubject          *caller,
+                                 GDBusMethodInvocation  *invocation)
 {
-  Server *server = SERVER (instance);
-  PolkitSubject *caller;
-  EggDBusArraySeq *array;
+  GVariantBuilder builder;
   GError *error;
   GList *actions;
   GList *l;
+  const gchar *locale;
 
-  error = NULL;
-  caller = NULL;
   actions = NULL;
 
-  caller = polkit_system_bus_name_new (egg_dbus_method_invocation_get_caller (method_invocation));
+  g_variant_get (parameters, "(&s)", &locale);
 
+  error = NULL;
   actions = polkit_backend_authority_enumerate_actions (server->authority,
                                                         caller,
                                                         locale,
                                                         &error);
   if (error != NULL)
     {
-      egg_dbus_method_invocation_return_gerror (method_invocation, error);
+      g_dbus_method_invocation_return_gerror (invocation, error);
       g_error_free (error);
       goto out;
     }
 
-  array = egg_dbus_array_seq_new (G_TYPE_OBJECT, //_POLKIT_TYPE_ACTION_DESCRIPTION,
-                                  (GDestroyNotify) g_object_unref,
-                                  NULL,
-                                  NULL);
-
+  g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(ssssssuuua{ss})"));
   for (l = actions; l != NULL; l = l->next)
     {
       PolkitActionDescription *ad = POLKIT_ACTION_DESCRIPTION (l->data);
-      _PolkitActionDescription *real;
-
-      real = polkit_action_description_get_real (ad);
-      egg_dbus_array_seq_add (array, real);
+      GVariant *value;
+      value = polkit_action_description_to_gvariant (ad);
+      g_variant_ref_sink (value);
+      g_variant_builder_add_value (&builder, value);
+      g_variant_unref (value);
     }
-
-  _polkit_authority_handle_enumerate_actions_finish (method_invocation, array);
-
-  g_object_unref (array);
+  g_dbus_method_invocation_return_value (invocation, g_variant_new ("(a(ssssssuuua{ss}))", &builder));
 
  out:
   g_list_foreach (actions, (GFunc) g_object_unref, NULL);
   g_list_free (actions);
-  g_object_unref (caller);
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
 
+typedef struct
+{
+  GDBusMethodInvocation *invocation;
+  Server *server;
+  PolkitSubject *caller;
+  PolkitSubject *subject;
+  GCancellable *cancellable;
+  gchar *cancellation_id;
+} CheckAuthData;
+
+static void
+check_auth_data_free (CheckAuthData *data)
+{
+  if (data->invocation != NULL)
+    g_object_unref (data->invocation);
+  if (data->caller != NULL)
+    g_object_unref (data->caller);
+  if (data->subject != NULL)
+    g_object_unref (data->subject);
+  if (data->cancellable != NULL)
+    g_object_unref (data->cancellable);
+  g_free (data->cancellation_id);
+  g_free (data);
+}
+
 static void
 check_auth_cb (GObject      *source_object,
                GAsyncResult *res,
                gpointer      user_data)
 {
-  EggDBusMethodInvocation *method_invocation = EGG_DBUS_METHOD_INVOCATION (user_data);
-  const gchar *full_cancellation_id;
+  CheckAuthData *data = user_data;
   PolkitAuthorizationResult *result;
   GError *error;
 
@@ -862,92 +869,96 @@ check_auth_cb (GObject      *source_object,
                                                                 res,
                                                                 &error);
 
-  full_cancellation_id = g_object_get_data (G_OBJECT (method_invocation), "cancellation-id");
-  if (full_cancellation_id != NULL)
-    {
-      Server *server;
-      server = SERVER (g_object_get_data (G_OBJECT (method_invocation), "server"));
-      g_hash_table_remove (server->cancellation_id_to_cancellable, full_cancellation_id);
-    }
+  if (data->cancellation_id != NULL)
+    g_hash_table_remove (data->server->cancellation_id_to_check_auth_data, data->cancellation_id);
 
   if (error != NULL)
     {
-      egg_dbus_method_invocation_return_gerror (method_invocation, error);
+      g_dbus_method_invocation_return_gerror (data->invocation, error);
       g_error_free (error);
     }
   else
     {
-      _PolkitAuthorizationResult *real_result;
-      real_result = polkit_authorization_result_get_real (result);
-      _polkit_authority_handle_check_authorization_finish (method_invocation, real_result);
-      g_object_unref (real_result);
-      g_object_unref (result);
+      GVariant *value;
+      value = polkit_authorization_result_to_gvariant (result);
+      g_variant_ref_sink (value);
+      g_dbus_method_invocation_return_value (data->invocation, g_variant_new ("(@(bba{ss}))", value));
+      g_variant_unref (value);
     }
+
+  check_auth_data_free (data);
 }
 
 static void
-authority_handle_check_authorization (_PolkitAuthority               *instance,
-                                      _PolkitSubject                 *real_subject,
-                                      const gchar                    *action_id,
-                                      EggDBusHashMap                 *real_details,
-                                      _PolkitCheckAuthorizationFlags  flags,
-                                      const gchar                    *cancellation_id,
-                                      EggDBusMethodInvocation        *method_invocation)
+server_handle_check_authorization (Server                 *server,
+                                   GVariant               *parameters,
+                                   PolkitSubject          *caller,
+                                   GDBusMethodInvocation  *invocation)
 {
-  Server *server = SERVER (instance);
-  const gchar *caller_name;
+  GVariant *subject_gvariant;
+  const gchar *action_id;
+  GVariant *details_gvariant;
+  guint32 flags;
+  const gchar *cancellation_id;
+  GError *error;
   PolkitSubject *subject;
-  PolkitSubject *caller;
-  GCancellable *cancellable;
   PolkitDetails *details;
 
+  subject = NULL;
   details = NULL;
 
-  subject = polkit_subject_new_for_real (real_subject);
+  g_variant_get (parameters,
+                 "(@(sa{sv})&s at a{ss}u&s)",
+                 &subject_gvariant,
+                 &action_id,
+                 &details_gvariant,
+                 &flags,
+                 &cancellation_id);
+
+  error = NULL;
+  subject = polkit_subject_new_for_gvariant (subject_gvariant, &error);
   if (subject == NULL)
     {
-      egg_dbus_method_invocation_return_error_literal (method_invocation,
-                                                       _POLKIT_ERROR,
-                                                       _POLKIT_ERROR_FAILED,
-                                                       "Error parsing subject struct");
+      g_prefix_error (&error, "Error getting subject: ");
+      g_dbus_method_invocation_return_gerror (invocation, error);
+      g_error_free (error);
       goto out;
     }
 
-  caller_name = egg_dbus_method_invocation_get_caller (method_invocation);
-  caller = polkit_system_bus_name_new (caller_name);
+  details = polkit_details_new_for_gvariant (details_gvariant);
 
-  details = polkit_details_new_for_hash (real_details->data);
+  CheckAuthData *data;
+  data = g_new0 (CheckAuthData, 1);
 
-  g_object_set_data_full (G_OBJECT (method_invocation), "caller", caller, (GDestroyNotify) g_object_unref);
-  g_object_set_data_full (G_OBJECT (method_invocation), "subject", subject, (GDestroyNotify) g_object_unref);
+  data->server = server;
+  data->caller = g_object_ref (caller);
+  data->subject = g_object_ref (subject);
+  data->invocation = g_object_ref (invocation);
 
-  cancellable = NULL;
-  if (cancellation_id != NULL && strlen (cancellation_id) > 0)
+  if (strlen (cancellation_id) > 0)
     {
-      gchar *full_cancellation_id;
-
-      full_cancellation_id = g_strdup_printf ("%s-%s", caller_name, cancellation_id);
-
-      if (g_hash_table_lookup (server->cancellation_id_to_cancellable, full_cancellation_id) != NULL)
+      data->cancellation_id = g_strdup_printf ("%s-%s",
+                                               g_dbus_method_invocation_get_sender (invocation),
+                                               cancellation_id);
+      if (g_hash_table_lookup (server->cancellation_id_to_check_auth_data, data->cancellation_id) != NULL)
         {
-          egg_dbus_method_invocation_return_error (method_invocation,
-                                                   _POLKIT_ERROR,
-                                                   _POLKIT_ERROR_CANCELLATION_ID_NOT_UNIQUE,
-                                                   "Given cancellation_id %s is already in use for name %s",
-                                                   cancellation_id,
-                                                   caller_name);
-          g_free (full_cancellation_id);
+          gchar *message;
+          message = g_strdup_printf ("Given cancellation_id %s is already in use for name %s",
+                                     cancellation_id,
+                                     g_dbus_method_invocation_get_sender (invocation));
+          /* Don't want this error in our GError enum since libpolkit-gobject-1 users will never see it */
+          g_dbus_method_invocation_return_dbus_error (invocation,
+                                                      "org.freedesktop.PolicyKit1.Error.CancellationIdNotUnique",
+                                                      message);
+          g_free (message);
+          check_auth_data_free (data);
           goto out;
         }
 
-      cancellable = g_cancellable_new ();
-
-      g_hash_table_insert (server->cancellation_id_to_cancellable,
-                           full_cancellation_id,
-                           cancellable);
-
-      g_object_set_data (G_OBJECT (method_invocation), "server", server);
-      g_object_set_data (G_OBJECT (method_invocation), "cancellation-id", full_cancellation_id);
+      data->cancellable = g_cancellable_new ();
+      g_hash_table_insert (server->cancellation_id_to_check_auth_data,
+                           data->cancellation_id,
+                           data);
     }
 
   polkit_backend_authority_check_authorization (server->authority,
@@ -956,43 +967,54 @@ authority_handle_check_authorization (_PolkitAuthority               *instance,
                                                 action_id,
                                                 details,
                                                 flags,
-                                                cancellable,
+                                                data->cancellable,
                                                 check_auth_cb,
-                                                method_invocation);
+                                                data);
+
  out:
+
+  g_variant_unref (subject_gvariant);
+  g_variant_unref (details_gvariant);
+
   if (details != NULL)
     g_object_unref (details);
+  if (subject != NULL)
+    g_object_unref (subject);
 }
 
+/* ---------------------------------------------------------------------------------------------------- */
+
 static void
-authority_handle_cancel_check_authorization (_PolkitAuthority               *instance,
-                                             const gchar                    *cancellation_id,
-                                             EggDBusMethodInvocation        *method_invocation)
+server_handle_cancel_check_authorization (Server                 *server,
+                                          GVariant               *parameters,
+                                          PolkitSubject          *caller,
+                                          GDBusMethodInvocation  *invocation)
 {
-  Server *server = SERVER (instance);
-  GCancellable *cancellable;
-  const gchar *caller_name;
+  CheckAuthData *data;
+  const gchar *cancellation_id;
   gchar *full_cancellation_id;
 
-  caller_name = egg_dbus_method_invocation_get_caller (method_invocation);
+  g_variant_get (parameters, "(&s)", &cancellation_id);
 
-  full_cancellation_id = g_strdup_printf ("%s-%s", caller_name, cancellation_id);
+  full_cancellation_id = g_strdup_printf ("%s-%s",
+                                          g_dbus_method_invocation_get_sender (invocation),
+                                          cancellation_id);
 
-  cancellable = g_hash_table_lookup (server->cancellation_id_to_cancellable, full_cancellation_id);
-  if (cancellable == NULL)
+  data = g_hash_table_lookup (server->cancellation_id_to_check_auth_data, full_cancellation_id);
+  if (data == NULL)
     {
-      egg_dbus_method_invocation_return_error (method_invocation,
-                                               _POLKIT_ERROR,
-                                               _POLKIT_ERROR_FAILED,
-                                               "No such cancellation_id %s for name %s",
-                                               cancellation_id,
-                                               caller_name);
+      g_dbus_method_invocation_return_error (invocation,
+                                             POLKIT_ERROR,
+                                             POLKIT_ERROR_FAILED,
+                                             "No such cancellation_id `%s' for name %s",
+                                             cancellation_id,
+                                             g_dbus_method_invocation_get_sender (invocation));
       goto out;
     }
 
-  g_cancellable_cancel (cancellable);
+  g_cancellable_cancel (data->cancellable);
 
-  _polkit_authority_handle_cancel_check_authorization_finish (method_invocation);
+  g_dbus_method_invocation_return_value (invocation, g_variant_new ("()"));
 
  out:
   g_free (full_cancellation_id);
@@ -1001,31 +1023,34 @@ authority_handle_cancel_check_authorization (_PolkitAuthority               *ins
 /* ---------------------------------------------------------------------------------------------------- */
 
 static void
-authority_handle_register_authentication_agent (_PolkitAuthority               *instance,
-                                                _PolkitSubject                 *real_subject,
-                                                const gchar                    *locale,
-                                                const gchar                    *object_path,
-                                                EggDBusMethodInvocation        *method_invocation)
+server_handle_register_authentication_agent (Server                 *server,
+                                             GVariant               *parameters,
+                                             PolkitSubject          *caller,
+                                             GDBusMethodInvocation  *invocation)
 {
-  Server *server = SERVER (instance);
-  PolkitSubject *caller;
-  PolkitSubject *subject;
+  GVariant *subject_gvariant;
   GError *error;
+  PolkitSubject *subject;
+  const gchar *locale;
+  const gchar *object_path;
 
-  caller = NULL;
+  subject = NULL;
 
-  subject = polkit_subject_new_for_real (real_subject);
+  g_variant_get (parameters,
+                 "(@(sa{sv})&s&s)",
+                 &subject_gvariant,
+                 &locale,
+                 &object_path);
+
+  error = NULL;
+  subject = polkit_subject_new_for_gvariant (subject_gvariant, &error);
   if (subject == NULL)
     {
-      egg_dbus_method_invocation_return_error_literal (method_invocation,
-                                                       _POLKIT_ERROR,
-                                                       _POLKIT_ERROR_FAILED,
-                                                       "Error parsing subject struct");
+      g_prefix_error (&error, "Error getting subject: ");
+      g_dbus_method_invocation_return_gerror (invocation, error);
+      g_error_free (error);
       goto out;
     }
-  g_object_set_data_full (G_OBJECT (method_invocation), "subject", subject, (GDestroyNotify) g_object_unref);
-
-  caller = polkit_system_bus_name_new (egg_dbus_method_invocation_get_caller (method_invocation));
 
   error = NULL;
   if (!polkit_backend_authority_register_authentication_agent (server->authority,
@@ -1035,45 +1060,47 @@ authority_handle_register_authentication_agent (_PolkitAuthority               *
                                                                object_path,
                                                                &error))
     {
-      egg_dbus_method_invocation_return_gerror (method_invocation, error);
+      g_dbus_method_invocation_return_gerror (invocation, error);
       g_error_free (error);
       goto out;
     }
 
-  _polkit_authority_handle_register_authentication_agent_finish (method_invocation);
+  g_dbus_method_invocation_return_value (invocation, g_variant_new ("()"));
 
  out:
-  if (caller != NULL)
-    g_object_unref (caller);
+  if (subject != NULL)
+    g_object_unref (subject);
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
 
 static void
-authority_handle_unregister_authentication_agent (_PolkitAuthority               *instance,
-                                                  _PolkitSubject                 *real_subject,
-                                                  const gchar                    *object_path,
-                                                  EggDBusMethodInvocation        *method_invocation)
+server_handle_unregister_authentication_agent (Server                 *server,
+                                               GVariant               *parameters,
+                                               PolkitSubject          *caller,
+                                               GDBusMethodInvocation  *invocation)
 {
-  Server *server = SERVER (instance);
-  PolkitSubject *caller;
-  PolkitSubject *subject;
+  GVariant *subject_gvariant;
   GError *error;
+  PolkitSubject *subject;
+  const gchar *object_path;
+
+  subject = NULL;
 
-  caller = NULL;
+  g_variant_get (parameters,
+                 "(@(sa{sv})&s)",
+                 &subject_gvariant,
+                 &object_path);
 
-  subject = polkit_subject_new_for_real (real_subject);
+  error = NULL;
+  subject = polkit_subject_new_for_gvariant (subject_gvariant, &error);
   if (subject == NULL)
     {
-      egg_dbus_method_invocation_return_error_literal (method_invocation,
-                                                       _POLKIT_ERROR,
-                                                       _POLKIT_ERROR_FAILED,
-                                                       "Error parsing subject struct");
+      g_prefix_error (&error, "Error getting subject: ");
+      g_dbus_method_invocation_return_gerror (invocation, error);
+      g_error_free (error);
       goto out;
     }
-  g_object_set_data_full (G_OBJECT (method_invocation), "subject", subject, (GDestroyNotify) g_object_unref);
-
-  caller = polkit_system_bus_name_new (egg_dbus_method_invocation_get_caller (method_invocation));
 
   error = NULL;
   if (!polkit_backend_authority_unregister_authentication_agent (server->authority,
@@ -1082,46 +1109,48 @@ authority_handle_unregister_authentication_agent (_PolkitAuthority
                                                                  object_path,
                                                                  &error))
     {
-      egg_dbus_method_invocation_return_gerror (method_invocation, error);
+      g_dbus_method_invocation_return_gerror (invocation, error);
       g_error_free (error);
       goto out;
     }
 
-  _polkit_authority_handle_unregister_authentication_agent_finish (method_invocation);
+  g_dbus_method_invocation_return_value (invocation, g_variant_new ("()"));
 
  out:
-  if (caller != NULL)
-    g_object_unref (caller);
+  if (subject != NULL)
+    g_object_unref (subject);
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
 
 static void
-authority_handle_authentication_agent_response (_PolkitAuthority               *instance,
-                                                const gchar                    *cookie,
-                                                _PolkitIdentity                *real_identity,
-                                                EggDBusMethodInvocation        *method_invocation)
+server_handle_authentication_agent_response (Server                 *server,
+                                             GVariant               *parameters,
+                                             PolkitSubject          *caller,
+                                             GDBusMethodInvocation  *invocation)
 {
-  Server *server = SERVER (instance);
-  PolkitSubject *caller;
+  const gchar *cookie;
+  GVariant *identity_gvariant;
   PolkitIdentity *identity;
   GError *error;
 
-  caller = NULL;
   identity = NULL;
 
-  identity = polkit_identity_new_for_real (real_identity);
+  g_variant_get (parameters,
+                 "(&s@(sa{sv}))",
+                 &cookie,
+                 &identity_gvariant);
+
+  error = NULL;
+  identity = polkit_identity_new_for_gvariant (identity_gvariant, &error);
   if (identity == NULL)
     {
-      egg_dbus_method_invocation_return_error_literal (method_invocation,
-                                                       _POLKIT_ERROR,
-                                                       _POLKIT_ERROR_FAILED,
-                                                       "Error parsing identity struct");
+      g_prefix_error (&error, "Error getting identity: ");
+      g_dbus_method_invocation_return_gerror (invocation, error);
+      g_error_free (error);
       goto out;
     }
 
-  caller = polkit_system_bus_name_new (egg_dbus_method_invocation_get_caller (method_invocation));
-
   error = NULL;
   if (!polkit_backend_authority_authentication_agent_response (server->authority,
                                                                caller,
@@ -1129,17 +1158,14 @@ authority_handle_authentication_agent_response (_PolkitAuthority               *
                                                                identity,
                                                                &error))
     {
-      egg_dbus_method_invocation_return_gerror (method_invocation, error);
+      g_dbus_method_invocation_return_gerror (invocation, error);
       g_error_free (error);
       goto out;
     }
 
-  _polkit_authority_handle_authentication_agent_response_finish (method_invocation);
+  g_dbus_method_invocation_return_value (invocation, g_variant_new ("()"));
 
  out:
-  if (caller != NULL)
-    g_object_unref (caller);
-
   if (identity != NULL)
     g_object_unref (identity);
 }
@@ -1147,265 +1173,286 @@ authority_handle_authentication_agent_response (_PolkitAuthority               *
 /* ---------------------------------------------------------------------------------------------------- */
 
 static void
-authority_handle_enumerate_temporary_authorizations (_PolkitAuthority        *instance,
-                                                     _PolkitSubject          *real_subject,
-                                                     EggDBusMethodInvocation *method_invocation)
+server_handle_enumerate_temporary_authorizations (Server                 *server,
+                                                  GVariant               *parameters,
+                                                  PolkitSubject          *caller,
+                                                  GDBusMethodInvocation  *invocation)
 {
-  Server *server = SERVER (instance);
-  PolkitSubject *caller;
-  EggDBusArraySeq *array;
+  GVariant *subject_gvariant;
   GError *error;
-  GList *temporary_authorizations;
-  GList *l;
   PolkitSubject *subject;
+  GList *authorizations;
+  GList *l;
+  GVariantBuilder builder;
 
-  error = NULL;
-  caller = NULL;
-  temporary_authorizations = NULL;
+  subject = NULL;
+
+  g_variant_get (parameters,
+                 "(@(sa{sv}))",
+                 &subject_gvariant);
 
-  subject = polkit_subject_new_for_real (real_subject);
+  error = NULL;
+  subject = polkit_subject_new_for_gvariant (subject_gvariant, &error);
   if (subject == NULL)
     {
-      egg_dbus_method_invocation_return_error_literal (method_invocation,
-                                                       _POLKIT_ERROR,
-                                                       _POLKIT_ERROR_FAILED,
-                                                       "Error parsing subject struct");
+      g_prefix_error (&error, "Error getting subject: ");
+      g_dbus_method_invocation_return_gerror (invocation, error);
+      g_error_free (error);
       goto out;
     }
-  g_object_set_data_full (G_OBJECT (method_invocation), "subject", subject, (GDestroyNotify) g_object_unref);
-
-  caller = polkit_system_bus_name_new (egg_dbus_method_invocation_get_caller (method_invocation));
 
-  temporary_authorizations = polkit_backend_authority_enumerate_temporary_authorizations (server->authority,
-                                                                                          caller,
-                                                                                          subject,
-                                                                                          &error);
+  error = NULL;
+  authorizations = polkit_backend_authority_enumerate_temporary_authorizations (server->authority,
+                                                                                caller,
+                                                                                subject,
+                                                                                &error);
   if (error != NULL)
     {
-      egg_dbus_method_invocation_return_gerror (method_invocation, error);
+      g_dbus_method_invocation_return_gerror (invocation, error);
       g_error_free (error);
       goto out;
     }
 
-  array = egg_dbus_array_seq_new (G_TYPE_OBJECT, //_POLKIT_TYPE_TEMPORARY_AUTHORIZATION,
-                                  (GDestroyNotify) g_object_unref,
-                                  NULL,
-                                  NULL);
-
-  for (l = temporary_authorizations; l != NULL; l = l->next)
+  g_variant_builder_init (&builder, G_VARIANT_TYPE ("a(ss(sa{sv})tt)"));
+  for (l = authorizations; l != NULL; l = l->next)
     {
-      PolkitTemporaryAuthorization *ta = POLKIT_TEMPORARY_AUTHORIZATION (l->data);
-      _PolkitTemporaryAuthorization *real;
-
-      real = polkit_temporary_authorization_get_real (ta);
-      egg_dbus_array_seq_add (array, real);
+      PolkitTemporaryAuthorization *a = POLKIT_TEMPORARY_AUTHORIZATION (l->data);
+      GVariant *value;
+      value = polkit_temporary_authorization_to_gvariant (a);
+      g_variant_ref_sink (value);
+      g_variant_builder_add_value (&builder, value);
+      g_variant_unref (value);
     }
-
-  _polkit_authority_handle_enumerate_temporary_authorizations_finish (method_invocation, array);
-
-  g_object_unref (array);
+  g_list_foreach (authorizations, (GFunc) g_object_unref, NULL);
+  g_list_free (authorizations);
+  g_dbus_method_invocation_return_value (invocation, g_variant_new ("(a(ss(sa{sv})tt))", &builder));
 
  out:
-  g_list_foreach (temporary_authorizations, (GFunc) g_object_unref, NULL);
-  g_list_free (temporary_authorizations);
-  if (caller != NULL)
-    g_object_unref (caller);
+  if (subject != NULL)
+    g_object_unref (subject);
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
 
 static void
-authority_handle_revoke_temporary_authorizations (_PolkitAuthority        *instance,
-                                                  _PolkitSubject          *real_subject,
-                                                  EggDBusMethodInvocation *method_invocation)
+server_handle_revoke_temporary_authorizations (Server                 *server,
+                                               GVariant               *parameters,
+                                               PolkitSubject          *caller,
+                                               GDBusMethodInvocation  *invocation)
 {
-  Server *server = SERVER (instance);
-  PolkitSubject *caller;
+  GVariant *subject_gvariant;
   GError *error;
   PolkitSubject *subject;
 
-  error = NULL;
-  caller = NULL;
+  subject = NULL;
+
+  g_variant_get (parameters,
+                 "(@(sa{sv}))",
+                 &subject_gvariant);
 
-  subject = polkit_subject_new_for_real (real_subject);
+  error = NULL;
+  subject = polkit_subject_new_for_gvariant (subject_gvariant, &error);
   if (subject == NULL)
     {
-      egg_dbus_method_invocation_return_error_literal (method_invocation,
-                                                       _POLKIT_ERROR,
-                                                       _POLKIT_ERROR_FAILED,
-                                                       "Error parsing subject struct");
+      g_prefix_error (&error, "Error getting subject: ");
+      g_dbus_method_invocation_return_gerror (invocation, error);
+      g_error_free (error);
       goto out;
     }
-  g_object_set_data_full (G_OBJECT (method_invocation), "subject", subject, (GDestroyNotify) g_object_unref);
-
-  caller = polkit_system_bus_name_new (egg_dbus_method_invocation_get_caller (method_invocation));
 
-  polkit_backend_authority_revoke_temporary_authorizations (server->authority,
-                                                            caller,
-                                                            subject,
-                                                            &error);
-  if (error != NULL)
+  error = NULL;
+  if (!polkit_backend_authority_revoke_temporary_authorizations (server->authority,
+                                                                 caller,
+                                                                 subject,
+                                                                 &error))
     {
-      egg_dbus_method_invocation_return_gerror (method_invocation, error);
+      g_dbus_method_invocation_return_gerror (invocation, error);
       g_error_free (error);
       goto out;
     }
 
-  _polkit_authority_handle_revoke_temporary_authorizations_finish (method_invocation);
+  g_dbus_method_invocation_return_value (invocation, g_variant_new ("()"));
 
  out:
-  if (caller != NULL)
-    g_object_unref (caller);
+  if (subject != NULL)
+    g_object_unref (subject);
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
 
 static void
-authority_handle_revoke_temporary_authorization_by_id (_PolkitAuthority        *instance,
-                                                       const gchar             *id,
-                                                       EggDBusMethodInvocation *method_invocation)
+server_handle_revoke_temporary_authorization_by_id (Server                 *server,
+                                                    GVariant               *parameters,
+                                                    PolkitSubject          *caller,
+                                                    GDBusMethodInvocation  *invocation)
 {
-  Server *server = SERVER (instance);
   GError *error;
-  PolkitSubject *caller;
+  const gchar *id;
 
-  error = NULL;
+  g_variant_get (parameters,
+                 "(@s)",
+                 &id);
 
-  caller = polkit_system_bus_name_new (egg_dbus_method_invocation_get_caller (method_invocation));
-
-  polkit_backend_authority_revoke_temporary_authorization_by_id (server->authority,
-                                                                 caller,
-                                                                 id,
-                                                                 &error);
-  if (error != NULL)
+  error = NULL;
+  if (!polkit_backend_authority_revoke_temporary_authorization_by_id (server->authority,
+                                                                      caller,
+                                                                      id,
+                                                                      &error))
     {
-      egg_dbus_method_invocation_return_gerror (method_invocation, error);
+      g_dbus_method_invocation_return_gerror (invocation, error);
       g_error_free (error);
       goto out;
     }
 
-  _polkit_authority_handle_revoke_temporary_authorization_by_id_finish (method_invocation);
+  g_dbus_method_invocation_return_value (invocation, g_variant_new ("()"));
 
  out:
-  g_object_unref (caller);
+  ;
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
 
 static void
-add_lockdown_cb (GObject      *source_object,
-                 GAsyncResult *res,
-                 gpointer      user_data)
+server_handle_add_lockdown_for_action (Server                 *server,
+                                       GVariant               *parameters,
+                                       PolkitSubject          *caller,
+                                       GDBusMethodInvocation  *invocation)
 {
-  EggDBusMethodInvocation *method_invocation = EGG_DBUS_METHOD_INVOCATION (user_data);
-  GError *error;
+  /* TODO: probably want to nuke this method so don't implement now */
+  g_dbus_method_invocation_return_error (invocation,
+                                         POLKIT_ERROR,
+                                         POLKIT_ERROR_NOT_SUPPORTED,
+                                         "Operation is not supported");
+}
 
-  error = NULL;
-  polkit_backend_authority_add_lockdown_for_action_finish (POLKIT_BACKEND_AUTHORITY (source_object),
-                                                           res,
-                                                           &error);
+/* ---------------------------------------------------------------------------------------------------- */
 
-  if (error != NULL)
-    {
-      egg_dbus_method_invocation_return_gerror (method_invocation, error);
-      g_error_free (error);
-    }
-  else
-    {
-      _polkit_authority_handle_add_lockdown_for_action_finish (method_invocation);
-    }
+static void
+server_handle_remove_lockdown_for_action (Server                 *server,
+                                          GVariant               *parameters,
+                                          PolkitSubject          *caller,
+                                          GDBusMethodInvocation  *invocation)
+{
+  /* TODO: probably want to nuke this method so don't implement now */
+  g_dbus_method_invocation_return_error (invocation,
+                                         POLKIT_ERROR,
+                                         POLKIT_ERROR_NOT_SUPPORTED,
+                                         "Operation is not supported");
 }
 
+/* ---------------------------------------------------------------------------------------------------- */
+
 static void
-authority_handle_add_lockdown_for_action (_PolkitAuthority               *instance,
-                                          const gchar                    *action_id,
-                                          EggDBusMethodInvocation        *method_invocation)
+server_handle_method_call (GDBusConnection        *connection,
+                           const gchar            *sender,
+                           const gchar            *object_path,
+                           const gchar            *interface_name,
+                           const gchar            *method_name,
+                           GVariant               *parameters,
+                           GDBusMethodInvocation  *invocation,
+                           gpointer                user_data)
 {
-  Server *server = SERVER (instance);
-  const gchar *caller_name;
+  Server *server = user_data;
   PolkitSubject *caller;
 
-  caller_name = egg_dbus_method_invocation_get_caller (method_invocation);
-  caller = polkit_system_bus_name_new (caller_name);
+  caller = polkit_system_bus_name_new (g_dbus_method_invocation_get_sender (invocation));
+
+  if (g_strcmp0 (method_name, "EnumerateActions") == 0)
+    server_handle_enumerate_actions (server, parameters, caller, invocation);
+  else if (g_strcmp0 (method_name, "CheckAuthorization") == 0)
+    server_handle_check_authorization (server, parameters, caller, invocation);
+  else if (g_strcmp0 (method_name, "CancelCheckAuthorization") == 0)
+    server_handle_cancel_check_authorization (server, parameters, caller, invocation);
+  else if (g_strcmp0 (method_name, "RegisterAuthenticationAgent") == 0)
+    server_handle_register_authentication_agent (server, parameters, caller, invocation);
+  else if (g_strcmp0 (method_name, "UnregisterAuthenticationAgent") == 0)
+    server_handle_unregister_authentication_agent (server, parameters, caller, invocation);
+  else if (g_strcmp0 (method_name, "AuthenticationAgentResponse") == 0)
+    server_handle_authentication_agent_response (server, parameters, caller, invocation);
+  else if (g_strcmp0 (method_name, "EnumerateTemporaryAuthorizations") == 0)
+    server_handle_enumerate_temporary_authorizations (server, parameters, caller, invocation);
+  else if (g_strcmp0 (method_name, "RevokeTemporaryAuthorizations") == 0)
+    server_handle_revoke_temporary_authorizations (server, parameters, caller, invocation);
+  else if (g_strcmp0 (method_name, "RevokeTemporaryAuthorizationById") == 0)
+    server_handle_revoke_temporary_authorization_by_id (server, parameters, caller, invocation);
+  else if (g_strcmp0 (method_name, "AddLockdownForAction") == 0)
+    server_handle_add_lockdown_for_action (server, parameters, caller, invocation);
+  else if (g_strcmp0 (method_name, "RemoveLockdownForAction") == 0)
+    server_handle_remove_lockdown_for_action (server, parameters, caller, invocation);
+  else
+    g_assert_not_reached ();
 
-  polkit_backend_authority_add_lockdown_for_action (server->authority,
-                                                    caller,
-                                                    action_id,
-                                                    add_lockdown_cb,
-                                                    method_invocation);
+  g_object_unref (caller);
 }
 
-/* ---------------------------------------------------------------------------------------------------- */
-
-static void
-remove_lockdown_cb (GObject      *source_object,
-                    GAsyncResult *res,
-                    gpointer      user_data)
+static GVariant *
+server_handle_get_property (GDBusConnection  *connection,
+                            const gchar      *sender,
+                            const gchar      *object_path,
+                            const gchar      *interface_name,
+                            const gchar      *property_name,
+                            GError          **error,
+                            gpointer          user_data)
 {
-  EggDBusMethodInvocation *method_invocation = EGG_DBUS_METHOD_INVOCATION (user_data);
-  GError *error;
+  Server *server = user_data;
+  GVariant *result;
 
-  error = NULL;
-  polkit_backend_authority_remove_lockdown_for_action_finish (POLKIT_BACKEND_AUTHORITY (source_object),
-                                                              res,
-                                                              &error);
+  result = NULL;
 
-  if (error != NULL)
+  if (g_strcmp0 (property_name, "BackendName") == 0)
     {
-      egg_dbus_method_invocation_return_gerror (method_invocation, error);
-      g_error_free (error);
+      result = g_variant_new_string (polkit_backend_authority_get_name (server->authority));
     }
-  else
+  else if (g_strcmp0 (property_name, "BackendVersion") == 0)
     {
-      _polkit_authority_handle_remove_lockdown_for_action_finish (method_invocation);
+      result = g_variant_new_string (polkit_backend_authority_get_version (server->authority));
     }
-}
-
-static void
-authority_handle_remove_lockdown_for_action (_PolkitAuthority               *instance,
-                                             const gchar                    *action_id,
-                                             EggDBusMethodInvocation        *method_invocation)
-{
-  Server *server = SERVER (instance);
-  const gchar *caller_name;
-  PolkitSubject *caller;
-
-  caller_name = egg_dbus_method_invocation_get_caller (method_invocation);
-  caller = polkit_system_bus_name_new (caller_name);
+  else if (g_strcmp0 (property_name, "BackendFeatures") == 0)
+    {
+      result = g_variant_new_uint32 (polkit_backend_authority_get_features (server->authority));
+    }
+  else
+    g_assert_not_reached ();
 
-  polkit_backend_authority_remove_lockdown_for_action (server->authority,
-                                                       caller,
-                                                       action_id,
-                                                       remove_lockdown_cb,
-                                                       method_invocation);
+  return result;
 }
 
 /* ---------------------------------------------------------------------------------------------------- */
 
 static void
-authority_iface_init (_PolkitAuthorityIface *authority_iface)
+server_on_name_owner_changed_signal (GDBusConnection *connection,
+                                     const gchar     *sender_name,
+                                     const gchar     *object_path,
+                                     const gchar     *interface_name,
+                                     const gchar     *signal_name,
+                                     GVariant        *parameters,
+                                     gpointer         user_data)
 {
-  authority_iface->handle_enumerate_actions                    = authority_handle_enumerate_actions;
-  authority_iface->handle_check_authorization                  = authority_handle_check_authorization;
-  authority_iface->handle_cancel_check_authorization           = authority_handle_cancel_check_authorization;
-  authority_iface->handle_register_authentication_agent        = authority_handle_register_authentication_agent;
-  authority_iface->handle_unregister_authentication_agent      = authority_handle_unregister_authentication_agent;
-  authority_iface->handle_authentication_agent_response        = authority_handle_authentication_agent_response;
-  authority_iface->handle_enumerate_temporary_authorizations   = authority_handle_enumerate_temporary_authorizations;
-  authority_iface->handle_revoke_temporary_authorizations      = authority_handle_revoke_temporary_authorizations;
-  authority_iface->handle_revoke_temporary_authorization_by_id = authority_handle_revoke_temporary_authorization_by_id;
-  authority_iface->handle_add_lockdown_for_action              = authority_handle_add_lockdown_for_action;
-  authority_iface->handle_remove_lockdown_for_action              = authority_handle_remove_lockdown_for_action;
+  Server *server = user_data;
+  const gchar *name;
+  const gchar *old_owner;
+  const gchar *new_owner;
+
+  g_variant_get (parameters,
+                 "(&s&s&s)",
+                 &name,
+                 &old_owner,
+                 &new_owner);
+
+  polkit_backend_authority_system_bus_name_owner_changed (server->authority,
+                                                          name,
+                                                          old_owner,
+                                                          new_owner);
 }
 
-static void
-authority_died (gpointer user_data,
-                GObject *where_the_object_was)
-{
-  Server *server = SERVER (user_data);
+/* ---------------------------------------------------------------------------------------------------- */
 
-  g_object_unref (server);
-}
+static const GDBusInterfaceVTable server_vtable =
+{
+  server_handle_method_call,
+  server_handle_get_property,
+  NULL, /* server_handle_set_property */
+};
 
 /**
  * polkit_backend_register_authority:
@@ -1425,70 +1472,98 @@ polkit_backend_register_authority (PolkitBackendAuthority   *authority,
                                    GError                  **error)
 {
   Server *server;
-  EggDBusRequestNameReply rn_ret;
 
-  server = SERVER (g_object_new (TYPE_SERVER, NULL));
+  server = g_new0 (Server, 1);
+
+  server->cancellation_id_to_check_auth_data = g_hash_table_new (g_str_hash, g_str_equal);
 
-  server->system_bus = egg_dbus_connection_get_for_bus (EGG_DBUS_BUS_TYPE_SYSTEM);
+  server->system_bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, error);
+  if (server->system_bus == NULL)
+    goto error;
 
   server->well_known_name = g_strdup (well_known_name);
+  server->object_path = g_strdup (object_path);
+
+  server->introspection_info = g_dbus_node_info_new_for_xml (server_introspection_data, error);
+  if (server->introspection_info == NULL)
+      goto error;
+
+  server->authority_registration_id = g_dbus_connection_register_object (server->system_bus,
+                                                                         object_path,
+                                                                         g_dbus_node_info_lookup_interface (server->introspection_info, "org.freedesktop.PolicyKit1.Authority"),
+                                                                         &server_vtable,
+                                                                         server,
+                                                                         NULL,
+                                                                         error);
+  if (server->authority_registration_id == 0)
+    {
+      goto error;
+    }
 
   if (well_known_name != NULL)
     {
-      if (!egg_dbus_bus_request_name_sync (egg_dbus_connection_get_bus (server->system_bus),
-                                           EGG_DBUS_CALL_FLAGS_NONE,
-                                           well_known_name,
-                                           EGG_DBUS_REQUEST_NAME_FLAGS_NONE,
-                                           &rn_ret,
-                                           NULL,
-                                           error))
+      GVariant *result;
+      guint32 request_name_result;
+
+      /* TODO: use g_bus_own_name() instead */
+      result = g_dbus_connection_call_sync (server->system_bus,
+                                            "org.freedesktop.DBus",  /* name */
+                                            "/org/freedesktop/DBus", /* path */
+                                            "org.freedesktop.DBus",  /* interface */
+                                            "RequestName",
+                                            g_variant_new ("(su)", well_known_name, 0),
+                                            G_VARIANT_TYPE ("(u)"),
+                                            G_DBUS_CALL_FLAGS_NONE,
+                                            -1,
+                                            NULL, /* GCancellable */
+                                            error);
+      if (result == NULL)
         {
+          g_prefix_error (error,
+                          "Could not become primary name owner for `%s'. RequestName() failed with: ",
+                          well_known_name);
           goto error;
         }
-
-      if (rn_ret != EGG_DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER)
+      g_variant_get (result, "(u)", &request_name_result);
+      g_variant_unref (result);
+      if (request_name_result != 1)
         {
           g_set_error (error,
                        POLKIT_ERROR,
                        POLKIT_ERROR_FAILED,
-                       "Could not become primary name owner for %s",
-                       well_known_name);
+                       "Could not become primary name owner for `%s'. RequestName returned %d",
+                       well_known_name,
+                       request_name_result);
           goto error;
         }
     }
 
-  server->authority = authority;
-
-  /* TODO: it's a bit wasteful listening to all name-owner-changed signals... needs to be optimized */
-  server->bus_proxy = egg_dbus_connection_get_object_proxy (server->system_bus,
-                                                            "org.freedesktop.DBus",
-                                                            "/org/freedesktop/DBus");
-
-  server->bus = EGG_DBUS_QUERY_INTERFACE_BUS (server->bus_proxy);
+  server->name_owner_changed_signal_id =
+    g_dbus_connection_signal_subscribe (server->system_bus,
+                                        "org.freedesktop.DBus",   /* sender */
+                                        "org.freedesktop.DBus",   /* interface */
+                                        "NameOwnerChanged",       /* member */
+                                        "/org/freedesktop/DBus",  /* path */
+                                        NULL,                     /* arg0 */
+                                        G_DBUS_SIGNAL_FLAGS_NONE,
+                                        server_on_name_owner_changed_signal,
+                                        server,
+                                        NULL); /* GDestroyNotify */
 
-  server->name_owner_changed_id = g_signal_connect (server->bus,
-                                                    "name-owner-changed",
-                                                    (GCallback) name_owner_changed,
-                                                    server);
+  server->authority = authority;
 
   server->authority_changed_id = g_signal_connect (server->authority,
                                                    "changed",
-                                                   (GCallback) authority_changed,
+                                                   G_CALLBACK (on_authority_changed),
                                                    server);
 
-  egg_dbus_connection_register_interface (server->system_bus,
-                                          object_path,
-                                          _POLKIT_TYPE_AUTHORITY,
-                                          G_OBJECT (server),
-                                          G_TYPE_INVALID);
-
   /* take a weak ref and kill server when listener dies */
   g_object_weak_ref (G_OBJECT (server->authority), authority_died, server);
 
   return TRUE;
 
  error:
-  g_object_unref (server);
+  server_free (server);
   return FALSE;
 }
 
diff --git a/src/polkitd/main.c b/src/polkitd/main.c
index 432d02b..ff39dd9 100644
--- a/src/polkitd/main.c
+++ b/src/polkitd/main.c
@@ -51,7 +51,7 @@ main (int argc, char **argv)
                                           "/org/freedesktop/PolicyKit1/Authority",
                                           &error))
     {
-      g_printerr ("Error registering authority: %s", error->message);
+      g_printerr ("Error registering authority: %s\n", error->message);
       g_error_free (error);
       goto out;
     }


More information about the hal-commit mailing list