diff options
author | Murray Cumming <murrayc@murrayc.com> | 2011-04-02 15:14:09 +0200 |
---|---|---|
committer | Murray Cumming <murrayc@murrayc.com> | 2011-04-02 15:14:09 +0200 |
commit | f62a4d722632fdc83c9c68add45f7c4cdcf5d115 (patch) | |
tree | 448ba41f303e1f3176a39f36bca6f25cb06ab0e5 | |
parent | 99ed2652760b072174c4c45a1e7b8fad753c1dc2 (diff) | |
download | glibmm-f62a4d722632fdc83c9c68add45f7c4cdcf5d115.tar.gz |
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.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | gio/src/dbusconnection.ccg | 15 | ||||
-rw-r--r-- | gio/src/dbusconnection.hg | 26 |
3 files changed, 46 insertions, 2 deletions
@@ -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 99e9d839..f54a9fea 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 d3069be3..ebbc27ae 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) |