[glibmm] Gio::DBus::Connection: Add UnixFDList call() method overloads.



commit 3859c6f40be85f1b3162cee5b637f2a67616066c
Author: Josà Alburquerque <jaalburqu svn gnome org>
Date:   Wed Oct 12 19:32:11 2011 -0400

    Gio::DBus::Connection: Add UnixFDList call() method overloads.
    
    	* gio/src/dbusconnection.{ccg,hg}: Add cancellable and
    	non-cancellable UnixFDList call() methods.

 ChangeLog                  |    7 +++
 gio/src/dbusconnection.ccg |   64 +++++++++++++++++++++++++++++--
 gio/src/dbusconnection.hg  |   89 ++++++++++++++++++++++++++++++++++++++++++--
 3 files changed, 152 insertions(+), 8 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 1d1726b..27d8a42 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2011-10-12  Josà Alburquerque  <jaalburqu svn gnome org>
 
+	Gio::DBus::Connection: Add UnixFDList call() method overloads.
+
+	* gio/src/dbusconnection.{ccg,hg}: Add cancellable and
+	non-cancellable UnixFDList call() methods.
+
+2011-10-12  Josà Alburquerque  <jaalburqu svn gnome org>
+
 	VariantContainerBase: Add create_maybe().
 
 	* glib/src/variant.{ccg,hg}: Add a create_maybe() method because it
diff --git a/gio/src/dbusconnection.ccg b/gio/src/dbusconnection.ccg
index c874066..67f3157 100644
--- a/gio/src/dbusconnection.ccg
+++ b/gio/src/dbusconnection.ccg
@@ -22,6 +22,7 @@
 #include <giomm/dbusintrospection.h>
 #include <giomm/dbusmethodinvocation.h>
 #include <giomm/dbuserror.h>
+#include <giomm/unixfdlist.h>
 #include "slot_async.h"
 
 namespace
