[glibmm] Gio::DBus::Connection: Added a register_method() overload with no vtable.



commit f62a4d722632fdc83c9c68add45f7c4cdcf5d115
Author: Murray Cumming <murrayc murrayc com>
Date:   Sat Apr 2 15:14:09 2011 +0200

    Gio::DBus::Connection: Added a register_method() overload with no vtable.
    
    * gio/src/dbusconnection.[hg|ccg]: This makes sense now that the C API's
    documentation was improved in bug #646419.

 ChangeLog                  |    7 +++++++
 gio/src/dbusconnection.ccg |   15 +++++++++++++++
 gio/src/dbusconnection.hg  |   26 ++++++++++++++++++++++++--
 3 files changed, 46 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index e3152ef..dc274f7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-04-02  Murray Cumming  <murrayc murrayc com>
+
+	Gio::DBus::Connection: Added a register_method() overload with no vtable.
+
+	* gio/src/dbusconnection.[hg|ccg]: This makes sense now that the C API's 
+	documentation was improved in bug #646419.
+
 2011-04-01  Murray Cumming  <murrayc murrayc com>
 
 	Added a simple example of a D-Bus session bus service.
diff --git a/gio/src/dbusconnection.ccg b/gio/src/dbusconnection.ccg
index 99e9d83..f54a9fe 100644
--- a/gio/src/dbusconnection.ccg
+++ b/gio/src/dbusconnection.ccg
@@ -813,6 +813,21 @@ guint Connection::register_object(const Glib::ustring& object_path,
   return result;
 }
 
+guint Connection::register_object(const Glib::ustring& object_path,
+  const Glib::RefPtr<InterfaceInfo>& interface_info)
+{
+  GError* gerror = 0;
+
+  const guint result = g_dbus_connection_register_object(gobj(),
+    object_path.c_str(), Glib::unwrap(interface_info),
+    0, 0, 0, &gerror);
+
+  if(gerror)
+    ::Glib::Error::throw_exception(gerror);
+
+  return result;
+}
+
 guint Connection::register_subtree(const Glib::ustring& object_path,
   const SubtreeVTable& vtable, SubtreeFlags flags)
 {
diff --git a/gio/src/dbusconnection.hg b/gio/src/dbusconnection.hg
index d3069be..ebbc27a 100644
--- a/gio/src/dbusconnection.hg
+++ b/gio/src/dbusconnection.hg
@@ -838,8 +838,6 @@ public:
 
   _WRAP_METHOD(void remove_filter(guint filter_id), g_dbus_connection_remove_filter)
 
-  //TODO: See https://bugzilla.gnome.org/show_bug.cgi?id=646419 about
-  //vtable being allowed to be NULL, which would need a method overload.
   /** Registers slots for exported objects at @a object_path with the D-Bus
    * interface that is described in @a interface_info.
    *
@@ -882,6 +880,30 @@ public:
     const Glib::RefPtr<InterfaceInfo>& interface_info,
     const InterfaceVTable& vtable);
   _IGNORE(g_dbus_connection_register_object)
+  
+  /** Registers exported objects at @a object_path with the D-Bus
+   * interface that is described in @a interface_info. This method overload, 
+   * which does not take a VTable, is useful for 
+   * <a href=="http://en.wikipedia.org/wiki/Marker_interface_pattern";>marker
+   * interfaces</href>.
+   *
+   * If an existing slot is already registered at @a object_path and @a
+   * interface_name, then a Glib::Error is thrown.
+   *
+   * GDBus automatically implements the standard D-Bus interfaces
+   * org.freedesktop.DBus.Properties, org.freedesktop.DBus.Introspectable and
+   * org.freedesktop.Peer, so you don't have to implement those for the
+   * objects you export.
+   *
+   * @param object_path The object path to register at.
+   * @param interface_info Introspection data for the interface.
+   * @return A registration id (never 0) that can be used with
+   * unregister_object() if no Glib::Error is thrown.
+   * @throw Glib::Error.
+   * @newin{2,28}
+   */
+  guint register_object(const Glib::ustring& object_path,
+    const Glib::RefPtr<InterfaceInfo>& interface_info);
 
   _WRAP_METHOD(bool unregister_object(guint registration_id), g_dbus_connection_unregister_object)
 



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