|
Revision 5709, 500 bytes
(checked in by blogic, 3 years ago)
|
|
cleanup widgets
|
| Line | |
|---|
| 1 | #include "../cbi.h" |
|---|
| 2 | |
|---|
| 3 | json_object* file_json(struct cbi_ctx *ctx, struct cbi_element *e) |
|---|
| 4 | { |
|---|
| 5 | json_object *j = json_object_new_object(); |
|---|
| 6 | const char *type = cbi_find_prop(e, "type"); |
|---|
| 7 | json_object_object_add(j, "type", json_object_new_string((type)?(type):("package"))); |
|---|
| 8 | return j; |
|---|
| 9 | } |
|---|
| 10 | |
|---|
| 11 | struct cbi_widget_property file_props[] = { |
|---|
| 12 | { "src", PROP_REQUIRED }, |
|---|
| 13 | { "id", PROP_REQUIRED }, |
|---|
| 14 | }; |
|---|
| 15 | |
|---|
| 16 | struct cbi_widget file = { |
|---|
| 17 | .caps = CAP_DATA | CAP_PACKAGE, |
|---|
| 18 | .json = file_json, |
|---|
| 19 | WPROPS(file_props), |
|---|
| 20 | }; |
|---|
| 21 | |
|---|
| 22 | WIDGET(file) |
|---|