[glibmm] giomm: DBusProxy: Add constructors and create methods.



commit a794986d7c44893ea04f8bdd8b416e7744b8eea6
Author: José Alburquerque <jaalburqu svn gnome org>
Date:   Mon Sep 6 23:54:26 2010 -0400

    	giomm: DBusProxy: Add constructors and create methods.
    
    	* gio/src/dbusproxy.{ccg,hg}: Add the constructors and create methods
    	making sure that the order of the parameters allows for the
    	Cancellable to be optional.  Also made sure that the GDBusInterface
    	paramater is constant.
    
    	* gio/src/dbusconnection.ccg (DBusConnection): Rename the "observer"
    	property in the _CONSTRUCT macro to the correct
    	"authentication-observer" name used in the new function.
    
    	* gio/src/socketcontrolmessage.hg:
    	* gio/src/unixfdlist.hg:
    	* gio/src/unixfdmessage.hg: Correct typos in newin{}'s.

 ChangeLog                       |   17 ++++++
 gio/src/dbusconnection.ccg      |    2 +-
 gio/src/dbusproxy.ccg           |  106 +++++++++++++++++++++++++++++++++++++++
 gio/src/dbusproxy.hg            |   58 +++++++++++----------
 gio/src/socketcontrolmessage.hg |    2 +-
 gio/src/unixfdlist.hg           |    2 +-
 gio/src/unixfdmessage.hg        |    2 +-
 7 files changed, 157 insertions(+), 32 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index eba7238..fb2f85d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2010-09-06  José Alburquerque  <jaalburqu svn gnome org>
+
+	giomm: DBusProxy: Add constructors and create methods.
+
+	* gio/src/dbusproxy.{ccg,hg}: Add the constructors and create methods
+	making sure that the order of the parameters allows for the
+	Cancellable to be optional.  Also made sure that the GDBusInterface
+	paramater is constant.
+
+	* gio/src/dbusconnection.ccg (DBusConnection): Rename the "observer"
+	property in the _CONSTRUCT macro to the correct
+	"authentication-observer" name used in the new function.
+
+	* gio/src/socketcontrolmessage.hg:
+	* gio/src/unixfdlist.hg:
+	* gio/src/unixfdmessage.hg: Correct typos in newin{}'s.
+
 2010-09-05  José Alburquerque  <jaalburqu svn gnome org>
 
 	giomm: Add initial DBusProxy implementation.
diff --git a/gio/src/dbusconnection.ccg b/gio/src/dbusconnection.ccg
index d5d11e9..d50676e 100644
--- a/gio/src/dbusconnection.ccg
+++ b/gio/src/dbusconnection.ccg
@@ -32,7 +32,7 @@ DBusConnection::DBusConnection(const Glib::RefPtr<IOStream>& stream,
   _CONSTRUCT("stream", Glib::unwrap(stream),
     "guid", (guid.empty() ? 0 : guid.c_str()),
     "flags", static_cast<GDBusConnectionFlags>(flags),
-    "observer", Glib::unwrap(observer))
+    "authentication-observer", Glib::unwrap(observer))
 {
   init(cancellable);
 }
