+void SamplingBar::update_device_config_widgets()
+{
+ GVariant *gvar;
+
+ using namespace pv::popups;
+
+ const shared_ptr<device::DevInst> dev_inst = get_selected_device();
+ if (!dev_inst)
+ return;
+
+ // Update the configure popup
+ DeviceOptions *const opts = new DeviceOptions(dev_inst, this);
+ _configure_button_action->setVisible(
+ !opts->binding().properties().empty());
+ _configure_button.set_popup(opts);
+
+ // Update the channels popup
+ Channels *const channels = new Channels(_session, this);
+ _channels_button.set_popup(channels);
+
+ // Update supported options.
+ _sample_count_supported = false;
+
+ if ((gvar = dev_inst->list_config(NULL, SR_CONF_DEVICE_OPTIONS)))
+ {
+ gsize num_opts;
+ const int *const options =
+ (const int32_t *)g_variant_get_fixed_array(
+ gvar, &num_opts, sizeof(int32_t));
+ for (unsigned int i = 0; i < num_opts; i++)
+ {
+ switch (options[i] & SR_CONF_MASK) {
+ case SR_CONF_LIMIT_SAMPLES:
+ if (options[i] & SR_CONF_SET)
+ _sample_count_supported = true;
+ break;
+ case SR_CONF_LIMIT_FRAMES:
+ if (options[i] & SR_CONF_SET)
+ dev_inst->set_config(NULL, SR_CONF_LIMIT_FRAMES,
+ g_variant_new_uint64(1));
+ break;
+ }
+ }
+ }
+
+ // Add notification of reconfigure events
+ disconnect(this, SLOT(on_config_changed()));
+ connect(dev_inst.get(), SIGNAL(config_changed()),
+ this, SLOT(on_config_changed()));
+
+ // Update sweep timing widgets.
+ update_sample_count_selector();
+ update_sample_rate_selector();
+}
+