[glibmm] Gio::Message: Wrap several methods.
- From: José Alburquerque <jaalburqu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm] Gio::Message: Wrap several methods.
- Date: Wed, 28 Jul 2010 02:40:57 +0000 (UTC)
commit 0e17b03af96429f313771b9330fc42ec6fa198b0
Author: José Alburquerque <jaalburqu svn gnome org>
Date: Tue Jul 27 17:49:34 2010 -0400
Gio::Message: Wrap several methods.
* gio/src/dbusmessage.ccg:
* gio/src/dbusmessage.hg: Wrap create_method_error_literal(),
get_body(), set_body(), [get|set|unset]_unix_fd_list(). Reordered
method declarations according to the C declarations. Added class and
method docs.
* tools/m4/convert_gio.m4: Added conversions for new methods above.
ChangeLog | 11 +++++++
gio/src/dbusmessage.ccg | 27 ++++++++++++++++-
gio/src/dbusmessage.hg | 72 +++++++++++++++++++++++++++++-----------------
tools/m4/convert_gio.m4 | 5 +++
4 files changed, 86 insertions(+), 29 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b3dc1c7..750d89a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2010-07-27 José Alburquerque <jaalburqu svn gnome org>
+ Gio::Message: Wrap several methods.
+
+ * gio/src/dbusmessage.ccg:
+ * gio/src/dbusmessage.hg: Wrap create_method_error_literal(),
+ get_body(), set_body(), [get|set|unset]_unix_fd_list(). Reordered
+ method declarations according to the C declarations. Added class and
+ method docs.
+ * tools/m4/convert_gio.m4: Added conversions for new methods above.
+
+2010-07-27 José Alburquerque <jaalburqu svn gnome org>
+
Gio::UnixFDList: peek_fds(): Made return const for emphasis.
* gio/src/unixfdlist.ccg:
diff --git a/gio/src/dbusmessage.ccg b/gio/src/dbusmessage.ccg
index 5b8e9b3..500ae84 100644
--- a/gio/src/dbusmessage.ccg
+++ b/gio/src/dbusmessage.ccg
@@ -18,17 +18,40 @@
*/
#include <gio/gio.h>
+#ifdef G_OS_UNIX
+#include <giomm/unixfdlist.h>
+#endif //G_OS_UNIX
namespace Gio
{
-void DBusMessage::get_header(Glib::VariantBase& value, DBusMessageHeaderField header_field) const
+void DBusMessage::get_body(Glib::VariantBase& value) const
{
- GVariant* const g_value = g_dbus_message_get_header(const_cast<GDBusMessage*>(gobj()), ((GDBusMessageHeaderField)(header_field)));
+ GVariant* const g_value =
+ g_dbus_message_get_body(const_cast<GDBusMessage*>(gobj()));
+
+ if(!g_value)
+ return;
+
+ value.init(g_value, true /* take a reference */);
+}
+
+void DBusMessage::get_header(Glib::VariantBase& value,
+ DBusMessageHeaderField header_field) const
+{
+ GVariant* const g_value =
+ g_dbus_message_get_header(const_cast<GDBusMessage*>(gobj()),
+ ((GDBusMessageHeaderField)(header_field)));
+
if(!g_value)
return;
value.init(g_value, true /* take a reference */);
}
+
+void DBusMessage::unset_unix_fd_list()
+{
+ g_dbus_message_set_unix_fd_list(gobj(), 0);
+}
} // namespace Gio
diff --git a/gio/src/dbusmessage.hg b/gio/src/dbusmessage.hg
index 748907f..25e0413 100644
--- a/gio/src/dbusmessage.hg
+++ b/gio/src/dbusmessage.hg
@@ -30,7 +30,11 @@ _WRAP_ENUM(DBusMessageType, GDBusMessageType, NO_GTYPE)
_WRAP_ENUM(DBusMessageFlags, GDBusMessageFlags, NO_GTYPE)
_WRAP_ENUM(DBusMessageHeaderField, GDBusMessageHeaderField, NO_GTYPE)
-/** TODO
+class UnixFDList;
+
+/** DBusMessage - D-Bus Message.
+ * A type for representing D-Bus messages that can be sent or received on a
+ * DBusConnection.
*
* @newin{2,26}
*/
@@ -43,7 +47,7 @@ protected:
_IGNORE(g_dbus_message_new)
public:
-
+ _WRAP_METHOD_DOCS_ONLY(g_dbus_message_new)
_WRAP_CREATE()
// TODO: We can't use _WRAP_CTOR() and _WRAP_CREATE() because the C functions do more than just call g_object_new():
@@ -52,36 +56,56 @@ public:
_WRAP_METHOD(static Glib::RefPtr<DBusMessage> create_signal(const Glib::ustring& path, const Glib::ustring& interface, const Glib::ustring& signal), g_dbus_message_new_signal)
_WRAP_METHOD(static Glib::RefPtr<DBusMessage> create_method_call(const Glib::ustring& name, const Glib::ustring& path, const Glib::ustring& interface, const Glib::ustring& method), g_dbus_message_new_method_call)
_WRAP_METHOD(static Glib::RefPtr<DBusMessage> create_method_reply(const Glib::RefPtr<DBusMessage>& method_call_message), g_dbus_message_new_method_reply)
+ _WRAP_METHOD(static Glib::RefPtr<DBusMessage> create_method_error_literal(const Glib::RefPtr<const DBusMessage>& method_call_message, const Glib::ustring& error_name, const Glib::ustring& error_message), g_dbus_message_new_method_error_literal)
_WRAP_METHOD(Glib::ustring print(guint indent), g_dbus_message_print)
_WRAP_METHOD(DBusMessageType get_message_type() const, g_dbus_message_get_message_type)
_WRAP_METHOD(void set_message_type(DBusMessageType type), g_dbus_message_set_message_type)
- _WRAP_METHOD(DBusMessageFlags get_flags() const, g_dbus_message_get_flags)
- _WRAP_METHOD(void set_flags(DBusMessageFlags flags), g_dbus_message_set_flags)
+
_WRAP_METHOD(guint32 get_serial() const, g_dbus_message_get_serial)
_WRAP_METHOD(void set_serial(guint32 serial), g_dbus_message_set_serial)
- //TODO: Documentation:
+ _WRAP_METHOD(DBusMessageFlags get_flags() const, g_dbus_message_get_flags)
+ _WRAP_METHOD(void set_flags(DBusMessageFlags flags), g_dbus_message_set_flags)
+
+ /** Gets the body of a message. The body is returned in @a value.
+ * @param value Location in which to store the header.
+ */
+ void get_body(Glib::VariantBase& value) const;
+ _IGNORE(g_dbus_message_get_body)
+
+ _WRAP_METHOD(void set_body(const Glib::VariantBase& body), g_dbus_message_set_body)
+
+#ifdef G_OS_UNIX
+ _WRAP_METHOD(Glib::RefPtr<UnixFDList> get_unix_fd_list(), g_dbus_message_get_unix_fd_list)
+ _WRAP_METHOD(Glib::RefPtr<const UnixFDList> get_unix_fd_list() const, g_dbus_message_get_unix_fd_list, constversion)
+ _WRAP_METHOD(void set_unix_fd_list(const Glib::RefPtr<UnixFDList>& fd_list), g_dbus_message_set_unix_fd_list)
+
+ /** Clears the existing UNIX file descriptor list.
+ */
+ void unset_unix_fd_list();
+#endif //G_OS_UNIX
+
+ _WRAP_METHOD(guint32 get_num_unix_fds() const, g_dbus_message_get_num_unix_fds)
+ _WRAP_METHOD(void set_num_unix_fds(guint32 value), g_dbus_message_set_num_unix_fds)
+
+ //TODO: _WRAP_METHOD(guchar* get_header_fields() const, g_dbus_message_get_header_fields)
+
+ /** Gets a header field on the message. The header is returned in @a value.
+ * @param value Location in which to store the header.
+ * @param header_field The header field type.
+ */
void get_header(Glib::VariantBase& value, DBusMessageHeaderField header_field) const;
_IGNORE(g_dbus_message_get_header)
_WRAP_METHOD(void set_header(DBusMessageHeaderField header_field, const Glib::VariantBase& value), g_dbus_message_set_header)
-
-/* TODO:
-
- _WRAP_METHOD(guchar *g_dbus_message_get_header_fields (), )
- _WRAP_METHOD(GVariant *g_dbus_message_get_body (), )
- _WRAP_METHOD(void g_dbus_message_set_body (
- GVariant *body);
- _WRAP_METHOD(GUnixFDList *g_dbus_message_get_unix_fd_list (), )
- _WRAP_METHOD(void g_dbus_message_set_unix_fd_list (
- GUnixFDList *fd_list);
-*/
+ _WRAP_METHOD(Glib::ustring get_destination() const, g_dbus_message_get_destination)
+ _WRAP_METHOD(void set_destination(const Glib::ustring& value), g_dbus_message_set_destination)
- _WRAP_METHOD(guint32 get_reply_serial() const, g_dbus_message_get_reply_serial)
- _WRAP_METHOD(void set_reply_serial(guint32 value), g_dbus_message_set_reply_serial)
+ _WRAP_METHOD(Glib::ustring get_error_name() const, g_dbus_message_get_error_name)
+ _WRAP_METHOD(void set_error_name(const Glib::ustring& value), g_dbus_message_set_error_name)
_WRAP_METHOD(Glib::ustring get_interface() const, g_dbus_message_get_interface)
_WRAP_METHOD(void set_interface(const Glib::ustring& value), g_dbus_message_set_interface)
@@ -92,21 +116,15 @@ public:
_WRAP_METHOD(Glib::ustring get_path() const, g_dbus_message_get_path)
_WRAP_METHOD(void set_path(const Glib::ustring& value), g_dbus_message_set_path)
+ _WRAP_METHOD(guint32 get_reply_serial() const, g_dbus_message_get_reply_serial)
+ _WRAP_METHOD(void set_reply_serial(guint32 value), g_dbus_message_set_reply_serial)
+
_WRAP_METHOD(Glib::ustring get_sender() const, g_dbus_message_get_sender)
_WRAP_METHOD(void set_sender(const Glib::ustring& value), g_dbus_message_set_sender)
- _WRAP_METHOD(Glib::ustring get_destination() const, g_dbus_message_get_destination)
- _WRAP_METHOD(void set_destination(const Glib::ustring& value), g_dbus_message_set_destination)
-
- _WRAP_METHOD(Glib::ustring get_error_name() const, g_dbus_message_get_error_name)
- _WRAP_METHOD(void set_error_name(const Glib::ustring& value), g_dbus_message_set_error_name)
-
_WRAP_METHOD(Glib::ustring get_signature() const, g_dbus_message_get_signature)
_WRAP_METHOD(void set_signature(const Glib::ustring& value), g_dbus_message_set_signature)
- _WRAP_METHOD(guint32 get_num_unix_fds(), g_dbus_message_get_num_unix_fds)
- _WRAP_METHOD(void set_num_unix_fds(guint32 value), g_dbus_message_set_num_unix_fds)
-
_WRAP_METHOD(Glib::ustring get_arg0() const, g_dbus_message_get_arg0)
};
diff --git a/tools/m4/convert_gio.m4 b/tools/m4/convert_gio.m4
index 7470423..128a8cb 100644
--- a/tools/m4/convert_gio.m4
+++ b/tools/m4/convert_gio.m4
@@ -64,6 +64,7 @@ _CONVERSION(`const Glib::RefPtr<DBusConnection>&',`GDBusConnection*',__CONVERT_R
# DBusMessage
_CONVERSION(`const Glib::RefPtr<DBusMessage>&',`GDBusMessage*',__CONVERT_REFPTR_TO_P)
_CONVERSION(`GDBusMessage*',`Glib::RefPtr<DBusMessage>',`Glib::wrap($3)')
+_CONVERSION(`const Glib::RefPtr<const DBusMessage>&',`GDBusMessage*',__CONVERT_CONST_REFPTR_TO_P)
# DesktopAppInfo
_CONVERSION(`GDesktopAppInfo*', `Glib::RefPtr<DesktopAppInfo>', `Glib::wrap($3)')
@@ -176,6 +177,10 @@ _CONVERSION(`GSocketConnection*',`Glib::RefPtr<SocketConnection>',`Glib::wrap($3
_CONVERSION(`GSocketConnection*',`const Glib::RefPtr<SocketConnection>&',`Glib::wrap($3)')
_CONVERSION(`const Glib::RefPtr<SocketConnection>&',`GSocketConnection*',__CONVERT_CONST_REFPTR_TO_P)
+#UnixFDList
+_CONVERSION(`GUnixFDList*',`Glib::RefPtr<UnixFDList>',`Glib::wrap($3)')
+_CONVERSION(`const Glib::RefPtr<UnixFDList>&',`GUnixFDList*',`Glib::unwrap($3)')
+
#Volume
_CONVERSION(`GVolume*',`Glib::RefPtr<Volume>',`Glib::wrap($3)')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]