Skip to content

Commit

Permalink
oscplot.c: fix impulse generator
Browse files Browse the repository at this point in the history
iio_device_get_trigger will return 0 on success, but if there is no device
assigned to the trigger, the trigger pointer will be NULL.
since the impulse generator menu sets the trigger, the condition will not
be satisfied. this resulted in the impulse generator menu being grayed out.
Now, we will only check that the return value is 0. The renaming of the
bool variable is to avoid confusion.

Signed-off-by: Cristina Suteu <[email protected]>
  • Loading branch information
cristina-suteu committed Jul 29, 2024
1 parent 54efaad commit 3260ace
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions oscplot.c
Original file line number Diff line number Diff line change
Expand Up @@ -6750,17 +6750,17 @@ static gboolean right_click_menu_show(OscPlot *plot, GdkEvent *event)
/* Check if device needs a trigger */
struct iio_device *dev = ref;
const struct iio_device *trigger;
bool has_trigger;
bool needs_trigger;
int ret;

ret = iio_device_get_trigger(dev, &trigger);
has_trigger = false;
if (ret == 0 && trigger) {
has_trigger = true;
needs_trigger = false;
if (ret == 0) {
needs_trigger = true;
}

gtk_widget_set_sensitive(priv->device_trigger_menuitem,
has_trigger);
needs_trigger);

gtk_menu_popup_at_pointer(GTK_MENU(priv->device_settings_menu), event);
return true;
Expand Down

0 comments on commit 3260ace

Please sign in to comment.