@@ -657,7 +658,7 @@ void Connection::call(
   const Glib::RefPtr<Cancellable>&      cancellable,
   const Glib::ustring&                  bus_name,
   int                                   timeout_msec,
-  CallFlags                         flags,
+  CallFlags                             flags,
   const Glib::VariantType&              reply_type
 )
 {
@@ -682,7 +683,7 @@ void Connection::call(
   const SlotAsyncReady&                 slot,
   const Glib::ustring&                  bus_name,
   int                                   timeout_msec,
-  CallFlags                         flags,
+  CallFlags                             flags,
   const Glib::VariantType&              reply_type
 )
 {
@@ -706,7 +707,7 @@ Glib::VariantContainerBase Connection::call_sync(
   const Glib::RefPtr<Cancellable>&      cancellable,
   const Glib::ustring&                  bus_name,
   int                                   timeout_msec,
-  CallFlags                         flags,
+  CallFlags                             flags,
   const Glib::VariantType&              reply_type
 )
 {
@@ -733,7 +734,7 @@ Glib::VariantContainerBase Connection::call_sync(
   const Glib::VariantContainerBase&     parameters,
   const Glib::ustring&                  bus_name,
   int                                   timeout_msec,
-  CallFlags                         flags,
+  CallFlags                             flags,
   const Glib::VariantType&              reply_type
 )
 {
@@ -751,6 +752,61 @@ Glib::VariantContainerBase Connection::call_sync(
   return Glib::VariantContainerBase(gvariant, false); //Dont' take an extra reference.
 }
 
+#ifdef G_OS_LINUX
+// With a UnixFDList.
+void Connection::call(
+  const Glib::ustring&                object_path,
+  const Glib::ustring&                interface_name,
+  const Glib::ustring&                method_name,
+  const Glib::VariantContainerBase&   parameters,
+  const SlotAsyncReady&               slot,
+  const Glib::RefPtr<Cancellable>&    cancellable,
+  const Glib::RefPtr<UnixFDList>&     fd_list,
+  const Glib::ustring&                bus_name,
+  int                                 timeout_msec,
+  CallFlags                           flags,
+  const Glib::VariantType&            reply_type
+)
+{
+  // Create a copy of the slot.
+  // A pointer to it will be passed through the callback's data parameter
+  // and deleted in the callback.
+  SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+
+  g_dbus_connection_call_with_uinx_fd_list(gobj(), bus_name.c_str(),
+    object_path.c_str(), interface_name.c_str(), method_name.c_str(),
+    const_cast<GVariant*>(parameters.gobj()), reply_type.gobj(),
+    static_cast<GDBusCallFlags>(flags), timeout_msec, Glib::unwrap(fd_list),
+    Glib::unwrap(cancellable), &SignalProxy_async_callback, slot_copy);
+}
+
+// Non-cancellable version (with a UnixFDList).
+void Connection::call(
+  const Glib::ustring&                object_path,
+  const Glib::ustring&                interface_name,
+  const Glib::ustring&                method_name,
+  const Glib::VariantContainerBase&   parameters,
+  const SlotAsyncReady&               slot,
+  const Glib::RefPtr<UnixFDList>&     fd_list,
+  const Glib::ustring&                bus_name,
+  int                                 timeout_msec,
+  CallFlags                           flags,
+  const Glib::VariantType&            reply_type
+)
+{
+  // Create a copy of the slot.
+  // A pointer to it will be passed through the callback's data parameter
+  // and deleted in the callback.
+  SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
+
+  g_dbus_connection_call_with_unix_fd_list(gobj(), bus_name.c_str(),
+    object_path.c_str(), interface_name.c_str(), method_name.c_str(),
+    const_cast<GVariant*>(parameters.gobj()), reply_type.gobj(),
+    static_cast<GDBusCallFlags>(flags), timeout_msec, Glib::unwrap(fd_list),
+    0, &SignalProxy_async_callback, slot_copy);
+}
+#endif // G_OS_LINUX
+
 void Connection::emit_signal(
   const Glib::ustring&                object_path,
   const Glib::ustring&                interface_name,
diff --git a/gio/src/dbusconnection.hg b/gio/src/dbusconnection.hg
index f842434..f17eafa 100644
--- a/gio/src/dbusconnection.hg
+++ b/gio/src/dbusconnection.hg
@@ -49,6 +49,9 @@ _WRAP_ENUM(SubtreeFlags, GDBusSubtreeFlags, s#^DBUS_##, NO_GTYPE)
 _GMMPROC_EXTRA_NAMESPACE(DBus)
 
 
+class UnixFDList;
+
+
 /** @defgroup DBus D-Bus API
  *
  * API to use D-Bus services as a client or to implement a D-Bus service.
@@ -663,7 +666,7 @@ public:
     const Glib::RefPtr<Cancellable>&    cancellable,
     const Glib::ustring&                bus_name = Glib::ustring(),
     int                                 timeout_msec = -1,
-    CallFlags                       flags = Gio::DBus::CALL_FLAGS_NONE,
+    CallFlags                           flags = Gio::DBus::CALL_FLAGS_NONE,
     const Glib::VariantType&            reply_type = Glib::VariantType()
   );
   _IGNORE(g_dbus_connection_call)
@@ -677,7 +680,7 @@ public:
     const SlotAsyncReady&               slot,
     const Glib::ustring&                bus_name = Glib::ustring(),
     int                                 timeout_msec = -1,
-    CallFlags                       flags = Gio::DBus::CALL_FLAGS_NONE,
+    CallFlags                           flags = Gio::DBus::CALL_FLAGS_NONE,
     const Glib::VariantType&            reply_type = Glib::VariantType()
   );
 
@@ -732,7 +735,7 @@ public:
     const Glib::RefPtr<Cancellable>&    cancellable,
     const Glib::ustring&                bus_name = Glib::ustring(),
     int                                 timeout_msec = -1,
-    CallFlags                       flags = Gio::DBus::CALL_FLAGS_NONE,
+    CallFlags                           flags = Gio::DBus::CALL_FLAGS_NONE,
     const Glib::VariantType&            reply_type = Glib::VariantType()
   );
   _IGNORE(g_dbus_connection_call_sync)
@@ -745,9 +748,87 @@ public:
     const Glib::VariantContainerBase&   parameters,
     const Glib::ustring&                bus_name = Glib::ustring(),
     int                                 timeout_msec = -1,
-    CallFlags                       flags = Gio::DBus::CALL_FLAGS_NONE,
+    CallFlags                           flags = Gio::DBus::CALL_FLAGS_NONE,
+    const Glib::VariantType&            reply_type = Glib::VariantType()
+  );
+
+#ifdef G_OS_LINUX
+  /** Like call() but also takes a GUnixFDList object.
+   * This method is only available on UNIX.
+   *
+   * @param object_path Path of remote object.
+   * @param interface_name D-Bus interface to invoke method on.
+   * @param method_name The name of the method to invoke.
+   * @param parameters A Glib::VariantContainerBase tuple with parameters for the
+   * method or <tt>0</tt> if not passing parameters.
+   * @param slot A SlotAsyncReady to call when the request is satisfied.
+   * @param cancellable A Cancellable.
+   * @param fd_list A UnixFDList.
+   * @param bus_name A unique or well-known bus name or <tt>0</tt> if the
+   * connection is not a message bus connection.
+   * @param timeout_msec The timeout in milliseconds, -1 to use the default
+   * timeout or G_MAXINT for no timeout.
+   * @param flags Flags from the Gio::DBus::CallFlags enumeration.
+   * @param reply_type The expected type of the reply, or <tt>0</tt>.
+   * @newin{2,32}
+   */
+  void call(
+    const Glib::ustring&                object_path,
+    const Glib::ustring&                interface_name,
+    const Glib::ustring&                method_name,
+    const Glib::VariantContainerBase&   parameters,
+    const SlotAsyncReady&               slot,
+    const Glib::RefPtr<Cancellable>&    cancellable,
+    const Glib::RefPtr<UnixFDList>&     fd_list,
+    const Glib::ustring&                bus_name = Glib::ustring(),
+    int                                 timeout_msec = -1,
+    CallFlags                           flags = Gio::DBus::CALL_FLAGS_NONE,
+    const Glib::VariantType&            reply_type = Glib::VariantType()
+  );
+  _IGNORE(g_dbus_connection_call_with_uinx_fd_list)
+
+  /// A non-cancellable version of call() (with a UnixFDList).
+  void call(
+    const Glib::ustring&                object_path,
+    const Glib::ustring&                interface_name,
+    const Glib::ustring&                method_name,
+    const Glib::VariantContainerBase&   parameters,
+    const SlotAsyncReady&               slot,
+    const Glib::RefPtr<UnixFDList>&     fd_list,
+    const Glib::ustring&                bus_name = Glib::ustring(),
+    int                                 timeout_msec = -1,
+    CallFlags                           flags = Gio::DBus::CALL_FLAGS_NONE,
     const Glib::VariantType&            reply_type = Glib::VariantType()
   );
+#endif // G_OS_LINUX
+
+  ///** Finishes an operation started with call() (with a UnixFDList).
+   //* @param res A AsyncResult obtained from the SlotAsyncReady passed to
+   //* call().
+   //* @result A Variant tuple with return values.
+   //* @throw Glib::Error.
+   //* @newin{2,32}
+   //*/
+  //TODO: _WRAP_METHOD(Glib::VariantContainerBase call_with_unix_fd_finish(const Glib::RefPtr<AsyncResult>& res{.}, Glib::RefPtr<UnixFDList>& out_fd_list{.?}), g_dbus_connection_call_with_unix_fd_list_finish, errthrow)
+
+  /*
+  _WRAP_METHOD(
+    Glib::VariantContainerBase call_sync(
+      const Glib::ustring&                object_path{.},
+      const Glib::ustring&                interface_name{.},
+      const Glib::ustring&                method_name{.},
+      const Glib::VariantContainerBase&   parameters{.},
+      const Glib::RefPtr<Cancellable>&    cancellable{.?},
+      const Glib::RefPtr<UnixFDList>&     fd_list{.},
+      Glib::RefPtr<UnixFDList>&           out_fd_list{.},
+      const Glib::ustring&                bus_name{.} = Glib::ustring(),
+      int                                 timeout_msec{.} = -1,
+      CallFlags                           flags{.} = Gio::DBus::CALL_FLAGS_NONE,
+      const Glib::VariantType&            reply_type{.} = Glib::VariantType()
+    ),
+    g_dbus_connection_call_with_unix_fd_list_sync, errthrow
+  )
+  */
 
   /** Emits a signal.
    *



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