summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorJens Georg <mail@jensge.org>2021-06-09 23:45:51 +0200
committerJens Georg <mail@jensge.org>2021-07-03 18:48:00 +0200
commit7139a8e26985ea01a302b6419a2e965eb905062d (patch)
tree4dd3d96fa478dbff674c22dd4705de230812ae46 /examples
parentbfa328563f2279403adfc801b68b5f4bb672bb00 (diff)
downloadgupnp-7139a8e26985ea01a302b6419a2e965eb905062d.tar.gz
examples: Use varargs version in C example
Diffstat (limited to 'examples')
-rw-r--r--examples/get-volume.c28
1 files changed, 5 insertions, 23 deletions
diff --git a/examples/get-volume.c b/examples/get-volume.c
index 923581c..9dbdac6 100644
--- a/examples/get-volume.c
+++ b/examples/get-volume.c
@@ -64,35 +64,17 @@ on_introspection (GObject *object, GAsyncResult *res, gpointer user_data)
i,
state_variable_name)
->allowed_values->data;
- g_print ("Calling GetVolume for channel %s", channel);
- GList *in_names = NULL;
- in_names = g_list_prepend (in_names, g_strdup ("Channel"));
- in_names = g_list_prepend (in_names, g_strdup ("InstanceID"));
- GList *in_values = NULL;
- GValue instance = G_VALUE_INIT;
- g_value_init (&instance, G_TYPE_INT);
- g_value_set_int (&instance, 0);
- in_values = g_list_prepend (in_values, &instance);
- GValue channel_v = G_VALUE_INIT;
- g_value_init (&channel_v, G_TYPE_STRING);
- g_value_set_string (&channel_v, channel);
+ g_print ("Calling GetVolume for channel %s...", channel);
GUPnPServiceProxyAction *a =
- gupnp_service_proxy_action_new_from_list ("GetVolume",
- in_names,
- in_values);
- g_list_free_full (in_names, g_free);
- g_list_free (in_values);
- g_value_unset (&channel_v);
-
- g_boxed_copy (gupnp_service_proxy_action_get_type (), a);
-
+ gupnp_service_proxy_action_new ("GetVolume",
+ "InstanceID", G_TYPE_INT, 0,
+ "Channel", G_TYPE_STRING, channel,
+ NULL);
gupnp_service_proxy_call_action (GUPNP_SERVICE_PROXY (object),
a,
NULL,
&error);
- g_boxed_free (gupnp_service_proxy_action_get_type (), a);
-
GList *out_names = NULL;
out_names = g_list_prepend (out_names, "CurrentVolume");