X-Git-Url: https://git.distorted.org.uk/~mdw/disorder/blobdiff_plain/cdabf44d4bf72678b402c0fd7dac394eb36513da..3fe2333a1fa62389ad049a1c1ca43fee77a3fef0:/disobedience/control.c diff --git a/disobedience/control.c b/disobedience/control.c index f45492f..40f347a 100644 --- a/disobedience/control.c +++ b/disobedience/control.c @@ -183,70 +183,70 @@ static int rtp_sensitive(void) { /** @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: "/Control/Playing", - on: pause_resume_on, - sensitive: pause_resume_sensitive, - action_go_on: disorder_eclient_pause, - action_go_off: disorder_eclient_resume, - events: "pause-changed playing-changed rights-changed playing-track-changed", - menu_invert: TRUE, + .toggle = TRUE, + .stock = TRUE, + .icon = GTK_STOCK_MEDIA_PAUSE, + .label = "Pause", + .tip_on = "Resume playing track", + .tip_off = "Pause playing track", + .menuitem = "/Control/Playing", + .on = pause_resume_on, + .sensitive = pause_resume_sensitive, + .action_go_on = disorder_eclient_pause, + .action_go_off = disorder_eclient_resume, + .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: "/Control/Scratch", - sensitive: scratch_sensitive, - action_go_off: disorder_eclient_scratch_playing, - events: "playing-track-changed rights-changed", + .stock = TRUE, + .icon = GTK_STOCK_STOP, + .label = "Scratch", + .tip_on = "Cancel playing track", + .menuitem = "/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: "/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", + .toggle = TRUE, + .stock = FALSE, + .icon = "cards24.png", + .label = "Random", + .tip_on = "Disable random play", + .tip_off = "Enable random play", + .menuitem = "/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", }, { - 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: disorder_eclient_enable, - action_go_off: disorder_eclient_disable, - events: "enabled-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 = disorder_eclient_enable, + .action_go_off = disorder_eclient_disable, + .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: "/Control/Network player", - on: rtp_enabled, - sensitive: rtp_sensitive, - action_go_on: enable_rtp, - action_go_off: disable_rtp, - events: "rtp-changed", + .toggle = TRUE, + .stock = TRUE, + .icon = GTK_STOCK_CONNECT, + .label = "RTP", + .tip_on = "Stop playing network stream", + .tip_off = "Play network stream", + .menuitem = "/Control/Network player", + .on = rtp_enabled, + .sensitive = rtp_sensitive, + .action_go_on = enable_rtp, + .action_go_off = disable_rtp, + .events = "rtp-changed", }, }; @@ -271,8 +271,8 @@ GtkWidget *control_widget(void) { * sliders hang down from the toolbar so it unavoidably gets the whole width * of the window to play with. */ gtk_toolbar_set_show_arrow(GTK_TOOLBAR(toolbar), FALSE); - gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), - full_mode ? GTK_TOOLBAR_BOTH : GTK_TOOLBAR_ICONS); + if(full_mode) gtk_toolbar_unset_style(GTK_TOOLBAR(toolbar)); + else gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_ICONS); for(n = 0; n < NICONS; ++n) { struct icon *const icon = &icons[n]; icon->button = (icon->toggle @@ -364,8 +364,7 @@ GtkWidget *control_widget(void) { static int volume_supported(void) { /* TODO: if the server doesn't know how to set the volume [but isn't using * network play] then we should have volume_supported = FALSE */ - return (!rtp_supported - || (rtp_supported && backend && backend->set_volume)); + return 1; } /** @brief Update the volume control when it changes */ @@ -468,9 +467,7 @@ static void toggled_menu(GtkCheckMenuItem attribute((unused)) *menuitem, /** @brief Called when a volume command completes */ static void volume_completed(void attribute((unused)) *v, - const char *err, - int attribute((unused)) l, - int attribute((unused)) r) { + const char *err) { if(err) popup_protocol_error(0, err); /* We don't set the UI's notion of the volume here, it is set from the log @@ -495,13 +492,12 @@ static void volume_adjusted(GtkAdjustment attribute((unused)) *a, * from the log. */ if(rtp_supported) { int l = nearbyint(left(v, b) * 100), r = nearbyint(right(v, b) * 100); - if(backend && backend->set_volume) - backend->set_volume(&l, &r); + rtp_setvol(&l, &r); } else - disorder_eclient_volume(client, volume_completed, - nearbyint(left(v, b) * 100), - nearbyint(right(v, b) * 100), - 0); + disorder_eclient_set_volume(client, volume_completed, + nearbyint(left(v, b) * 100), + nearbyint(right(v, b) * 100), + 0); } /** @brief Formats the volume value */ @@ -621,8 +617,8 @@ static void control_minimode(const char attribute((unused)) *event, gtk_widget_hide(balance_widget); gtk_scale_set_value_pos(GTK_SCALE(volume_widget), GTK_POS_RIGHT); } - gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), - full_mode ? GTK_TOOLBAR_BOTH : GTK_TOOLBAR_ICONS); + if(full_mode) gtk_toolbar_unset_style(GTK_TOOLBAR(toolbar)); + else gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_ICONS); } /*