[glibmm] Gio::DBus::Connection: Add the call_[finish|sync]() with UnixFDLists.



commit 89a68889a0b35f011083f5d6ca5176672b1a9172
Author: Josà Alburquerque <jaalburqu svn gnome org>
Date:   Tue Sep 18 15:25:54 2012 -0400

    Gio::DBus::Connection: Add the call_[finish|sync]() with UnixFDLists.
    
    	* gio/src/dbusconnection.{hg,ccg}: Add the methods using gmmproc's
    	output parameter functionality.  Also add the cancellable and
    	non-cancellable asynchronous call() methods that were #ifdef'ed out
    	because of the missing call_finish() method.
    	* tools/m4/convert_gio.m4: Add a necessary enum conversion.
    
    	Bug #662371.

 ChangeLog                  |   12 +++++++
 gio/src/dbusconnection.ccg |   34 ++++++--------------
 gio/src/dbusconnection.hg  |   74 ++++++++++++++++++++-----------------------
 tools/m4/convert_gio.m4    |    1 +
 4 files changed, 57 insertions(+), 64 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 0c735b5..b7ba3fe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2012-09-18  Josà Alburquerque  <jaalburqu svn gnome org>
 
+	Gio::DBus::Connection: Add the call_[finish|sync]() with UnixFDLists.
+
+	* gio/src/dbusconnection.{hg,ccg}: Add the methods using gmmproc's
+	output parameter functionality.  Also add the cancellable and
+	non-cancellable asynchronous call() methods that were #ifdef'ed out
+	because of the missing call_finish() method.
+	* tools/m4/convert_gio.m4: Add a necessary enum conversion.
+
+	Bug #662371.
+
+2012-09-18  Josà Alburquerque  <jaalburqu svn gnome org>
+
 	gmmproc: _WRAP_METHOD: Allow setting parameters from C output params.
 
 	* tools/m4/convert_base.m4 (_INITIALIZATION): Insert newlines between
