[glib/gdbus-merge] Update an example to the latest auth observer api



commit 7c0196f0267aa77c80fb85320ef9583c7fc64ad7
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed May 12 13:01:40 2010 -0400

    Update an example to the latest auth observer api

 gio/gdbusauthobserver.c |   17 ++++++++++-------
 gio/gdbusconnection.c   |    2 +-
 2 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/gio/gdbusauthobserver.c b/gio/gdbusauthobserver.c
index 6883058..948659b 100644
--- a/gio/gdbusauthobserver.c
+++ b/gio/gdbusauthobserver.c
@@ -51,12 +51,18 @@
  *                             GCredentials      *credentials,
  *                             gpointer           user_data)
  * {
+ *   GCredentials *me;
  *   gboolean deny;
+ *
  *   deny = TRUE;
+ *   me = g_credentials_new ();
+ *
  *   if (credentials != NULL &&
- *       g_credentials_has_unix_user (credentials) &&
- *       g_credentials_get_unix_user (credentials) == getuid ())
+ *       !g_credentials_is_same_user (credentials, me))
  *     deny = FALSE;
+ *
+ *   g_object_unref (me);
+ *
  *   return deny;
  * }
  *
@@ -114,10 +120,7 @@ G_DEFINE_TYPE (GDBusAuthObserver, g_dbus_auth_observer, G_TYPE_OBJECT);
 static void
 g_dbus_auth_observer_finalize (GObject *object)
 {
-  //GDBusAuthObserver *observer = G_DBUS_AUTH_OBSERVER (object);
-
-  if (G_OBJECT_CLASS (g_dbus_auth_observer_parent_class)->finalize != NULL)
-    G_OBJECT_CLASS (g_dbus_auth_observer_parent_class)->finalize (object);
+  G_OBJECT_CLASS (g_dbus_auth_observer_parent_class)->finalize (object);
 }
 
 static gboolean
@@ -133,7 +136,7 @@ g_dbus_auth_observer_class_init (GDBusAuthObserverClass *klass)
 {
   GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
 
-  gobject_class->finalize     = g_dbus_auth_observer_finalize;
+  gobject_class->finalize = g_dbus_auth_observer_finalize;
 
   klass->deny_authenticated_peer = g_dbus_auth_observer_deny_authenticated_peer_real;
 
diff --git a/gio/gdbusconnection.c b/gio/gdbusconnection.c
index e6af1a0..ff425ab 100644
--- a/gio/gdbusconnection.c
+++ b/gio/gdbusconnection.c
@@ -103,7 +103,7 @@
  *
  *  - GDBusProxy subclass example
  *
- *  - Update GDBusAuthObserver (is_same_user(), s/deny/authorize/)
+ *  - Update GDBusAuthObserver (s/deny/authorize/)
  */
 
 #include "config.h"



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