GVariant * gkd_secret_property_append_all (GckAttributes *attrs) { const GckAttribute *attr; DataType data_type; const gchar *name; gulong num, i; GVariantBuilder builder; GVariant *variant; g_return_val_if_fail (attrs, NULL); g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); num = gck_attributes_count (attrs); for (i = 0; i < num; ++i) { attr = gck_attributes_at (attrs, i); if (!attribute_to_property (attr->type, &name, &data_type)) g_return_val_if_reached (NULL); variant = iter_append_variant (data_type, attr); g_variant_builder_add (&builder, "{sv}", name, variant); g_variant_unref (variant); } return g_variant_builder_end (&builder); }
gboolean gkd_secret_property_append_all (DBusMessageIter *array, GckAttributes *attrs) { DBusMessageIter dict; const GckAttribute *attr; DataType data_type; const gchar *name; gulong num, i; g_return_val_if_fail (array, FALSE); g_return_val_if_fail (attrs, FALSE); num = gck_attributes_count (attrs); for (i = 0; i < num; ++i) { attr = gck_attributes_at (attrs, i); if (!attribute_to_property (attr->type, &name, &data_type)) g_return_val_if_reached (FALSE); dbus_message_iter_open_container (array, DBUS_TYPE_DICT_ENTRY, NULL, &dict); dbus_message_iter_append_basic (&dict, DBUS_TYPE_STRING, &name); iter_append_variant (&dict, data_type, attr); dbus_message_iter_close_container (array, &dict); } return TRUE; }
GVariant * gkd_secret_property_append_variant (const GckAttribute *attr) { const gchar *property; DataType data_type; g_return_val_if_fail (attr, NULL); if (!attribute_to_property (attr->type, &property, &data_type)) return NULL; return iter_append_variant (data_type, attr); }
gboolean gkd_secret_property_append_variant (DBusMessageIter *iter, const GckAttribute *attr) { const gchar *property; DataType data_type; g_return_val_if_fail (attr, FALSE); g_return_val_if_fail (iter, FALSE); if (!attribute_to_property (attr->type, &property, &data_type)) return FALSE; iter_append_variant (iter, data_type, attr); return TRUE; }