diff --git a/gio/src/dbusproxy.ccg b/gio/src/dbusproxy.ccg
index 5e675bd..de77bbd 100644
--- a/gio/src/dbusproxy.ccg
+++ b/gio/src/dbusproxy.ccg
@@ -24,4 +24,110 @@
 namespace Gio
 {
 
+DBusProxy::DBusProxy(const Glib::RefPtr<DBusConnection>& connection,
+  DBusProxyFlags flags, const GDBusInterfaceInfo* info,
+  const Glib::ustring& name, const Glib::ustring& object_path,
+  const Glib::ustring& interface_name, const SlotAsyncReady& slot,
+  const Glib::RefPtr<Cancellable>& cancellable)
+:
+_CONSTRUCT("g-connection", Glib::unwrap(connection),
+  "g-flags", static_cast<GDBusProxyFlags>(flags),
+  "g-interface-info", info, "name", (name.empty() ? 0 : name.c_str()),
+  "g-object-path", (object_path.empty() ? 0 : object_path.c_str()),
+  "g-interface-name", (interface_name.empty() ? 0 : interface_name.c_str()))
+{
+  init_async(slot, cancellable);
+}
+
+DBusProxy::DBusProxy(const Glib::RefPtr<DBusConnection>& connection,
+  DBusProxyFlags flags, const GDBusInterfaceInfo* info,
+  const Glib::ustring& name, const Glib::ustring& object_path,
+  const Glib::ustring& interface_name,
+  const Glib::RefPtr<Cancellable>& cancellable)
+:
+_CONSTRUCT("g-connection", Glib::unwrap(connection),
+  "g-flags", static_cast<GDBusProxyFlags>(flags),
+  "g-interface-info", info, "name", (name.empty() ? 0 : name.c_str()),
+  "g-object-path", (object_path.empty() ? 0 : object_path.c_str()),
+  "g-interface-name", (interface_name.empty() ? 0 : interface_name.c_str()))
+{
+  init(cancellable);
+}
+
+DBusProxy::DBusProxy(BusType bus_type, DBusProxyFlags flags,
+  const GDBusInterfaceInfo* info, const Glib::ustring& name,
+  const Glib::ustring& object_path, const Glib::ustring& interface_name,
+  const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable)
+:
+_CONSTRUCT("g-bus-type", static_cast<GBusType>(bus_type),
+  "g-flags", static_cast<GDBusProxyFlags>(flags),
+  "g-interface-info", info, "name", (name.empty() ? 0 : name.c_str()),
+  "g-object-path", (object_path.empty() ? 0 : object_path.c_str()),
+  "g-interface-name", (interface_name.empty() ? 0 : interface_name.c_str()))
+{
+  init_async(slot, cancellable);
+}
+
+DBusProxy::DBusProxy(BusType bus_type, DBusProxyFlags flags,
+  const GDBusInterfaceInfo* info, const Glib::ustring& name,
+  const Glib::ustring& object_path, const Glib::ustring& interface_name,
+  const Glib::RefPtr<Cancellable>& cancellable)
+:
+_CONSTRUCT("g-bus-type", static_cast<GBusType>(bus_type),
+  "g-flags", static_cast<GDBusProxyFlags>(flags),
+  "g-interface-info", info, "name", (name.empty() ? 0 : name.c_str()),
+  "g-object-path", (object_path.empty() ? 0 : object_path.c_str()),
+  "g-interface-name", (interface_name.empty() ? 0 : interface_name.c_str()))
+{
+  init(cancellable);
+}
+
+void DBusProxy::create(const Glib::RefPtr<DBusConnection>& connection,
+  DBusProxyFlags flags, const GDBusInterfaceInfo* info,
+  const Glib::ustring& name, const Glib::ustring& object_path,
+  const Glib::ustring& interface_name,
+  const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable)
+{
+  // Create the proxy, taking an extra reference without returning it.  The
+  // extra reference is taken so the proxy is not destroyed when it goes out
+  // of scope.  The finished proxy will be returned in the slot by calling
+  // create_finish().
+  Glib::RefPtr<DBusProxy>(new DBusProxy(connection, flags, info, name,
+    object_path, interface_name, slot, cancellable))->reference();
+}
+
+Glib::RefPtr<DBusProxy>
+DBusProxy::create(const Glib::RefPtr<DBusConnection>& connection,
+  DBusProxyFlags flags, const GDBusInterfaceInfo* info,
+  const Glib::ustring& name, const Glib::ustring& object_path,
+  const Glib::ustring& interface_name,
+  const Glib::RefPtr<Cancellable>& cancellable)
+{
+  return Glib::RefPtr<DBusProxy>(new DBusProxy(connection, flags, info, name,
+    object_path, interface_name, cancellable));
+}
+
+void DBusProxy::create(BusType bus_type, DBusProxyFlags flags,
+  const GDBusInterfaceInfo* info, const Glib::ustring& name,
+  const Glib::ustring& object_path, const Glib::ustring& interface_name,
+  const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable)
+{
+  // Create the proxy, taking an extra reference without returning it.  The
+  // extra reference is taken so the proxy is not destroyed when it goes out
+  // of scope.  The finished proxy will be returned in the slot by calling
+  // create_finish().
+  Glib::RefPtr<DBusProxy>(new DBusProxy(bus_type, flags, info, name,
+    object_path, interface_name, slot, cancellable))->reference();
+}
+
+Glib::RefPtr<DBusProxy> DBusProxy::create(BusType bus_type,
+  DBusProxyFlags flags, const GDBusInterfaceInfo* info,
+  const Glib::ustring& name, const Glib::ustring& object_path,
+  const Glib::ustring& interface_name,
+  const Glib::RefPtr<Cancellable>& cancellable)
+{
+  return Glib::RefPtr<DBusProxy>(new DBusProxy(bus_type, flags, info, name,
+    object_path, interface_name, cancellable));
+}
+
 } // namespace Gio
