-static void update_icon(GtkWidget *button,
- int visible, int attribute((unused)) usable) {
- (visible ? gtk_widget_show : gtk_widget_hide)(button);
- /* TODO: show usability */
+/** @brief Update the state of one of the control icons
+ * @param icon Target icon
+ * @param visible True if this version of the button should be visible
+ * @param usable True if the button is currently usable
+ *
+ * Several of the icons, rather bizarrely, come in pairs: for instance exactly
+ * one of the play and pause buttons is supposed to be visible at any given
+ * moment.
+ *
+ * @p usable need not take into account server availability, that is done
+ * automatically.
+ */
+static void update_icon(const struct icon *icon,
+ int visible, int usable) {
+ /* If the connection is down nothing is ever usable */
+ if(!(last_state & DISORDER_CONNECTED))
+ usable = 0;
+ (visible ? gtk_widget_show : gtk_widget_hide)(icon->button);
+ /* Only both updating usability if the button is visible */
+ if(visible)
+ gtk_widget_set_sensitive(icon->button, usable);