diff --git a/gio/src/dbusconnection.ccg b/gio/src/dbusconnection.ccg
index 930097e..288223f 100644
--- a/gio/src/dbusconnection.ccg
+++ b/gio/src/dbusconnection.ccg
@@ -584,8 +584,7 @@ void Connection::send_message_with_reply(const Glib::RefPtr<Message>& message, i
 Glib::RefPtr<Message> Connection::send_message_with_reply_sync(
   const Glib::RefPtr<Message>& message,
   const Glib::RefPtr<Cancellable>& cancellable,
-  gint timeout_msec
-)
+  gint timeout_msec)
 {
   volatile guint32 out_serial = 0;
   GError* gerror = 0;
@@ -604,8 +603,7 @@ Glib::RefPtr<Message> Connection::send_message_with_reply_sync(
 
 Glib::RefPtr<Message> Connection::send_message_with_reply_sync(
   const Glib::RefPtr<Message>& message,
-  gint timeout_msec
-)
+  gint timeout_msec)
 {
   volatile guint32 out_serial = 0;
   GError* gerror = 0;
@@ -632,8 +630,7 @@ void Connection::call(
   const Glib::ustring&                  bus_name,
   int                                   timeout_msec,
   CallFlags                             flags,
-  const Glib::VariantType&              reply_type
-)
+  const Glib::VariantType&              reply_type)
 {
   // Create a copy of the slot.
   // A pointer to it will be passed through the callback's data parameter
@@ -657,8 +654,7 @@ void Connection::call(
   const Glib::ustring&                  bus_name,
   int                                   timeout_msec,
   CallFlags                             flags,
-  const Glib::VariantType&              reply_type
-)
+  const Glib::VariantType&              reply_type)
 {
   // Create a copy of the slot.
   // A pointer to it will be passed through the callback's data parameter
@@ -681,8 +677,7 @@ Glib::VariantContainerBase Connection::call_sync(
   const Glib::ustring&                  bus_name,
   int                                   timeout_msec,
   CallFlags                             flags,
-  const Glib::VariantType&              reply_type
-)
+  const Glib::VariantType&              reply_type)
 {
   GError* gerror = 0;
 
@@ -708,8 +703,7 @@ Glib::VariantContainerBase Connection::call_sync(
   const Glib::ustring&                  bus_name,
   int                                   timeout_msec,
   CallFlags                             flags,
-  const Glib::VariantType&              reply_type
-)
+  const Glib::VariantType&              reply_type)
 {
   GError* gerror = 0;
 
@@ -725,9 +719,6 @@ Glib::VariantContainerBase Connection::call_sync(
   return Glib::VariantContainerBase(gvariant, false); //Dont' take an extra reference.
 }
 
-//TODO: Re-add the following two methods when the call_finish() method with a
-//UnixFDList exists.
-#if 0
 #ifdef G_OS_LINUX
 // With a UnixFDList.
 void Connection::call(
@@ -741,8 +732,7 @@ void Connection::call(
   const Glib::ustring&                bus_name,
   int                                 timeout_msec,
   CallFlags                           flags,
-  const Glib::VariantType&            reply_type
-)
+  const Glib::VariantType&            reply_type)
 {
   // Create a copy of the slot.
   // A pointer to it will be passed through the callback's data parameter
@@ -767,8 +757,7 @@ void Connection::call(
   const Glib::ustring&                bus_name,
   int                                 timeout_msec,
   CallFlags                           flags,
-  const Glib::VariantType&            reply_type
-)
+  const Glib::VariantType&            reply_type)
 {
   // Create a copy of the slot.
   // A pointer to it will be passed through the callback's data parameter
@@ -782,15 +771,13 @@ void Connection::call(
     0, &SignalProxy_async_callback, slot_copy);
 }
 #endif // G_OS_LINUX
-#endif // 0
 
 void Connection::emit_signal(
   const Glib::ustring&                object_path,
   const Glib::ustring&                interface_name,
   const Glib::ustring&                signal_name,
   const Glib::ustring&                destination_bus_name,
-  const Glib::VariantContainerBase&   parameters
-)
+  const Glib::VariantContainerBase&   parameters)
 {
   GError* gerror = 0;
 
@@ -816,8 +803,7 @@ guint Connection::signal_subscribe(
   const Glib::ustring& member,
   const Glib::ustring& object_path,
   const Glib::ustring& arg0,
-  SignalFlags flags
-)
+  SignalFlags flags)
 {
   SlotSignal* slot_copy = new SlotSignal(slot);
 
diff --git a/gio/src/dbusconnection.hg b/gio/src/dbusconnection.hg
index d4ab3cd..b903a79 100644
--- a/gio/src/dbusconnection.hg
+++ b/gio/src/dbusconnection.hg
@@ -575,15 +575,13 @@ public:
   Glib::RefPtr<Message> send_message_with_reply_sync(
     const Glib::RefPtr<Message>& message,
     const Glib::RefPtr<Cancellable>& cancellable,
-    gint timeout_msec
-  );
+    gint timeout_msec);
   _IGNORE(g_dbus_connection_send_message_with_reply_sync)
 
   /// A non-cancellable version of send_message_with_reply_sync().
   Glib::RefPtr<Message> send_message_with_reply_sync(
     const Glib::RefPtr<Message>& message,
-    gint timeout_msec
-  );
+    gint timeout_msec);
 
   _WRAP_METHOD(void start_message_processing(), g_dbus_connection_start_message_processing)
   _WRAP_METHOD(bool is_closed() const, g_dbus_connection_is_closed)
@@ -647,8 +645,7 @@ public:
     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()
-  );
+    const Glib::VariantType&            reply_type = Glib::VariantType());
   _IGNORE(g_dbus_connection_call)
 
   /// A non-cancellable version of call().
@@ -661,8 +658,7 @@ public:
     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()
