diff options
author | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2011-04-26 17:52:19 +0100 |
---|---|---|
committer | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2011-04-26 17:52:19 +0100 |
commit | dcb9f16c35c28ddd426f5d4db3455ca312705271 (patch) | |
tree | 06864785fa9d8dd036e6c8f8f176f34ccc6ba0bd | |
parent | 72a9105d6306784a4708c34efeb1bbd660098fe3 (diff) |
caps-manager: only add name and capabilities fields if there are some
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
-rw-r--r-- | salut/caps-manager.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/salut/caps-manager.c b/salut/caps-manager.c index 8762b62..c2ece5a 100644 --- a/salut/caps-manager.c +++ b/salut/caps-manager.c @@ -139,13 +139,19 @@ make_new_data_form (const gchar *uid, /* do the next two by hand as we'll need to add the values * manually */ - tmp = wocky_node_add_child (node, "field"); - wocky_node_set_attribute (tmp, "var", "name"); - g_ptr_array_foreach (names, add_value_to_field, tmp); + if (names->len > 0) + { + tmp = wocky_node_add_child (node, "field"); + wocky_node_set_attribute (tmp, "var", "name"); + g_ptr_array_foreach (names, add_value_to_field, tmp); + } - tmp = wocky_node_add_child (node, "field"); - wocky_node_set_attribute (tmp, "var", "capabilities"); - g_ptr_array_foreach (caps, add_value_to_field, tmp); + if (caps->len > 0) + { + tmp = wocky_node_add_child (node, "field"); + wocky_node_set_attribute (tmp, "var", "capabilities"); + g_ptr_array_foreach (caps, add_value_to_field, tmp); + } out = wocky_data_form_new_from_node (node, NULL); |