]> sigrok.org Git - libsigrok.git/commitdiff
output/csv: Make the label values option a list.
authorUwe Hermann <redacted>
Sat, 21 Apr 2018 21:30:44 +0000 (23:30 +0200)
committerUwe Hermann <redacted>
Sat, 21 Apr 2018 21:30:44 +0000 (23:30 +0200)
This allows UIs to display a drop-down with all possible choices,
instead of forcing the user to look up / remember all of them.

src/output/csv.c

index dce630c693157191dec7c775c28eb49e08683db4..f892311205869ba0f65b4f9fa041a671b4e8b2a9 100644 (file)
@@ -643,6 +643,8 @@ static struct sr_option options[] = {
 
 static const struct sr_option *get_options(void)
 {
+       GSList *l = NULL;
+
        if (!options[0].def) {
                options[0].def = g_variant_ref_sink(g_variant_new_string(""));
                options[1].def = g_variant_ref_sink(g_variant_new_boolean(TRUE));
@@ -652,6 +654,10 @@ static const struct sr_option *get_options(void)
                options[5].def = g_variant_ref_sink(g_variant_new_string(";"));
                options[6].def = g_variant_ref_sink(g_variant_new_boolean(TRUE));
                options[7].def = g_variant_ref_sink(g_variant_new_string("units"));
+               l = g_slist_append(l, g_variant_ref_sink(g_variant_new_string("units")));
+               l = g_slist_append(l, g_variant_ref_sink(g_variant_new_string("channel")));
+               l = g_slist_append(l, g_variant_ref_sink(g_variant_new_string("off")));
+               options[7].values = l;
                options[8].def = g_variant_ref_sink(g_variant_new_boolean(TRUE));
                options[9].def = g_variant_ref_sink(g_variant_new_boolean(FALSE));
                options[10].def = g_variant_ref_sink(g_variant_new_boolean(TRUE));