+ if (_updating_sample_rate)
+ return;
+
+ const shared_ptr<device::DevInst> dev_inst = get_selected_device();
+ if (!dev_inst)
+ return;
+
+ assert(!_updating_sample_rate);
+ _updating_sample_rate = true;
+
+ if (!(gvar_dict = dev_inst->list_config(NULL, SR_CONF_SAMPLERATE)))
+ {
+ _sample_rate.show_none();
+ _updating_sample_rate = false;
+ return;
+ }
+
+ if ((gvar_list = g_variant_lookup_value(gvar_dict,
+ "samplerate-steps", G_VARIANT_TYPE("at"))))
+ {
+ elements = (const uint64_t *)g_variant_get_fixed_array(
+ gvar_list, &num_elements, sizeof(uint64_t));
+
+ const uint64_t min = elements[0];
+ const uint64_t max = elements[1];
+ const uint64_t step = elements[2];
+
+ g_variant_unref(gvar_list);
+
+ assert(min > 0);
+ assert(max > 0);
+ assert(max > min);
+ assert(step > 0);
+
+ if (step == 1)
+ _sample_rate.show_125_list(min, max);
+ else
+ {
+ // When the step is not 1, we cam't make a 1-2-5-10
+ // list of sample rates, because we may not be able to
+ // make round numbers. Therefore in this case, show a
+ // spin box.
+ _sample_rate.show_min_max_step(min, max, step);
+ }
+ }
+ else if ((gvar_list = g_variant_lookup_value(gvar_dict,
+ "samplerates", G_VARIANT_TYPE("at"))))
+ {
+ elements = (const uint64_t *)g_variant_get_fixed_array(
+ gvar_list, &num_elements, sizeof(uint64_t));
+ _sample_rate.show_list(elements, num_elements);
+ g_variant_unref(gvar_list);
+ }
+ _updating_sample_rate = false;
+
+ g_variant_unref(gvar_dict);
+ update_sample_rate_selector_value();