[glib/gdbus-merge] GDBus: Add GDBusAuthObserver param in g_dbus_connection_new_for_address()



commit 60e7ae26af2fc31d59e36f8798d383fa9d87db92
Author: David Zeuthen <davidz redhat com>
Date:   Thu May 13 16:32:11 2010 -0400

    GDBus: Add GDBusAuthObserver param in g_dbus_connection_new_for_address()
    
    This is to match g_dbus_connection_new(). This extension allows us to
    extend GDBusAuthObserver to also be used in client-side authentication
    in the future (right now it's only used on the server-side).

 gio/gdbus-tool.c               |    1 +
 gio/gdbusconnection.c          |   18 ++++++++++++++----
 gio/gdbusconnection.h          |    2 ++
 gio/tests/gdbus-example-peer.c |    1 +
 gio/tests/gdbus-peer.c         |    4 ++++
 gio/tests/gdbus-tests.c        |    1 +
 6 files changed, 23 insertions(+), 4 deletions(-)
---
diff --git a/gio/gdbus-tool.c b/gio/gdbus-tool.c
index 95d8128..5780c26 100644
--- a/gio/gdbus-tool.c
+++ b/gio/gdbus-tool.c
@@ -424,6 +424,7 @@ connection_get_dbus_connection (GError **error)
     {
       c = g_dbus_connection_new_for_address_sync (opt_connection_address,
                                                   G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT,
+                                                  NULL, /* GDBusAuthObserver */
                                                   NULL, /* GCancellable */
                                                   error);
     }
diff --git a/gio/gdbusconnection.c b/gio/gdbusconnection.c
index ccb2729..b02f1d6 100644
--- a/gio/gdbusconnection.c
+++ b/gio/gdbusconnection.c
@@ -1948,8 +1948,7 @@ async_initable_iface_init (GAsyncInitableIface *async_initable_iface)
  * Asynchronously sets up a D-Bus connection for exchanging D-Bus messages
  * with the end represented by @stream.
  *
- * If %G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER is set in @flags,
- * @observer (if not %NULL) is used to assist in the client
+ * If @observer is not %NULL it may be used to control the
  * authentication process.
  *
  * When the operation is finished, @callback will be invoked. You can
@@ -2029,8 +2028,7 @@ g_dbus_connection_new_finish (GAsyncResult  *res,
  * Synchronously sets up a D-Bus connection for exchanging D-Bus messages
  * with the end represented by @stream.
  *
- * If %G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_SERVER is set in @flags,
- * @observer (if not %NULL) is used to assist in the client
+ * If @observer is not %NULL it may be used to control the
  * authentication process.
  *
  * This is a synchronous failable constructor. See
@@ -2066,6 +2064,7 @@ g_dbus_connection_new_sync (GIOStream             *stream,
  * g_dbus_connection_new_for_address:
  * @address: A D-Bus address.
  * @flags: Flags describing how to make the connection.
+ * @observer: A #GDBusAuthObserver or %NULL.
  * @cancellable: A #GCancellable or %NULL.
  * @callback: A #GAsyncReadyCallback to call when the request is satisfied.
  * @user_data: The data to pass to @callback.
@@ -2084,6 +2083,9 @@ g_dbus_connection_new_sync (GIOStream             *stream,
  * then call g_dbus_connection_new_finish() to get the result of the
  * operation.
  *
+ * If @observer is not %NULL it may be used to control the
+ * authentication process.
+ *
  * This is a asynchronous failable constructor. See
  * g_dbus_connection_new_for_address_sync() for the synchronous
  * version.
@@ -2093,6 +2095,7 @@ g_dbus_connection_new_sync (GIOStream             *stream,
 void
 g_dbus_connection_new_for_address (const gchar          *address,
                                    GDBusConnectionFlags  flags,
+                                   GDBusAuthObserver    *observer,
                                    GCancellable         *cancellable,
                                    GAsyncReadyCallback   callback,
                                    gpointer              user_data)
@@ -2105,6 +2108,7 @@ g_dbus_connection_new_for_address (const gchar          *address,
                               user_data,
                               "address", address,
                               "flags", flags,
+                              "authentication-observer", observer,
                               NULL);
 }
 
@@ -2145,6 +2149,7 @@ g_dbus_connection_new_for_address_finish (GAsyncResult  *res,
  * g_dbus_connection_new_for_address_sync:
  * @address: A D-Bus address.
  * @flags: Flags describing how to make the connection.
+ * @observer: A #GDBusAuthObserver or %NULL.
  * @cancellable: A #GCancellable or %NULL.
  * @error: Return location for error or %NULL.
  *
@@ -2161,6 +2166,9 @@ g_dbus_connection_new_for_address_finish (GAsyncResult  *res,
  * This is a synchronous failable constructor. See
  * g_dbus_connection_new_for_address() for the asynchronous version.
  *
+ * If @observer is not %NULL it may be used to control the
+ * authentication process.
+ *
  * Returns: A #GDBusConnection or %NULL if @error is set. Free with g_object_unref().
  *
  * Since: 2.26
@@ -2168,6 +2176,7 @@ g_dbus_connection_new_for_address_finish (GAsyncResult  *res,
 GDBusConnection *
 g_dbus_connection_new_for_address_sync (const gchar           *address,
                                         GDBusConnectionFlags   flags,
+                                        GDBusAuthObserver     *observer,
                                         GCancellable          *cancellable,
                                         GError               **error)
 {
@@ -2178,6 +2187,7 @@ g_dbus_connection_new_for_address_sync (const gchar           *address,
                          error,
                          "address", address,
                          "flags", flags,
+                         "authentication-observer", observer,
                          NULL);
 }
 
diff --git a/gio/gdbusconnection.h b/gio/gdbusconnection.h
index 3299777..42ba476 100644
--- a/gio/gdbusconnection.h
+++ b/gio/gdbusconnection.h
@@ -117,6 +117,7 @@ GDBusConnection *g_dbus_connection_new_sync                   (GIOStream
 
 void             g_dbus_connection_new_for_address            (const gchar            *address,
                                                                GDBusConnectionFlags    flags,
+                                                               GDBusAuthObserver      *observer,
                                                                GCancellable           *cancellable,
                                                                GAsyncReadyCallback     callback,
                                                                gpointer                user_data);
@@ -124,6 +125,7 @@ GDBusConnection *g_dbus_connection_new_for_address_finish     (GAsyncResult
                                                                GError                **error);
 GDBusConnection *g_dbus_connection_new_for_address_sync       (const gchar            *address,
                                                                GDBusConnectionFlags    flags,
+                                                               GDBusAuthObserver      *observer,
                                                                GCancellable           *cancellable,
                                                                GError                **error);
 
diff --git a/gio/tests/gdbus-example-peer.c b/gio/tests/gdbus-example-peer.c
index 1a11c6d..649b047 100644
--- a/gio/tests/gdbus-example-peer.c
+++ b/gio/tests/gdbus-example-peer.c
@@ -259,6 +259,7 @@ main (int argc, char *argv[])
       error = NULL;
       connection = g_dbus_connection_new_for_address_sync (opt_address,
                                                            G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT,
+                                                           NULL, /* GDBusAuthObserver */
                                                            NULL, /* GCancellable */
                                                            &error);
       if (connection == NULL)
diff --git a/gio/tests/gdbus-peer.c b/gio/tests/gdbus-peer.c
index f78aa5c..2444a1d 100644
--- a/gio/tests/gdbus-peer.c
+++ b/gio/tests/gdbus-peer.c
@@ -478,6 +478,7 @@ test_peer (void)
                                                * will fail because the nonce file doesn't exist */
                                               "nonce-tcp:host=localhost,port=12345,noncefile=this-does-not-exist-gdbus",
                                               G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT,
+                                              NULL, /* GDBusAuthObserver */
                                               NULL, /* cancellable */
                                               &error);
   _g_assert_error_domain (error, G_IO_ERROR);
@@ -500,6 +501,7 @@ test_peer (void)
   error = NULL;
   c = g_dbus_connection_new_for_address_sync (g_dbus_server_get_client_address (server),
                                               G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT,
+                                              NULL, /* GDBusAuthObserver */
                                               NULL, /* cancellable */
                                               &error);
   g_assert_no_error (error);
@@ -624,6 +626,7 @@ test_peer (void)
   error = NULL;
   c2 = g_dbus_connection_new_for_address_sync (g_dbus_server_get_client_address (server),
                                                G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT,
+                                               NULL, /* GDBusAuthObserver */
                                                NULL, /* cancellable */
                                                &error);
   _g_assert_error_domain (error, G_IO_ERROR);
@@ -639,6 +642,7 @@ test_peer (void)
   data.accept_connection = TRUE;
   c2 = g_dbus_connection_new_for_address_sync (g_dbus_server_get_client_address (server),
                                                G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT,
+                                               NULL, /* GDBusAuthObserver */
                                                NULL, /* cancellable */
                                                &error);
   g_assert_no_error (error);
diff --git a/gio/tests/gdbus-tests.c b/gio/tests/gdbus-tests.c
index d801e1d..347ff36 100644
--- a/gio/tests/gdbus-tests.c
+++ b/gio/tests/gdbus-tests.c
@@ -147,6 +147,7 @@ _g_bus_get_priv (GBusType            bus_type,
   ret = g_dbus_connection_new_for_address_sync (address,
                                                 G_DBUS_CONNECTION_FLAGS_AUTHENTICATION_CLIENT |
                                                 G_DBUS_CONNECTION_FLAGS_MESSAGE_BUS_CONNECTION,
+                                                NULL, /* GDBusAuthObserver */
                                                 cancellable,
                                                 error);
   g_free (address);



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