+
+static int pause_resume_on(void) {
+ return !!(last_state & DISORDER_TRACK_PAUSED);
+}
+
+static int pause_resume_sensitive(void) {
+ return playing_track
+ && !!(last_state & DISORDER_PLAYING)
+ && (last_rights & RIGHT_PAUSE);
+}
+
+static int scratch_sensitive(void) {
+ return !!(last_state & DISORDER_PLAYING)
+ && right_scratchable(last_rights, config->username, playing_track);
+}
+
+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[] = {
+ {
+ .toggle = TRUE,
+ .stock = TRUE,
+ .icon = GTK_STOCK_MEDIA_PAUSE,
+ .label = "Pause",
+ .tip_on = "Resume playing track",
+ .tip_off = "Pause playing track",
+ .menuitem = "<GdisorderMain>/Control/Playing",
+ .on = pause_resume_on,
+ .sensitive = pause_resume_sensitive,
+ .action_go_on = pause_track,
+ .action_go_off = resume_track,
+ .events = "pause-changed playing-changed rights-changed playing-track-changed",
+ .menu_invert = TRUE,
+ },
+ {
+ .stock = TRUE,
+ .icon = GTK_STOCK_STOP,
+ .label = "Scratch",
+ .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",
+ },
+ {
+ .toggle = TRUE,
+ .stock = FALSE,
+ .icon = "cards24.png",
+ .label = "Random",
+ .tip_on = "Disable random play",
+ .tip_off = "Enable random play",
+ .menuitem = "<GdisorderMain>/Control/Random play",
+ .on = random_enabled,
+ .sensitive = random_sensitive,
+ .action_go_on = enable_random,
+ .action_go_off = disable_random,
+ .events = "random-changed rights-changed",
+ },
+ {
+ .toggle = TRUE,
+ .stock = TRUE,
+ .icon = GTK_STOCK_MEDIA_PLAY,
+ .label = "Play",
+ .tip_on = "Disable play",
+ .tip_off = "Enable play",
+ .on = playing_enabled,
+ .sensitive = playing_sensitive,
+ .action_go_on = enable_playing,
+ .action_go_off = disable_playing,
+ .events = "enabled-changed rights-changed",
+ },
+ {
+ .toggle = TRUE,
+ .stock = TRUE,
+ .icon = GTK_STOCK_CONNECT,
+ .label = "RTP",
+ .tip_on = "Stop playing network stream",
+ .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 */