diff --git a/gio/src/dbusproxy.hg b/gio/src/dbusproxy.hg
index efbe177..4f71c4a 100644
--- a/gio/src/dbusproxy.hg
+++ b/gio/src/dbusproxy.hg
@@ -20,6 +20,7 @@
 #include <glibmm/object.h>
 #include <giomm/initable.h>
 #include <giomm/asyncinitable.h>
+#include <giomm/dbusconnection.h>
 
 _DEFS(giomm,gio)
 _PINCLUDE(glibmm/private/object_p.h)
@@ -31,6 +32,7 @@ _WRAP_ENUM(DBusProxyFlags, GDBusProxyFlags, NO_GTYPE)
 
 class AsyncResult;
 class DBusConnection;
+struct GDBusInterfaceInfo;
 
 /** DBusProxy - Client-side proxies.
  * DBusProxy is a base class used for proxies to access a D-Bus interface on
@@ -68,65 +70,65 @@ class DBusProxy
   _CLASS_GOBJECT(DBusProxy, GDBusProxy, G_DBUS_PROXY, Glib::Object, GObject)
 
 protected:
-
-/* TODO
   DBusProxy(const Glib::RefPtr<DBusConnection>& connection,
-    DBusProxyFlags flags, GDBusInterfaceInfo* info, const Glib::ustring& name,
-    const Glib::ustring& object_path, const Glib::ustring& interface_name,
-    const Glib::RefPtr<Cancellable>& cancellable, const SlotAsyncReady& slot);
+    DBusProxyFlags flags, const GDBusInterfaceInfo* info,
+    const Glib::ustring& name, const Glib::ustring& object_path,
+    const Glib::ustring& interface_name, const SlotAsyncReady& slot,
+    const Glib::RefPtr<Cancellable>& cancellable);
 
   DBusProxy(const Glib::RefPtr<DBusConnection>& connection,
-    DBusProxyFlags flags, GDBusInterfaceInfo* info, const Glib::ustring& name,
-    const Glib::ustring& object_path, const Glib::ustring& interface_name,
+    DBusProxyFlags flags, const GDBusInterfaceInfo* info,
+    const Glib::ustring& name, const Glib::ustring& object_path,
+    const Glib::ustring& interface_name,
     const Glib::RefPtr<Cancellable>& cancellable);
 
   DBusProxy(BusType bus_type, DBusProxyFlags flags,
-    GDBusInterfaceInfo* info, const Glib::ustring& name,
+    const GDBusInterfaceInfo* info, const Glib::ustring& name,
     const Glib::ustring& object_path, const Glib::ustring& interface_name,
-    const Glib::RefPtr<Cancellable>& cancellable, const SlotAsyncReady& slot);
+    const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable);
 
-  DBusProxy(BusType bus_type, DBusProxyFlags flags, GDBusInterfaceInfo* info,
-    const Glib::ustring& name, const Glib::ustring& object_path,
-    const Glib::ustring& interface_name,
+  DBusProxy(BusType bus_type, DBusProxyFlags flags,
+    const GDBusInterfaceInfo* info, const Glib::ustring& name,
+    const Glib::ustring& object_path, const Glib::ustring& interface_name,
     const Glib::RefPtr<Cancellable>& cancellable);
-*/
 
 public:
 
