[glibmm] Variant< std::vector<std::string> >: Correct the getting of the array.
- From: José Alburquerque <jaalburqu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glibmm] Variant< std::vector<std::string> >: Correct the getting of the array.
- Date: Wed, 22 Dec 2010 05:12:20 +0000 (UTC)
commit 75b9136f81562ee898de1e220f196a93921cdffd
Author: José Alburquerque <jaalburqu svn gnome org>
Date: Wed Dec 22 00:10:52 2010 -0500
Variant< std::vector<std::string> >: Correct the getting of the array.
* glib/src/variant.{ccg,hg} (get): Use
g_variant_get_bytestring_array() in the get() methods instead of
g_variant_get_strv().
* examples/dbus/well-known-address-client.cc: Use a
VariantContainerBase to get the result of the proxy's call method
instead of a Variant<VariantBase>. Also corrected the comment about
why it is done that way.
ChangeLog | 16 ++++++++++++++--
examples/dbus/well-known-address-client.cc | 9 ++++-----
glib/src/variant.ccg | 8 ++++----
glib/src/variant.hg | 8 ++++----
4 files changed, 26 insertions(+), 15 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 80c05b2..b5dc819 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2010-12-22 José Alburquerque <jaalburqu svn gnome org>
+
+ Variant< std::vector<std::string> >: Correct the getting of the array.
+
+ * glib/src/variant.{ccg,hg} (get): Use
+ g_variant_get_bytestring_array() in the get() methods instead of
+ g_variant_get_strv().
+ * examples/dbus/well-known-address-client.cc: Use a
+ VariantContainerBase to get the result of the proxy's call method
+ instead of a Variant<VariantBase>. Also corrected the comment about
+ why it is done that way.
+
2010-12-21 José Alburquerque <jaalburqu svn gnome org>
DBus: Well known service example: Complete the example.
@@ -598,7 +610,7 @@
Application: Re-wrap according to the latest API.
- * gio/src/application.{ccg, hg}: Re-wrapped the API according to the
+ * gio/src/application.{ccg,hg}: Re-wrapped the API according to the
recent changes in the C API. Old methods were removed and new ones
wrapped. Also wrapped its properties.
* tools/m4/convert_gio.m4: Added necessary conversion.
@@ -611,7 +623,7 @@
* gio/src/gio_signals.defs: Add the GActionGroup type to the extra
defs generation tool and regenerate the signal defs file to get the
signals of GActionGroup.
- * gio/src/actiongroup.{ccg, hg}:
+ * gio/src/actiongroup.{ccg,hg}:
* gio/src/filelist.am: Add new ActionGroup interface sources and
mention them so they are build.
diff --git a/examples/dbus/well-known-address-client.cc b/examples/dbus/well-known-address-client.cc
index 0db6447..dc69dae 100644
--- a/examples/dbus/well-known-address-client.cc
+++ b/examples/dbus/well-known-address-client.cc
@@ -46,13 +46,12 @@ void dbus_proxy_available(Glib::RefPtr<Gio::AsyncResult>& result)
try
{
- // The 'ListNames' method returns a single element tuple of string arrays
- // so first receive the tuple as a VariantBase container (that works fine
- // for now).
- Glib::Variant<Glib::VariantBase> result;
+ // The proxy's call method returns a tuple of the value(s) that the method
+ // call produces so just get the tuple as a VariantContainerBase.
+ Glib::VariantContainerBase result;
proxy->call_sync(result, "ListNames");
- // Now extract the single item in the VariantBase container which is the
+ // Now extract the single item in the variant container which is the
// array of strings (the names).
Glib::Variant< std::vector<Glib::ustring> > names_variant;
result.get(names_variant);
diff --git a/glib/src/variant.ccg b/glib/src/variant.ccg
index be39d52..7a3d2ac 100644
--- a/glib/src/variant.ccg
+++ b/glib/src/variant.ccg
@@ -281,8 +281,8 @@ std::string Variant<type_vec_string>::get(gsize index) const
{
gsize n_elements = 0;
- const gchar** array = g_variant_get_strv(const_cast<GVariant*>(gobj()),
- &n_elements);
+ const gchar** array =
+ g_variant_get_bytestring_array(const_cast<GVariant*>(gobj()), &n_elements);
if(index > n_elements)
throw std::runtime_error(
@@ -295,8 +295,8 @@ type_vec_string Variant<type_vec_string>::get() const
{
gsize n_elements = 0;
- const gchar** array = g_variant_get_strv(const_cast<GVariant*>(gobj()),
- &n_elements);
+ const gchar** array =
+ g_variant_get_bytestring_array(const_cast<GVariant*>(gobj()), &n_elements);
type_vec_string result(array, array + n_elements);
return result;
diff --git a/glib/src/variant.hg b/glib/src/variant.hg
index abfd3fe..110c1d8 100644
--- a/glib/src/variant.hg
+++ b/glib/src/variant.hg
@@ -209,7 +209,7 @@ public:
* variants, maybes, arrays, tuples and dictionary entries.
*
* It is an error if @a index is greater than the number of child items in
- * the container. See n_children().
+ * the container. See get_n_children().
*
* This function is O(1).
*
@@ -440,7 +440,7 @@ public:
/** Gets a specific element of the array. It is an error if index is
* greater than the number of child items in the container. See
- * Glib::Variant<VariantBase>::n_children().
+ * Glib::VariantContainerBase::get_n_children().
*
* This function is O(1).
*
@@ -506,7 +506,7 @@ public:
/** Gets a specific element of the string array. It is an error if index is
* greater than the number of child items in the container. See
- * Glib::Variant<VariantBase>::n_children().
+ * Glib::VariantContainerBase::get_n_children().
*
* This function is O(1).
*
@@ -570,7 +570,7 @@ public:
/** Gets a specific element of the string array. It is an error if index is
* greater than the number of child items in the container. See
- * Glib::Variant<VariantBase>::n_children().
+ * Glib::VariantContainerBase::get_n_children().
*
* This function is O(1).
*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]