X-Git-Url: https://git.distorted.org.uk/~mdw/disorder/blobdiff_plain/3c499fe72ea3c8527663a4fb7df9f6d627fc42b7..699517afce8942f7f43952adfe242d7a0c09f2d0:/disobedience/control.c diff --git a/disobedience/control.c b/disobedience/control.c index 57931be..9bb7c96 100644 --- a/disobedience/control.c +++ b/disobedience/control.c @@ -405,12 +405,18 @@ static void update_nortp(const struct icon *icon) { update_icon(icon, visible, usable); } +static void icon_action_completed(void attribute((unused)) *v, + const char *error) { + if(error) + popup_protocol_error(0, error); +} + static void clicked_icon(GtkButton attribute((unused)) *button, gpointer userdata) { const struct icon *icon = userdata; if(!suppress_actions) - icon->action(client, 0, 0); + icon->action(client, icon_action_completed, 0); } static void clicked_menu(GtkMenuItem attribute((unused)) *menuitem, @@ -418,7 +424,7 @@ static void clicked_menu(GtkMenuItem attribute((unused)) *menuitem, const struct icon *icon = userdata; if(!suppress_actions) - icon->action(client, 0, 0); + icon->action(client, icon_action_completed, 0); } static void toggled_menu(GtkCheckMenuItem *menuitem, @@ -436,7 +442,18 @@ static void toggled_menu(GtkCheckMenuItem *menuitem, && !!(icons[n].flags & ICON_INACTIVE) == !!menuitem->active) break; if(n < NICONS) - icons[n].action(client, 0, 0); + icons[n].action(client, icon_action_completed, 0); +} + +/** @brief Called when a volume command completes */ +static void volume_completed(void attribute((unused)) *v, + const char *error, + int attribute((unused)) l, + int attribute((unused)) r) { + if(error) + popup_protocol_error(0, error); + /* We don't set the UI's notion of the volume here, it is set from the log + * regardless of the reason it changed */ } /** @brief Called when the volume has been adjusted */ @@ -459,8 +476,7 @@ static void volume_adjusted(GtkAdjustment attribute((unused)) *a, int l = nearbyint(left(v, b) * 100), r = nearbyint(right(v, b) * 100); mixer_control(DEFAULT_BACKEND, &l, &r, 1); } else - /* We don't want a reply, we'll get the actual new volume from the log. */ - disorder_eclient_volume(client, 0, + disorder_eclient_volume(client, volume_completed, nearbyint(left(v, b) * 100), nearbyint(right(v, b) * 100), 0);