[PolicyKit-gnome] Port from dbus-glib to gdbus



commit a3f1570332fc5bdcf1aed60d84d87dbadb67d267
Author: David Zeuthen <davidz redhat com>
Date:   Mon Aug 9 16:31:32 2010 -0400

    Port from dbus-glib to gdbus
    
    Signed-off-by: David Zeuthen <davidz redhat com>

 NEWS                  |    3 ++-
 configure.ac          |    4 ----
 polkitgtk/Makefile.am |    2 --
 polkitgtk/example.c   |   21 +++++++++++++--------
 4 files changed, 15 insertions(+), 15 deletions(-)
---
diff --git a/NEWS b/NEWS
index 6c1acfa..3aeebbf 100644
--- a/NEWS
+++ b/NEWS
@@ -14,12 +14,13 @@ Changes since 0.96:
 Andre Klapper (1):
       Compile with -DGSEAL_ENABLE. Fixes bug 616386.
 
-David Zeuthen (5):
+David Zeuthen (6):
       Fix build
       Remove lock down functionality
       Require polkit 0.97
       Update NEWS for release
       Post-release version bump to 0.97
+      Port from dbus-glib to gdbus
 
 Martin Pitt (1):
       Hide the agent autostart desktop file
diff --git a/configure.ac b/configure.ac
index 0e0bd91..f4611ca 100644
--- a/configure.ac
+++ b/configure.ac
@@ -134,10 +134,6 @@ PKG_CHECK_MODULES(POLKIT_GOBJECT, polkit-gobject-1 >= $POLKIT_GOBJECT_REQUIRED)
 AC_SUBST(POLKIT_GOBJECT_CFLAGS)
 AC_SUBST(POLKIT_GOBJECT_LIBS)
 
-PKG_CHECK_MODULES(DBUS_GLIB, dbus-glib-1)
-AC_SUBST(DBUS_GLIB_CFLAGS)
-AC_SUBST(DBUS_GLIB_LIBS)
-
 AC_ARG_ENABLE([examples],
               AC_HELP_STRING([--enable-examples], [Build the example programs]),,
               [enable_examples=yes])
diff --git a/polkitgtk/Makefile.am b/polkitgtk/Makefile.am
index 3b8ea25..4daadee 100644
--- a/polkitgtk/Makefile.am
+++ b/polkitgtk/Makefile.am
@@ -56,7 +56,6 @@ example_CFLAGS = 					\
 	-I$(top_srcdir)					\
 	-I$(top_builddir)				\
 	$(POLKIT_GOBJECT_CFLAGS)			\
-	$(DBUS_GLIB_CFLAGS)				\
 	$(GTK_CFLAGS)					\
 	$(WARN_CFLAGS)					\
 	$(AM_CFLAGS)					\
@@ -64,7 +63,6 @@ example_CFLAGS = 					\
 
 example_LDADD = 					\
 	$(POLKIT_GOBJECT_LIBS)				\
-	$(DBUS_GLIB_LIBS)				\
 	$(GTK_LIBS)					\
 	$(INTLLIBS)					\
 	libpolkit-gtk-1.la				\
diff --git a/polkitgtk/example.c b/polkitgtk/example.c
index 355ba53..882a26b 100644
--- a/polkitgtk/example.c
+++ b/polkitgtk/example.c
@@ -19,8 +19,6 @@
  * Author: David Zeuthen <davidz redhat com>
  */
 
-#include <dbus/dbus-glib.h>
-#include <dbus/dbus-glib-lowlevel.h>
 #include <polkitgtk/polkitgtk.h>
 
 static PolkitAuthority *authority = NULL;
@@ -100,7 +98,7 @@ on_button_changed (PolkitLockButton *button,
 int
 main (int argc, char *argv[])
 {
-  DBusGConnection *bus;
+  GDBusConnection *bus;
   GtkWidget *window;
   GtkWidget *label;
   GtkWidget *button;
@@ -119,11 +117,10 @@ main (int argc, char *argv[])
   action_id = argv[1];
 
   error = NULL;
-  bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
+  bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL /* GCancellable* */, &error);
   if (bus == NULL)
     {
-      g_printerr ("Failed connecting to system bus: %s\n",
-                  error->message);
+      g_printerr ("Failed connecting to system bus: %s\n", error->message);
       g_error_free (error);
       goto out;
     }
@@ -165,10 +162,18 @@ main (int argc, char *argv[])
   gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
 
 
-  system_bus_name_subject = polkit_system_bus_name_new (dbus_bus_get_unique_name (dbus_g_connection_get_connection (bus)));
+  system_bus_name_subject = polkit_system_bus_name_new (g_dbus_connection_get_unique_name (bus));
   unix_process_subject = polkit_unix_process_new (getpid ());
 
-  authority = polkit_authority_get ();
+  error = NULL;
+  authority = polkit_authority_get_sync (NULL /* GCancellable* */, &error);
+  if (authority == NULL)
+    {
+      g_printerr ("Failed getting the authority: %s\n", error->message);
+      g_error_free (error);
+      goto out;
+    }
+
   g_debug ("backend: name=`%s' version=`%s' features=%d",
            polkit_authority_get_backend_name (authority),
            polkit_authority_get_backend_version (authority),



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