-/* TODO
   _WRAP_METHOD_DOCS_ONLY(g_dbus_proxy_new)
   static void create(const Glib::RefPtr<DBusConnection>& connection,
-    DBusProxyFlags flags, GDBusInterfaceInfo* info, const Glib::ustring& name,
-    const Glib::ustring& object_path, const Glib::ustring& interface_name,
-    const Glib::RefPtr<Cancellable>& cancellable, const SlotAsyncReady& slot);
+    DBusProxyFlags flags, const GDBusInterfaceInfo* info,
+    const Glib::ustring& name, const Glib::ustring& object_path,
+    const Glib::ustring& interface_name,
+    const SlotAsyncReady& slot,
+    const Glib::RefPtr<Cancellable>& cancellable = Glib::RefPtr<Cancellable>());
 
   _WRAP_METHOD_DOCS_ONLY(g_dbus_proxy_new_sync)
   static Glib::RefPtr<DBusProxy>
   create(const Glib::RefPtr<DBusConnection>& connection, DBusProxyFlags flags,
-    GDBusInterfaceInfo* info, const Glib::ustring& name,
+    const GDBusInterfaceInfo* info, const Glib::ustring& name,
     const Glib::ustring& object_path, const Glib::ustring& interface_name,
-    const Glib::RefPtr<Cancellable>& cancellable);
+    const Glib::RefPtr<Cancellable>& cancellable = Glib::RefPtr<Cancellable>());
 
   _WRAP_METHOD_DOCS_ONLY(g_dbus_proxy_new_for_bus)
   static void create(BusType bus_type, DBusProxyFlags flags,
-    GDBusInterfaceInfo* info, const Glib::ustring& name,
+    const GDBusInterfaceInfo* info, const Glib::ustring& name,
     const Glib::ustring& object_path, const Glib::ustring& interface_name,
-    const Glib::RefPtr<Cancellable>& cancellable, const SlotAsyncReady& slot);
-*/
+    const SlotAsyncReady& slot,
+    const Glib::RefPtr<Cancellable>& cancellable = Glib::RefPtr<Cancellable>());
 
   // g_dbus_proxy_new_for_bus_finish() just calls g_dbus_proxy_new_finish() so
   // it is safe to use one create_finish() method for both asynchronous
   // creates.
+  /** @throw Glib::Error.
+   */
   _WRAP_METHOD(static Glib::RefPtr<DBusProxy> create_finish(const Glib::RefPtr<AsyncResult>& result), g_dbus_proxy_new_finish, errthrow)
 
-/* TODO
   _WRAP_METHOD_DOCS_ONLY(g_dbus_proxy_new__for_bus_sync)
   static Glib::RefPtr<DBusProxy>
-  create(BusType bus_type, DBusProxyFlags flags, GDBusInterfaceInfo* info,
-    const Glib::ustring& name, const Glib::ustring& object_path,
-    const Glib::ustring& interface_name,
-    const Glib::RefPtr<Cancellable>& cancellable);
-*/
+  create(BusType bus_type, DBusProxyFlags flags,
+    const GDBusInterfaceInfo* info, const Glib::ustring& name,
+    const Glib::ustring& object_path, const Glib::ustring& interface_name,
+    const Glib::RefPtr<Cancellable>& cancellable = Glib::RefPtr<Cancellable>());
 
   _WRAP_METHOD(DBusProxyFlags get_flags() const, g_dbus_proxy_get_flags)
 
diff --git a/gio/src/socketcontrolmessage.hg b/gio/src/socketcontrolmessage.hg
index cc8c0da..eb38136 100644
--- a/gio/src/socketcontrolmessage.hg
+++ b/gio/src/socketcontrolmessage.hg
@@ -45,7 +45,7 @@ namespace Gio
  * registered with the GType typesystem before calling
  * Gio::Socket::receive() to read such a message.
  *
- * @newin{2,22}
+ * @newin{2,26}
  */
 class SocketControlMessage : public Glib::Object
 {
diff --git a/gio/src/unixfdlist.hg b/gio/src/unixfdlist.hg
index f6caf7a..04f0b3d 100644
--- a/gio/src/unixfdlist.hg
+++ b/gio/src/unixfdlist.hg
@@ -34,7 +34,7 @@ namespace Gio
  * G_SOCKET_ADDRESS_UNIX family by using Gio::Socket::send() and received
  * using Gio::Socket::receive().
  *
- * @newin{2,24}
+ * @newin{2,26}
  */
 class UnixFDList : public Glib::Object
 {
diff --git a/gio/src/unixfdmessage.hg b/gio/src/unixfdmessage.hg
index 57947fd..de08d35 100644
--- a/gio/src/unixfdmessage.hg
+++ b/gio/src/unixfdmessage.hg
@@ -70,7 +70,7 @@ public:
    *
    * @return An array of file descriptors.
    *
-   * @newin{2,22}
+   * @newin{2,26}
    */
   Glib::ArrayHandle<int> steal_fds();
   _IGNORE(g_unix_fd_message_steal_fds)



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