]> sigrok.org Git - libsigrok.git/commitdiff
input/csv: Make the data format option a list.
authorUwe Hermann <redacted>
Sat, 21 Apr 2018 21:28:58 +0000 (23:28 +0200)
committerUwe Hermann <redacted>
Sat, 21 Apr 2018 21:28:58 +0000 (23:28 +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/input/csv.c

index 770cb18ebc83fd54b77197495b04d992e2caeea2..fdfc26419ae7e44e910549dafc4f8067cc985d40 100644 (file)
@@ -925,11 +925,18 @@ static struct sr_option options[] = {
 
 static const struct sr_option *get_options(void)
 {
+       GSList *l;
+
        if (!options[0].def) {
                options[0].def = g_variant_ref_sink(g_variant_new_int32(0));
                options[1].def = g_variant_ref_sink(g_variant_new_int32(0));
                options[2].def = g_variant_ref_sink(g_variant_new_string(","));
                options[3].def = g_variant_ref_sink(g_variant_new_string("bin"));
+               l = NULL;
+               l = g_slist_append(l, g_variant_ref_sink(g_variant_new_string("bin")));
+               l = g_slist_append(l, g_variant_ref_sink(g_variant_new_string("hex")));
+               l = g_slist_append(l, g_variant_ref_sink(g_variant_new_string("oct")));
+               options[3].values = l;
                options[4].def = g_variant_ref_sink(g_variant_new_string(";"));
                options[5].def = g_variant_ref_sink(g_variant_new_uint64(0));
                options[6].def = g_variant_ref_sink(g_variant_new_int32(0));