[glibmm] giomm: DBusProxy: Correct the use of DBusInterfaceInfo class.



commit 1c36528113be5601ab2008ef2092d761decf9605
Author: José Alburquerque <jaalburqu svn gnome org>
Date:   Tue Sep 7 16:33:23 2010 -0400

    	giomm: DBusProxy: Correct the use of DBusInterfaceInfo class.
    
    	* gio/src/dbusproxy.{ccg,hg}: Use the DBusInterfaceInfo class wrapper
    	instead of the C API one.  The wrapper is reference counted.
    	(set/get_interface_info): Add these new methods, wrapping
    	g_dbus_proxy_set_interface_info() and
    	g_dbus_proxy_get_interface_info().
    	* gio/src/dbusmethodinvocation.{ccg,hg} (get_method_info): Add this
    	method, wrapping g_dbus_method_invocation_get_method_info().
    	* tools/m4/convert_gio.m4: Add necessary conversions.

 ChangeLog                        |   13 +++++++++++++
 gio/src/dbusmethodinvocation.ccg |    1 +
 gio/src/dbusmethodinvocation.hg  |    4 +++-
 gio/src/dbusproxy.ccg            |   29 +++++++++++++++++------------
 gio/src/dbusproxy.hg             |   24 +++++++++++++-----------
 tools/m4/convert_gio.m4          |    3 +++
 6 files changed, 50 insertions(+), 24 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7f93bf0..444cab4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
 2010-09-07  José Alburquerque  <jaalburqu svn gnome org>
 
+	giomm: DBusProxy: Correct the use of the DBusInterfaceInfo class.
+
+	* gio/src/dbusproxy.{ccg,hg}: Use the DBusInterfaceInfo class wrapper
+	instead of the C API one.  The wrapper is reference counted.
+	(set/get_interface_info): Add these new methods, wrapping
+	g_dbus_proxy_set_interface_info() and
+	g_dbus_proxy_get_interface_info().
+	* gio/src/dbusmethodinvocation.{ccg,hg} (get_method_info): Add this
+	method, wrapping g_dbus_method_invocation_get_method_info().
+	* tools/m4/convert_gio.m4: Add necessary conversions.
+
+2010-09-07  José Alburquerque  <jaalburqu svn gnome org>
+
 	giomm: Add D-Bus Introspection Data classes.
 
 	* gio/src/dbusintrospection.{ccg,hg}:
diff --git a/gio/src/dbusmethodinvocation.ccg b/gio/src/dbusmethodinvocation.ccg
index 21100ad..6012307 100644
--- a/gio/src/dbusmethodinvocation.ccg
+++ b/gio/src/dbusmethodinvocation.ccg
@@ -20,6 +20,7 @@
 #include <gio/gio.h>
 #include <giomm/dbusconnection.h>
 #include <giomm/dbusmessage.h>
