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,
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,
&& !!(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 */
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);