[glibmm] DBusMessage: Add get_header() and set_header().
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm] DBusMessage: Add get_header() and set_header().
- Date: Thu, 22 Jul 2010 21:06:00 +0000 (UTC)
commit 62e25985dd7b5d27fc8177fe82579b1a647e61fb
Author: Murray Cumming <murrayc murrayc com>
Date: Thu Jul 22 23:05:53 2010 +0200
DBusMessage: Add get_header() and set_header().
* gio/src/dbusmessage.[hg|ccg]: Add get_header(), using a VariantBase output
parameter, and set_header().
* gio/src/settings.[hg|ccg]: get_value(): Make this const too.
* tools/m4/convert_gio.m4: Added conversions.
ChangeLog | 9 +++++++++
gio/src/dbusmessage.ccg | 9 +++++++++
gio/src/dbusmessage.hg | 13 ++++++++-----
gio/src/settings.ccg | 4 ++--
gio/src/settings.hg | 2 +-
glib/src/variant.hg | 6 ++++++
tools/m4/convert_gio.m4 | 1 +
7 files changed, 36 insertions(+), 8 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index a1a78f6..c6b13f3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2010-07-22 Murray Cumming <murrayc murrayc com>
+ DBusMessage: Add get_header() and set_header().
+
+ * gio/src/dbusmessage.[hg|ccg]: Add get_header(), using a VariantBase output
+ parameter, and set_header().
+ * gio/src/settings.[hg|ccg]: get_value(): Make this const too.
+ * tools/m4/convert_gio.m4: Added conversions.
+
+2010-07-22 Murray Cumming <murrayc murrayc com>
+
Variant<>: Make this usable as an ouput parameter.
* glib/src/variant.[hg|ccg]: VariantBase: Added init(), like Value::init().
diff --git a/gio/src/dbusmessage.ccg b/gio/src/dbusmessage.ccg
index 555a34b..5b8e9b3 100644
--- a/gio/src/dbusmessage.ccg
+++ b/gio/src/dbusmessage.ccg
@@ -22,4 +22,13 @@
namespace Gio
{
+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 */);
+}
+
} // namespace Gio
diff --git a/gio/src/dbusmessage.hg b/gio/src/dbusmessage.hg
index 49cedbe..748907f 100644
--- a/gio/src/dbusmessage.hg
+++ b/gio/src/dbusmessage.hg
@@ -18,6 +18,7 @@
*/
#include <glibmm/object.h>
+#include <glibmm/variant.h>
_DEFS(giomm,gio)
_PINCLUDE(glibmm/private/object_p.h)
@@ -27,6 +28,7 @@ namespace Gio
_WRAP_ENUM(DBusMessageType, GDBusMessageType, NO_GTYPE)
_WRAP_ENUM(DBusMessageFlags, GDBusMessageFlags, NO_GTYPE)
+_WRAP_ENUM(DBusMessageHeaderField, GDBusMessageHeaderField, NO_GTYPE)
/** TODO
*
@@ -60,12 +62,13 @@ public:
_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:
+ 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(GVariant *g_dbus_message_get_header (
- GDBusMessageHeaderField header_field);
- _WRAP_METHOD(void g_dbus_message_set_header (
- GDBusMessageHeaderField header_field,
- GVariant *value);
_WRAP_METHOD(guchar *g_dbus_message_get_header_fields (), )
_WRAP_METHOD(GVariant *g_dbus_message_get_body (), )
diff --git a/gio/src/settings.ccg b/gio/src/settings.ccg
index feaba2a..8174ecc 100644
--- a/gio/src/settings.ccg
+++ b/gio/src/settings.ccg
@@ -3,9 +3,9 @@
namespace Gio
{
-void Settings::get_value(const Glib::ustring& key, Glib::VariantBase& value)
+void Settings::get_value(const Glib::ustring& key, Glib::VariantBase& value) const
{
- GVariant* const g_value = g_settings_get_value(gobj(), key.c_str());
+ GVariant* const g_value = g_settings_get_value(const_cast<GSettings*>(gobj()), key.c_str());
if(!g_value)
return;
diff --git a/gio/src/settings.hg b/gio/src/settings.hg
index d06b55a..44a16db 100644
--- a/gio/src/settings.hg
+++ b/gio/src/settings.hg
@@ -56,7 +56,7 @@ public:
/** TODO: Documentation.
*/
- void get_value(const Glib::ustring& key, Glib::VariantBase& value);
+ void get_value(const Glib::ustring& key, Glib::VariantBase& value) const;
_IGNORE(g_settings_get_value);
_WRAP_METHOD(int get_int(const Glib::ustring& key) const, g_settings_get_int)
diff --git a/glib/src/variant.hg b/glib/src/variant.hg
index 83306ab..829a98f 100644
--- a/glib/src/variant.hg
+++ b/glib/src/variant.hg
@@ -44,6 +44,12 @@ class VariantBase
g_variant_get, g_variant_get_va)
public:
+ /** Replace the underlying GVariant.
+ * This is for use by methods that take a VariantBase& as an output parameter.
+ *
+ * @param cobject The GVariant* obtained from a C function.
+ * @param take_a_reference Whether this method should take a reference, for instance if the C function has not given one.
+ */
void init(const GVariant* cobject, bool take_a_reference = false);
_WRAP_METHOD(bool is_container() const, g_variant_is_container)
diff --git a/tools/m4/convert_gio.m4 b/tools/m4/convert_gio.m4
index 30694f2..72eaa8c 100644
--- a/tools/m4/convert_gio.m4
+++ b/tools/m4/convert_gio.m4
@@ -29,6 +29,7 @@ _CONV_ENUM(G,DBusCapabilityFlags)
_CONV_ENUM(G,DBusSendMessageFlags)
_CONV_ENUM(G,DBusMessageType)
_CONV_ENUM(G,DBusMessageFlags)
+_CONV_ENUM(G,DBusMessageHeaderField)
# AppInfo
_CONVERSION(`GAppInfo*',`Glib::RefPtr<AppInfo>',`Glib::wrap($3)')
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]