- /* Update timeunit depending on device capabilities. */
- if (sr_driver_hwcap_exists(dev->driver, SR_HWCAP_LIMIT_SAMPLES))
- gtk_combo_box_set_active(timeunit, 0);
- else
- gtk_combo_box_set_active(timeunit, 1);
+ /*
+ * Grey out the time unless the device is valid,
+ * and it supports sample limiting
+ */
+ const gboolean limit_samples = dev &&
+ sr_driver_hwcap_exists(dev->driver,
+ SR_HWCAP_LIMIT_SAMPLES);
+ gtk_widget_set_sensitive((GtkWidget*)timesamples, limit_samples);
+ gtk_widget_set_sensitive((GtkWidget*)timeunit, limit_samples);