+#include <giomm/dbusintrospection.h>
 
 namespace Gio
 {
diff --git a/gio/src/dbusmethodinvocation.hg b/gio/src/dbusmethodinvocation.hg
index 60fa33e..957f655 100644
--- a/gio/src/dbusmethodinvocation.hg
+++ b/gio/src/dbusmethodinvocation.hg
@@ -28,6 +28,7 @@ namespace Gio
 
 class DBusConnection;
 class DBusMessage;
+class DBusMethodInfo;
 
 /** DBusMethodInvocation - Object for handling remote calls.
  * Instances of the DBusMethodInvocation class are used when handling D-Bus
@@ -53,7 +54,8 @@ public:
   _WRAP_METHOD(Glib::ustring get_interface_name() const, g_dbus_method_invocation_get_interface_name)
   _WRAP_METHOD(Glib::ustring get_method_name() const, g_dbus_method_invocation_get_method_name)
 
-  //TODO?:_WRAP_METHOD(const GDBusMethodInfo* get_method_info(), g_dbus_method_invocation_get_method_info)
+  _WRAP_METHOD(Glib::RefPtr<DBusMethodInfo> get_method_info(), g_dbus_method_invocation_get_method_info)
+  _WRAP_METHOD(Glib::RefPtr<const DBusMethodInfo> get_method_info() const, g_dbus_method_invocation_get_method_info, constversion)
 
   _WRAP_METHOD(Glib::RefPtr<DBusConnection> get_connection(), g_dbus_method_invocation_get_connection)
   _WRAP_METHOD(Glib::RefPtr<const DBusConnection> get_connection() const, g_dbus_method_invocation_get_connection, constversion)
diff --git a/gio/src/dbusproxy.ccg b/gio/src/dbusproxy.ccg
index de77bbd..1090ca3 100644
--- a/gio/src/dbusproxy.ccg
+++ b/gio/src/dbusproxy.ccg
@@ -20,19 +20,21 @@
 #include <gio/gio.h>
 #include <giomm/asyncresult.h>
 #include <giomm/dbusconnection.h>
+#include <giomm/dbusintrospection.h>
 
 namespace Gio
 {
 
 DBusProxy::DBusProxy(const Glib::RefPtr<DBusConnection>& connection,
-  DBusProxyFlags flags, const GDBusInterfaceInfo* info,
+  DBusProxyFlags flags, const Glib::RefPtr<DBusInterfaceInfo>& 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-interface-info", Glib::unwrap(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()))
 {
@@ -40,14 +42,15 @@ _CONSTRUCT("g-connection", Glib::unwrap(connection),
 }
 
 DBusProxy::DBusProxy(const Glib::RefPtr<DBusConnection>& connection,
-  DBusProxyFlags flags, const GDBusInterfaceInfo* info,
+  DBusProxyFlags flags, const Glib::RefPtr<DBusInterfaceInfo>& 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-interface-info", Glib::unwrap(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()))
 {
@@ -55,13 +58,14 @@ _CONSTRUCT("g-connection", Glib::unwrap(connection),
 }
 
 DBusProxy::DBusProxy(BusType bus_type, DBusProxyFlags flags,
-  const GDBusInterfaceInfo* info, const Glib::ustring& name,
+  const Glib::RefPtr<DBusInterfaceInfo>& 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-interface-info", Glib::unwrap(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()))
 {
@@ -69,13 +73,14 @@ _CONSTRUCT("g-bus-type", static_cast<GBusType>(bus_type),
 }
 
 DBusProxy::DBusProxy(BusType bus_type, DBusProxyFlags flags,
-  const GDBusInterfaceInfo* info, const Glib::ustring& name,
+  const Glib::RefPtr<DBusInterfaceInfo>& 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-interface-info", Glib::unwrap(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()))
 {
@@ -83,7 +88,7 @@ _CONSTRUCT("g-bus-type", static_cast<GBusType>(bus_type),
 }
 
 void DBusProxy::create(const Glib::RefPtr<DBusConnection>& connection,
-  DBusProxyFlags flags, const GDBusInterfaceInfo* info,
+  DBusProxyFlags flags, const Glib::RefPtr<DBusInterfaceInfo>& info,
   const Glib::ustring& name, const Glib::ustring& object_path,
   const Glib::ustring& interface_name,
   const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable)
@@ -98,7 +103,7 @@ void DBusProxy::create(const Glib::RefPtr<DBusConnection>& connection,
 
 Glib::RefPtr<DBusProxy>
 DBusProxy::create(const Glib::RefPtr<DBusConnection>& connection,
-  DBusProxyFlags flags, const GDBusInterfaceInfo* info,
+  DBusProxyFlags flags, const Glib::RefPtr<DBusInterfaceInfo>& info,
   const Glib::ustring& name, const Glib::ustring& object_path,
   const Glib::ustring& interface_name,
   const Glib::RefPtr<Cancellable>& cancellable)
@@ -108,7 +113,7 @@ DBusProxy::create(const Glib::RefPtr<DBusConnection>& connection,
 }
 
 void DBusProxy::create(BusType bus_type, DBusProxyFlags flags,
-  const GDBusInterfaceInfo* info, const Glib::ustring& name,
+  const Glib::RefPtr<DBusInterfaceInfo>& info, const Glib::ustring& name,
   const Glib::ustring& object_path, const Glib::ustring& interface_name,
   const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable)
 {
@@ -121,7 +126,7 @@ void DBusProxy::create(BusType bus_type, DBusProxyFlags flags,
 }
 
 Glib::RefPtr<DBusProxy> DBusProxy::create(BusType bus_type,
-  DBusProxyFlags flags, const GDBusInterfaceInfo* info,
+  DBusProxyFlags flags, const Glib::RefPtr<DBusInterfaceInfo>& info,
   const Glib::ustring& name, const Glib::ustring& object_path,
   const Glib::ustring& interface_name,
   const Glib::RefPtr<Cancellable>& cancellable)
diff --git a/gio/src/dbusproxy.hg b/gio/src/dbusproxy.hg
index 4f71c4a..5833074 100644
--- a/gio/src/dbusproxy.hg
+++ b/gio/src/dbusproxy.hg
@@ -32,7 +32,7 @@ _WRAP_ENUM(DBusProxyFlags, GDBusProxyFlags, NO_GTYPE)
 
 class AsyncResult;
 class DBusConnection;
-struct GDBusInterfaceInfo;
+class DBusInterfaceInfo;
 
 /** DBusProxy - Client-side proxies.
  * DBusProxy is a base class used for proxies to access a D-Bus interface on
@@ -71,24 +71,24 @@ class DBusProxy
 
 protected:
   DBusProxy(const Glib::RefPtr<DBusConnection>& connection,
-    DBusProxyFlags flags, const GDBusInterfaceInfo* info,
+    DBusProxyFlags flags, const Glib::RefPtr<DBusInterfaceInfo>& 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, const GDBusInterfaceInfo* info,
+    DBusProxyFlags flags, const Glib::RefPtr<DBusInterfaceInfo>& 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,
-    const GDBusInterfaceInfo* info, const Glib::ustring& name,
+    const Glib::RefPtr<DBusInterfaceInfo>& info, const Glib::ustring& name,
     const Glib::ustring& object_path, const Glib::ustring& interface_name,
     const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable);
 
   DBusProxy(BusType bus_type, DBusProxyFlags flags,
-    const GDBusInterfaceInfo* info, const Glib::ustring& name,
+    const Glib::RefPtr<DBusInterfaceInfo>& info, const Glib::ustring& name,
     const Glib::ustring& object_path, const Glib::ustring& interface_name,
     const Glib::RefPtr<Cancellable>& cancellable);
 
@@ -96,7 +96,7 @@ public:
 
   _WRAP_METHOD_DOCS_ONLY(g_dbus_proxy_new)
   static void create(const Glib::RefPtr<DBusConnection>& connection,
-    DBusProxyFlags flags, const GDBusInterfaceInfo* info,
+    DBusProxyFlags flags, const Glib::RefPtr<DBusInterfaceInfo>& info,
     const Glib::ustring& name, const Glib::ustring& object_path,
     const Glib::ustring& interface_name,
     const SlotAsyncReady& slot,
@@ -105,13 +105,13 @@ public:
   _WRAP_METHOD_DOCS_ONLY(g_dbus_proxy_new_sync)
   static Glib::RefPtr<DBusProxy>
   create(const Glib::RefPtr<DBusConnection>& connection, DBusProxyFlags flags,
-    const GDBusInterfaceInfo* info, const Glib::ustring& name,
+    const Glib::RefPtr<DBusInterfaceInfo>& 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_DOCS_ONLY(g_dbus_proxy_new_for_bus)
   static void create(BusType bus_type, DBusProxyFlags flags,
-    const GDBusInterfaceInfo* info, const Glib::ustring& name,
+    const Glib::RefPtr<DBusInterfaceInfo>& 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>());
@@ -126,7 +126,7 @@ public:
   _WRAP_METHOD_DOCS_ONLY(g_dbus_proxy_new__for_bus_sync)
   static Glib::RefPtr<DBusProxy>
   create(BusType bus_type, DBusProxyFlags flags,
-    const GDBusInterfaceInfo* info, const Glib::ustring& name,
+    const Glib::RefPtr<DBusInterfaceInfo>& info, const Glib::ustring& name,
     const Glib::ustring& object_path, const Glib::ustring& interface_name,
     const Glib::RefPtr<Cancellable>& cancellable = Glib::RefPtr<Cancellable>());
 
@@ -149,9 +149,11 @@ public:
 #m4 _CONVERSION(`gchar**', `Glib::StringArrayHandle', `Glib::StringArrayHandle($3)')
   _WRAP_METHOD(Glib::StringArrayHandle get_cached_property_names() const, g_dbus_proxy_get_cached_property_names)
 
+  _WRAP_METHOD(void set_interface_info(const Glib::RefPtr<DBusInterfaceInfo>& info), g_dbus_proxy_set_interface_info)
+  _WRAP_METHOD(Glib::RefPtr<DBusInterfaceInfo> get_interface_info(), g_dbus_proxy_get_interface_info)
+  _WRAP_METHOD(Glib::RefPtr<const DBusInterfaceInfo> get_interface_info() const, g_dbus_proxy_get_interface_info, constversion)
+
 /* TODO:
-  _WRAP_METHOD(oid set_interface_info(GDBusInterfaceInfo* info), g_dbus_proxy_set_interface_info)
-  _WRAP_METHOD(DBusInterfaceInfo* get_interface_info(), g_dbus_proxy_get_interface_info)
   _WRAP_METHOD(void call(const gchar* method_name, GVariant* parameters, GDBusCallFlags flags, gint timeout_msec, GCancellable* cancellable, GAsyncReadyCallback callback, gpointer user_data), g_dbus_proxy_call)
   _WRAP_METHOD(GVariant* call_finish(GAsyncResult* res, GError** error),
 g_dbus_proxy_call_finish)
diff --git a/tools/m4/convert_gio.m4 b/tools/m4/convert_gio.m4
index 6726d0d..c3b411d 100644
--- a/tools/m4/convert_gio.m4
+++ b/tools/m4/convert_gio.m4
@@ -78,6 +78,9 @@ _CONVERSION(`GDBusSignalInfo*',`Glib::RefPtr<DBusSignalInfo>',`Glib::wrap($3)')
 _CONVERSION(`GDBusPropertyInfo*',`Glib::RefPtr<DBusPropertyInfo>',`Glib::wrap($3)')
 _CONVERSION(`GDBusNodeInfo*',`Glib::RefPtr<DBusNodeInfo>',`Glib::wrap($3)')
 _CONVERSION(`GDBusInterfaceInfo*',`Glib::RefPtr<DBusInterfaceInfo>',`Glib::wrap($3)')
+_CONVERSION(`const Glib::RefPtr<DBusInterfaceInfo>&',`GDBusInterfaceInfo*',`Glib::unwrap($3)')
+_CONVERSION(`GDBusInterfaceInfo*',`const Glib::RefPtr<DBusInterfaceInfo>',`Glib::wrap($3)')
+_CONVERSION(`const GDBusMethodInfo*', `Glib::RefPtr<DBusMethodInfo>', `Glib::wrap(const_cast<GDBusMethodInfo*>($3))')
 
 # DBusProxy
 _CONVERSION(`GDBusProxy*',`Glib::RefPtr<DBusProxy>',`Glib::wrap($3)')



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