summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanielle Madeley <danielle.madeley@collabora.co.uk>2010-03-29 13:47:18 +1100
committerDanielle Madeley <danielle.madeley@collabora.co.uk>2010-03-29 13:47:18 +1100
commit30816b8eeee3f5cbb78c514d3531ef3c12c1c94c (patch)
tree5bd4b7a5c4b60c11c854254ad9f7582a0673bf0e
parent8c9f2d31a092269c195c05ecca743311fcdd58d2 (diff)
Port GValueArray unpacking to tp_value_array_unpack
-rw-r--r--docs/examples/glib_dbus_tube/accept-tube.c10
-rw-r--r--docs/examples/glib_dbus_tube/offer-tube.c10
-rw-r--r--docs/examples/glib_get_roster/example.c20
-rw-r--r--docs/examples/glib_get_user_defined_groups/example.c10
-rw-r--r--docs/examples/glib_jabber_muc/example.c22
-rw-r--r--docs/examples/glib_mc5_dbus_tube_handler/example-handler.c8
-rw-r--r--docs/examples/glib_mc5_ft_handler/example-handler.c7
-rw-r--r--docs/examples/glib_mc5_observer/example-observer.c6
-rw-r--r--docs/examples/glib_salut_ft/gnio-receiver.c10
-rw-r--r--docs/examples/glib_salut_ft/receiver.c10
-rw-r--r--docs/examples/glib_stream_tube/accept-tube.c10
-rw-r--r--docs/examples/glib_stream_tube/offer-tube.c10
-rw-r--r--docs/examples/glib_telepathy_properties/example.c40
-rw-r--r--docs/examples/gtk_presence_app/presence-chooser.c10
14 files changed, 117 insertions, 66 deletions
diff --git a/docs/examples/glib_dbus_tube/accept-tube.c b/docs/examples/glib_dbus_tube/accept-tube.c
index cee084d..7b5a337 100644
--- a/docs/examples/glib_dbus_tube/accept-tube.c
+++ b/docs/examples/glib_dbus_tube/accept-tube.c
@@ -117,10 +117,12 @@ new_channels_cb (TpConnection *conn,
for (i = 0; i < channels->len; i++)
{
GValueArray *channel = g_ptr_array_index (channels, i);
- char *object_path = g_value_get_boxed (
- g_value_array_get_nth (channel, 0));
- GHashTable *map = g_value_get_boxed (
- g_value_array_get_nth (channel, 1));
+ char *object_path;
+ GHashTable *map;
+
+ tp_value_array_unpack (channel, 2,
+ &object_path,
+ &map);
const char *type = tp_asv_get_string (map,
TP_IFACE_CHANNEL ".ChannelType");
diff --git a/docs/examples/glib_dbus_tube/offer-tube.c b/docs/examples/glib_dbus_tube/offer-tube.c
index d69b5c2..67d0645 100644
--- a/docs/examples/glib_dbus_tube/offer-tube.c
+++ b/docs/examples/glib_dbus_tube/offer-tube.c
@@ -121,10 +121,12 @@ new_channels_cb (TpConnection *conn,
for (i = 0; i < channels->len; i++)
{
GValueArray *channel = g_ptr_array_index (channels, i);
- char *object_path = g_value_get_boxed (
- g_value_array_get_nth (channel, 0));
- GHashTable *map = g_value_get_boxed (
- g_value_array_get_nth (channel, 1));
+ char *object_path;
+ GHashTable *map;
+
+ tp_value_array_unpack (channel, 2,
+ &object_path,
+ &map);
const char *type = tp_asv_get_string (map,
TP_IFACE_CHANNEL ".ChannelType");
diff --git a/docs/examples/glib_get_roster/example.c b/docs/examples/glib_get_roster/example.c
index 88ba229..383a8ab 100644
--- a/docs/examples/glib_get_roster/example.c
+++ b/docs/examples/glib_get_roster/example.c
@@ -125,10 +125,12 @@ new_channels_cb (TpConnection *conn,
for (i = 0; i < channels->len; i++)
{
GValueArray *channel = g_ptr_array_index (channels, i);
- char *object_path = g_value_get_boxed (
- g_value_array_get_nth (channel, 0));
- GHashTable *map = g_value_get_boxed (
- g_value_array_get_nth (channel, 1));
+ char *object_path;
+ GHashTable *map;
+
+ tp_value_array_unpack (channel, 2,
+ &object_path,
+ &map);
/* begin ex.channel.requesting.glib.tpchannel */
const char *type = tp_asv_get_string (map,
@@ -187,10 +189,12 @@ presences_changed_cb (TpConnection *conn,
int contact = GPOINTER_TO_UINT (key);
GValueArray *spresence = (GValueArray *) value;
- const char *status = g_value_get_string (
- g_value_array_get_nth (spresence, 1));
- const char *status_message = g_value_get_string (
- g_value_array_get_nth (spresence, 2));
+ const char *status, *status_message;
+
+ tp_value_array_unpack (spresence, 3,
+ NULL,
+ &status,
+ &status_message);
g_print ("Contact handle %i -> %s - %s\n",
contact, status, status_message);
diff --git a/docs/examples/glib_get_user_defined_groups/example.c b/docs/examples/glib_get_user_defined_groups/example.c
index 271dba6..0e7907a 100644
--- a/docs/examples/glib_get_user_defined_groups/example.c
+++ b/docs/examples/glib_get_user_defined_groups/example.c
@@ -45,10 +45,12 @@ new_channels_cb (TpConnection *conn,
for (i = 0; i < channels->len; i++)
{
GValueArray *channel = g_ptr_array_index (channels, i);
- char *object_path = g_value_get_boxed (
- g_value_array_get_nth (channel, 0));
- GHashTable *map = g_value_get_boxed (
- g_value_array_get_nth (channel, 1));
+ char *object_path;
+ GHashTable *map;
+
+ tp_value_array_unpack (channel, 2,
+ &object_path,
+ &map);
const char *type = tp_asv_get_string (map,
TP_IFACE_CHANNEL ".ChannelType");
diff --git a/docs/examples/glib_jabber_muc/example.c b/docs/examples/glib_jabber_muc/example.c
index 4c61804..d5d67de 100644
--- a/docs/examples/glib_jabber_muc/example.c
+++ b/docs/examples/glib_jabber_muc/example.c
@@ -46,10 +46,12 @@ new_channels_cb (TpConnection *conn,
for (i = 0; i < channels->len; i++)
{
GValueArray *channel = g_ptr_array_index (channels, i);
- char *object_path = g_value_get_boxed (
- g_value_array_get_nth (channel, 0));
- GHashTable *map = g_value_get_boxed (
- g_value_array_get_nth (channel, 1));
+ char *object_path;
+ GHashTable *map;
+
+ tp_value_array_unpack (channel, 2,
+ &object_path,
+ &map);
const char *type = tp_asv_get_string (map,
TP_IFACE_CHANNEL ".ChannelType");
@@ -123,10 +125,14 @@ list_properties_cb (TpProxy *channel,
{
GValueArray *prop = g_ptr_array_index (available_properties, i);
- guint id = g_value_get_uint (g_value_array_get_nth (prop, 0));
- const char *name = g_value_get_string (g_value_array_get_nth (prop, 1));
- const char *sig = g_value_get_string (g_value_array_get_nth (prop, 2));
- guint flags = g_value_get_uint (g_value_array_get_nth (prop, 3));
+ guint id, flags;
+ const char *name, *sig;
+
+ tp_value_array_unpack (prop, 4,
+ &id,
+ &name,
+ &sig,
+ &flags);
g_print ("%u %s (%s) %x\n", id, name, sig, flags);
diff --git a/docs/examples/glib_mc5_dbus_tube_handler/example-handler.c b/docs/examples/glib_mc5_dbus_tube_handler/example-handler.c
index cb5ad1e..d45fcf3 100644
--- a/docs/examples/glib_mc5_dbus_tube_handler/example-handler.c
+++ b/docs/examples/glib_mc5_dbus_tube_handler/example-handler.c
@@ -188,8 +188,12 @@ example_handler_handle_channels (TpSvcClientHandler *self,
{
GValueArray *channel = g_ptr_array_index (channels, i);
- char *path = g_value_get_boxed (g_value_array_get_nth (channel, 0));
- GHashTable *map = g_value_get_boxed (g_value_array_get_nth (channel, 1));
+ char *path;
+ GHashTable *map;
+
+ tp_value_array_unpack (channel, 2,
+ &path,
+ &map);
const char *type = tp_asv_get_string (map,
TP_IFACE_CHANNEL ".ChannelType");
diff --git a/docs/examples/glib_mc5_ft_handler/example-handler.c b/docs/examples/glib_mc5_ft_handler/example-handler.c
index 8bc2868..154ea82 100644
--- a/docs/examples/glib_mc5_ft_handler/example-handler.c
+++ b/docs/examples/glib_mc5_ft_handler/example-handler.c
@@ -58,8 +58,11 @@ example_handler_handle_channels (TpSvcClientHandler *self,
{
GValueArray *channel = g_ptr_array_index (channels, i);
- char *path = g_value_get_boxed (g_value_array_get_nth (channel, 0));
- GHashTable *map = g_value_get_boxed (g_value_array_get_nth (channel, 1));
+ char *path;
+ GHashTable *map;
+
+ tp_value_array_unpack (channel, 2,
+ &path, &map);
g_print (" channel = %s\n", path);
}
diff --git a/docs/examples/glib_mc5_observer/example-observer.c b/docs/examples/glib_mc5_observer/example-observer.c
index a3aa381..b1d82e0 100644
--- a/docs/examples/glib_mc5_observer/example-observer.c
+++ b/docs/examples/glib_mc5_observer/example-observer.c
@@ -57,9 +57,11 @@ example_observer_observe_channels (TpSvcClientObserver *self,
for (i = 0; i < channels->len; i++)
{
GValueArray *channel = g_ptr_array_index (channels, i);
+ char *path;
+ GHashTable *map;
- char *path = g_value_get_boxed (g_value_array_get_nth (channel, 0));
- GHashTable *map = g_value_get_boxed (g_value_array_get_nth (channel, 1));
+ tp_value_array_unpack (channel, 2,
+ &path, &map);
g_print (" channel = %s\n", path);
}
diff --git a/docs/examples/glib_salut_ft/gnio-receiver.c b/docs/examples/glib_salut_ft/gnio-receiver.c
index eb9ff52..123a161 100644
--- a/docs/examples/glib_salut_ft/gnio-receiver.c
+++ b/docs/examples/glib_salut_ft/gnio-receiver.c
@@ -197,10 +197,12 @@ new_channels_cb (TpConnection *conn,
for (i = 0; i < channels->len; i++)
{
GValueArray *channel = g_ptr_array_index (channels, i);
- char *object_path = g_value_get_boxed (
- g_value_array_get_nth (channel, 0));
- GHashTable *map = g_value_get_boxed (
- g_value_array_get_nth (channel, 1));
+ char *object_path;
+ GHashTable *map;
+
+ tp_value_array_unpack (channel, 2,
+ &object_path,
+ &map);
const char *type = tp_asv_get_string (map,
TP_IFACE_CHANNEL ".ChannelType");
diff --git a/docs/examples/glib_salut_ft/receiver.c b/docs/examples/glib_salut_ft/receiver.c
index 0d613d2..22e4c84 100644
--- a/docs/examples/glib_salut_ft/receiver.c
+++ b/docs/examples/glib_salut_ft/receiver.c
@@ -208,10 +208,12 @@ new_channels_cb (TpConnection *conn,
for (i = 0; i < channels->len; i++)
{
GValueArray *channel = g_ptr_array_index (channels, i);
- char *object_path = g_value_get_boxed (
- g_value_array_get_nth (channel, 0));
- GHashTable *map = g_value_get_boxed (
- g_value_array_get_nth (channel, 1));
+ char *object_path;
+ GHashTable *map;
+
+ tp_value_array_unpack (channel, 2,
+ &object_path,
+ &map);
const char *type = tp_asv_get_string (map,
TP_IFACE_CHANNEL ".ChannelType");
diff --git a/docs/examples/glib_stream_tube/accept-tube.c b/docs/examples/glib_stream_tube/accept-tube.c
index 9e94d88..5240ca3 100644
--- a/docs/examples/glib_stream_tube/accept-tube.c
+++ b/docs/examples/glib_stream_tube/accept-tube.c
@@ -114,10 +114,12 @@ new_channels_cb (TpConnection *conn,
for (i = 0; i < channels->len; i++)
{
GValueArray *channel = g_ptr_array_index (channels, i);
- char *object_path = g_value_get_boxed (
- g_value_array_get_nth (channel, 0));
- GHashTable *map = g_value_get_boxed (
- g_value_array_get_nth (channel, 1));
+ char *object_path;
+ GHashTable *map;
+
+ tp_value_array_unpack (channel, 2,
+ &object_path,
+ &map);
const char *type = tp_asv_get_string (map,
TP_IFACE_CHANNEL ".ChannelType");
diff --git a/docs/examples/glib_stream_tube/offer-tube.c b/docs/examples/glib_stream_tube/offer-tube.c
index 18c4d0d..89fb11f 100644
--- a/docs/examples/glib_stream_tube/offer-tube.c
+++ b/docs/examples/glib_stream_tube/offer-tube.c
@@ -114,10 +114,12 @@ new_channels_cb (TpConnection *conn,
for (i = 0; i < channels->len; i++)
{
GValueArray *channel = g_ptr_array_index (channels, i);
- char *object_path = g_value_get_boxed (
- g_value_array_get_nth (channel, 0));
- GHashTable *map = g_value_get_boxed (
- g_value_array_get_nth (channel, 1));
+ char *object_path;
+ GHashTable *map;
+
+ tp_value_array_unpack (channel, 2,
+ &object_path,
+ &map);
const char *type = tp_asv_get_string (map,
TP_IFACE_CHANNEL ".ChannelType");
diff --git a/docs/examples/glib_telepathy_properties/example.c b/docs/examples/glib_telepathy_properties/example.c
index 5f6eca4..c73c90a 100644
--- a/docs/examples/glib_telepathy_properties/example.c
+++ b/docs/examples/glib_telepathy_properties/example.c
@@ -117,8 +117,13 @@ tp_properties_changed_cb (TpProxy *channel,
GValueArray *property = g_ptr_array_index (properties, i);
/* the id is a GValue<UINT>
* the variant is a GValue<GValue<??> */
- guint id = g_value_get_uint (g_value_array_get_nth (property, 0));
- GValue *value = g_value_get_boxed (g_value_array_get_nth (property, 1));
+ guint id;
+ GValue *value;
+
+ tp_value_array_unpack (property, 2,
+ &id,
+ &value);
+
TpProperty *tpproperty = tp_property_from_id (TP_PROXY (channel), id);
/* get a string representation of value */
@@ -142,12 +147,16 @@ tp_property_flags_changed_cb (TpProxy *channel,
for (i = 0; i < properties->len; i++)
{
GValueArray *property = g_ptr_array_index (properties, i);
- guint id = g_value_get_uint (g_value_array_get_nth (property, 0));
+ guint id, flags;
+
+ tp_value_array_unpack (property, 2,
+ &id,
+ &flags);
+
TpProperty *tpproperty = tp_property_from_id (TP_PROXY (channel), id);
g_print ("Property %s (%i): %x\n",
- tpproperty->name, id,
- g_value_get_uint (g_value_array_get_nth (property, 1)));
+ tpproperty->name, id, flags);
}
}
/* end ex.basics.tpproperties.flagchangecb */
@@ -170,8 +179,13 @@ tp_properties_get_cb (TpProxy *channel,
GValueArray *property = g_ptr_array_index (properties, i);
/* the id is a GValue<UINT>
* the variant is a GValue<GValue<??> */
- guint id = g_value_get_uint (g_value_array_get_nth (property, 0));
- GValue *value = g_value_get_boxed (g_value_array_get_nth (property, 1));
+ guint id;
+ GValue *value;
+
+ tp_value_array_unpack (property, 2,
+ &id,
+ &value);
+
TpProperty *tpproperty = tp_property_from_id (TP_PROXY (channel), id);
/* get a string representation of value */
@@ -201,10 +215,14 @@ list_properties_cb (TpProxy *channel,
{
GValueArray *prop = g_ptr_array_index (available_properties, i);
- guint id = g_value_get_uint (g_value_array_get_nth (prop, 0));
- const char *name = g_value_get_string (g_value_array_get_nth (prop, 1));
- const char *sig = g_value_get_string (g_value_array_get_nth (prop, 2));
- guint flags = g_value_get_uint (g_value_array_get_nth (prop, 3));
+ guint id, flags;
+ const char *name, *sig;
+
+ tp_value_array_unpack (prop, 4,
+ &id,
+ &name,
+ &sig,
+ &flags);
g_print ("%u %s (%s) %x\n", id, name, sig, flags);
diff --git a/docs/examples/gtk_presence_app/presence-chooser.c b/docs/examples/gtk_presence_app/presence-chooser.c
index 8dceecd..34d0ec2 100644
--- a/docs/examples/gtk_presence_app/presence-chooser.c
+++ b/docs/examples/gtk_presence_app/presence-chooser.c
@@ -103,11 +103,11 @@ presence_chooser_set_statuses (PresenceChooser *self,
char *status = k;
GValueArray *array = v;
- guint type = g_value_get_uint (g_value_array_get_nth (array, 0));
- gboolean set_on_self = g_value_get_boolean (
- g_value_array_get_nth (array, 1));
- gboolean can_have_message = g_value_get_boolean (
- g_value_array_get_nth (array, 2));
+ guint type;
+ gboolean set_on_self, can_have_message;
+
+ tp_value_array_unpack (array, 3,
+ &type, &set_on_self, &can_have_message);
if (!set_on_self) continue;