[glib] GDBusAuthObserver: Fix docs
- From: David Zeuthen <davidz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] GDBusAuthObserver: Fix docs
- Date: Tue, 20 Jul 2010 20:44:42 +0000 (UTC)
commit 9b0a08449fd966aff7a6c164c9913b01106a37cc
Author: David Zeuthen <davidz redhat com>
Date: Tue Jul 20 15:02:36 2010 -0400
GDBusAuthObserver: Fix docs
Signed-off-by: David Zeuthen <davidz redhat com>
gio/gdbusauthobserver.c | 53 +++++++++-------------------------------------
1 files changed, 11 insertions(+), 42 deletions(-)
---
diff --git a/gio/gdbusauthobserver.c b/gio/gdbusauthobserver.c
index f1971c0..46af595 100644
--- a/gio/gdbusauthobserver.c
+++ b/gio/gdbusauthobserver.c
@@ -42,7 +42,8 @@
* in the future
*
* For example, if you only want to allow D-Bus connections from
- * processes owned by the same uid as the server, you would do this:
+ * processes owned by the same uid as the server, you would use a
+ * signal handler like the following:
* <example id="auth-observer"><title>Controlling Authentication</title><programlisting>
* static gboolean
* on_authorize_authenticated_peer (GDBusAuthObserver *observer,
@@ -50,52 +51,20 @@
* GCredentials *credentials,
* gpointer user_data)
* {
- * GCredentials *me;
* gboolean authorized;
*
* authorized = FALSE;
- * me = g_credentials_new ();
- *
- * if (credentials != NULL &&
- * !g_credentials_is_same_user (credentials, me))
- * authorized = TRUE;
- *
- * g_object_unref (me);
+ * if (credentials != NULL)
+ * {
+ * GCredentials *own_credentials;
+ * own_credentials = g_credentials_new ();
+ * if (g_credentials_is_same_user (credentials, own_credentials, NULL))
+ * authorized = TRUE;
+ * g_object_unref (own_credentials);
+ * }
*
* return authorized;
* }
- *
- * static gboolean
- * on_new_connection (GDBusServer *server,
- * GDBusConnection *connection,
- * gpointer user_data)
- * {
- * /<!-- -->* Guaranteed here that @connection is from a process owned by the same user *<!-- -->/
- * }
- *
- * [...]
- *
- * GDBusAuthObserver *observer;
- * GDBusServer *server;
- * GError *error;
- *
- * error = NULL;
- * observer = g_dbus_auth_observer_new ();
- * server = g_dbus_server_new_sync ("unix:tmpdir=/tmp/my-app-name",
- * G_DBUS_SERVER_FLAGS_NONE,
- * observer,
- * NULL, /<!-- -->* GCancellable *<!-- -->/
- * &error);
- * g_signal_connect (observer,
- * "authorize-authenticated-peer",
- * G_CALLBACK (on_authorize_authenticated_peer),
- * NULL);
- * g_signal_connect (server,
- * "new-connection",
- * G_CALLBACK (on_new_connection),
- * NULL);
- * g_object_unref (observer);
- * g_dbus_server_start (server);
* </programlisting></example>
*/
@@ -243,7 +212,7 @@ g_dbus_auth_observer_new (void)
*
* Emits the #GDBusAuthObserver::authorize-authenticated-peer signal on @observer.
*
- * Returns: %TRUE if the peer should be denied, %FALSE otherwise.
+ * Returns: %TRUE if the peer is authorized, %FALSE if not.
*
* Since: 2.26
*/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]