-  );
+    const Glib::VariantType&            reply_type = Glib::VariantType());
 
   /** Finishes an operation started with call().
    * @param res A AsyncResult obtained from the SlotAsyncReady passed to
@@ -716,8 +712,7 @@ public:
     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()
-  );
+    const Glib::VariantType&            reply_type = Glib::VariantType());
   _IGNORE(g_dbus_connection_call_sync)
 
   /// A non-cancellable version of call_sync().
@@ -729,16 +724,18 @@ public:
     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()
-  );
+    const Glib::VariantType&            reply_type = Glib::VariantType());
 
-// TODO: Re-add the following two methods when the call_finish() method with a
-// UnixFDList is wrapped.
-#if 0
 #ifdef G_OS_LINUX
   /** Like call() but also takes a GUnixFDList object.
    * This method is only available on UNIX.
    *
+   * This is an asynchronous method. When the operation is finished, callback
+   * will be invoked in the thread-default main loop of the thread you are
+   * calling this method from. You can then call call_with_unix_fd_finish() to
+   * get the result of the operation. See call_sync() for the synchronous
+   * version of this function.
+   *
    * @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.
@@ -753,7 +750,7 @@ public:
    * 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}
+   * @newin{2,34}
    */
   void call(
     const Glib::ustring&                object_path,
@@ -766,11 +763,12 @@ public:
     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)
+    const Glib::VariantType&            reply_type = Glib::VariantType());
+  _IGNORE(g_dbus_connection_call_with_unix_fd_list)
 
-  /// A non-cancellable version of call() (with a UnixFDList).
+  /** A non-cancellable version of call() (with a UnixFDList).
+   * @newin{2,34}
+   */
   void call(
     const Glib::ustring&                object_path,
     const Glib::ustring&                interface_name,
@@ -781,21 +779,20 @@ public:
     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()
-  );
+    const Glib::VariantType&            reply_type = Glib::VariantType());
 #endif // G_OS_LINUX
-#endif // 0
-
-  ///** 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)
-
-  /* TODO:
+
+#m4 _INITIALIZATION(`Glib::RefPtr<UnixFDList>&',`GUnixFDList*', `$3 = Glib::wrap($4)')
+
+  /** 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,34}
+   */
+  _WRAP_METHOD(Glib::VariantContainerBase call_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{.},
@@ -804,7 +801,7 @@ public:
       const Glib::VariantContainerBase&   parameters{.},
       const Glib::RefPtr<Cancellable>&    cancellable{.?},
       const Glib::RefPtr<UnixFDList>&     fd_list{.},
-      Glib::RefPtr<UnixFDList>&           out_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,
@@ -812,7 +809,6 @@ public:
     ),
     g_dbus_connection_call_with_unix_fd_list_sync, errthrow
   )
-  */
 
   /** Emits a signal.
    *
@@ -834,8 +830,7 @@ public:
     const Glib::ustring&                interface_name,
     const Glib::ustring&                signal_name,
     const Glib::ustring&                destination_bus_name = Glib::ustring(),
-    const Glib::VariantContainerBase&   parameters = Glib::VariantContainerBase()
-  );
+    const Glib::VariantContainerBase&   parameters = Glib::VariantContainerBase());
   _IGNORE(g_dbus_connection_emit_signal)
 
   /** Subscribes to signals on the connection and invokes @a slot with a
@@ -876,8 +871,7 @@ public:
     const Glib::ustring& member = Glib::ustring(),
     const Glib::ustring& object_path = Glib::ustring(),
     const Glib::ustring& arg0 = Glib::ustring(),
-    SignalFlags flags = Gio::DBus::SIGNAL_FLAGS_NONE
-  );
+    SignalFlags flags = Gio::DBus::SIGNAL_FLAGS_NONE);
   _IGNORE(g_dbus_connection_signal_subscribe)
 
   _WRAP_METHOD(void signal_unsubscribe(guint subscription_id), g_dbus_connection_signal_unsubscribe)
diff --git a/tools/m4/convert_gio.m4 b/tools/m4/convert_gio.m4
index 4e2e4fc..28ff537 100644
--- a/tools/m4/convert_gio.m4
+++ b/tools/m4/convert_gio.m4
@@ -7,6 +7,7 @@ _CONV_ENUM(G,ConverterResult)
 _CONV_ENUM(G,CredentialsType)
 _CONV_ENUM(G,DataStreamByteOrder)
 _CONV_ENUM(G,DataStreamNewlineType)
+_CONV_ENUM(GDBus,CallFlags)
 _CONV_ENUM(GDBus,CapabilityFlags)
 _CONV_ENUM(GDBus,MessageFlags)
 _CONV_ENUM(GDBus,MessageHeaderField)



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