+static int random_sensitive(void) {
+ return !!(last_rights & RIGHT_GLOBAL_PREFS);
+}
+
+static int random_enabled(void) {
+ return !!(last_state & DISORDER_RANDOM_ENABLED);
+}
+
+static int playing_sensitive(void) {
+ return !!(last_rights & RIGHT_GLOBAL_PREFS);
+}
+
+static int playing_enabled(void) {
+ return !!(last_state & DISORDER_PLAYING_ENABLED);
+}
+
+static int rtp_enabled(void) {
+ return rtp_is_running;
+}
+
+static int rtp_sensitive(void) {
+ return rtp_supported;
+}
+
+/** @brief Table of all icons */
+static struct icon icons[] = {
+ {
+ icon_on: "pause.png",
+ tip_on: "Pause playing track",
+ icon_off: "play.png",
+ tip_off: "Resume playing track",
+ menuitem: "<GdisorderMain>/Control/Playing",
+ on: pause_resume_on,
+ sensitive: pause_resume_sensitive,
+ action_go_on: disorder_eclient_resume,
+ action_go_off: disorder_eclient_pause,
+ events: "pause-changed playing-changed rights-changed",
+ },
+ {
+ icon_on: "cross.png",
+ tip_on: "Cancel playing track",
+ menuitem: "<GdisorderMain>/Control/Scratch",
+ sensitive: scratch_sensitive,
+ action_go_off: disorder_eclient_scratch_playing,
+ events: "playing-track-changed rights-changed",
+ },
+ {
+ icon_on: "randomcross.png",
+ tip_on: "Disable random play",
+ icon_off: "random.png",
+ tip_off: "Enable random play",
+ menuitem: "<GdisorderMain>/Control/Random play",
+ on: random_enabled,
+ sensitive: random_sensitive,
+ action_go_on: disorder_eclient_random_enable,
+ action_go_off: disorder_eclient_random_disable,
+ events: "random-changed rights-changed",
+ },
+ {
+ icon_on: "notescross.png",
+ tip_on: "Disable play",
+ icon_off: "notes.png",
+ tip_off: "Enable play",
+ on: playing_enabled,
+ sensitive: playing_sensitive,
+ action_go_on: disorder_eclient_enable,
+ action_go_off: disorder_eclient_disable,
+ events: "enabled-changed rights-changed",
+ },
+ {
+ icon_on: "speakercross.png",
+ tip_on: "Stop playing network stream",
+ icon_off: "speaker.png",
+ tip_off: "Play network stream",
+ menuitem: "<GdisorderMain>/Control/Network player",
+ on: rtp_enabled,
+ sensitive: rtp_sensitive,
+ action_go_on: enable_rtp,
+ action_go_off: disable_rtp,
+ events: "rtp-changed",
+ },
+};
+
+/** @brief Count of icons */
+#define NICONS (int)(sizeof icons / sizeof *icons)
+
+static GtkAdjustment *volume_adj;
+static GtkAdjustment *balance_adj;
+static GtkWidget *volume_widget;
+static GtkWidget *balance_widget;
+
+/** @brief Create the control bar */