-} icons[] = {
- { "pause.png", "Pause playing track", clicked_icon, update_pause,
- disorder_eclient_pause, 0 },
- { "play.png", "Resume playing track", clicked_icon, update_play,
- disorder_eclient_resume, 0 },
- { "cross.png", "Cancel playing track", clicked_icon, update_scratch,
- disorder_eclient_scratch_playing, 0 },
- { "random.png", "Enable random play", clicked_icon, update_random_enable,
- disorder_eclient_random_enable, 0 },
- { "randomcross.png", "Disable random play", clicked_icon, update_random_disable,
- disorder_eclient_random_disable, 0 },
- { "notes.png", "Enable play", clicked_icon, update_enable,
- disorder_eclient_enable, 0 },
- { "notescross.png", "Disable play", clicked_icon, update_disable,
- disorder_eclient_disable, 0 },
+
+ /** @brief Pointer to menu item */
+ GtkWidget *item;
+
+ GtkWidget *image_on;
+ GtkWidget *image_off;
+};
+
+static int pause_resume_on(void) {
+ return !(last_state & DISORDER_TRACK_PAUSED);
+}
+
+static int pause_resume_sensitive(void) {
+ return !!(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[] = {
+ {
+ icon_on: "pause32.png",
+ tip_on: "Pause playing track",
+ icon_off: "play32.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: "cross32.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: "randomenabled32.png",
+ tip_on: "Disable random play",
+ icon_off: "randomdisabled32.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: "playenabled32.png",
+ tip_on: "Disable play",
+ icon_off: "playdisabled32.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: "rtpenabled32.png",
+ tip_on: "Stop playing network stream",
+ icon_off: "rtpdisabled32.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",
+ },