PolicyKit: Branch 'gdbus'

David Zeuthen david at kemper.freedesktop.org
Fri Jul 30 08:10:40 PDT 2010


 configure.ac                                          |    6 
 src/polkit/Makefile.am                                |   38 --
 src/polkit/polkitactiondescription.c                  |  197 +++++------
 src/polkit/polkitauthorizationresult.c                |   66 ---
 src/polkit/polkitdetails.c                            |    9 
 src/polkit/polkitidentity.c                           |   74 ----
 src/polkit/polkitprivate.h                            |   34 --
 src/polkit/polkitsubject.c                            |  101 -----
 src/polkit/polkitsystembusname.c                      |  190 ++++-------
 src/polkit/polkittemporaryauthorization.c             |   86 +----
 src/polkit/polkitunixsession.c                        |  305 ++++--------------
 src/polkitagent/Makefile.am                           |    4 
 src/polkitbackend/Makefile.am                         |    4 
 src/polkitbackend/polkitbackendactionpool.c           |   38 --
 src/polkitbackend/polkitbackendinteractiveauthority.c |    2 
 src/polkitbackend/polkitbackendprivate.h              |    2 
 16 files changed, 312 insertions(+), 844 deletions(-)

New commits:
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 */


More information about the hal-commit mailing list