X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/blobdiff_plain/219dc95cf771d5ba07aa19a3b33002a649682060..c764e0046efb4f318e3d80ae99c8f83c73fb8966:/disobedience/control.c diff --git a/disobedience/control.c b/disobedience/control.c index 1d05167..39bced1 100644 --- a/disobedience/control.c +++ b/disobedience/control.c @@ -28,7 +28,6 @@ WT(adjustment); WT(hscale); WT(hbox); -WT(tooltips); WT(button); WT(image); WT(label); @@ -43,8 +42,17 @@ static void update_random_enable(const struct icon *); static void update_random_disable(const struct icon *); static void update_enable(const struct icon *); static void update_disable(const struct icon *); +static void update_rtp(const struct icon *); +static void update_nortp(const struct icon *); static void clicked_icon(GtkButton *, gpointer); +static int enable_rtp(disorder_eclient *c, + disorder_eclient_no_response *completed, + void *v); +static int disable_rtp(disorder_eclient *c, + disorder_eclient_no_response *completed, + void *v); + static double left(double v, double b); static double right(double v, double b); static double volume(double l, double r); @@ -102,6 +110,10 @@ static struct icon icons[] = { disorder_eclient_enable, 0 }, { "notescross.png", "Disable play", clicked_icon, update_disable, disorder_eclient_disable, 0 }, + { "speaker.png", "Play network stream", clicked_icon, update_rtp, + enable_rtp, 0 }, + { "speakercross.png", "Stop playing network stream", clicked_icon, update_nortp, + disable_rtp, 0 }, }; /** @brief Count of icons */ @@ -111,7 +123,7 @@ static GtkAdjustment *volume_adj; static GtkAdjustment *balance_adj; /** @brief Called whenever last_state changes in any way */ -static void control_monitor(void attribute((unused)) *u) { +void control_monitor(void attribute((unused)) *u) { int n; D(("control_monitor")); @@ -125,11 +137,9 @@ GtkWidget *control_widget(void) { GtkWidget *content; GdkPixbuf *pb; GtkWidget *v, *b; - GtkTooltips *tips = gtk_tooltips_new(); int n; NW(hbox); - NW(tooltips); D(("control_widget")); for(n = 0; n < NICONS; ++n) { NW(button); @@ -268,6 +278,18 @@ static void update_disable(const struct icon *icon) { update_icon(icon, visible, usable); } +static void update_rtp(const struct icon *icon) { + const int visible = !rtp_is_running; + const int usable = rtp_supported; + update_icon(icon, visible, usable); +} + +static void update_nortp(const struct icon *icon) { + const int visible = rtp_is_running; + const int usable = rtp_supported; + update_icon(icon, visible, usable); +} + static void clicked_icon(GtkButton attribute((unused)) *button, gpointer userdata) { const struct icon *icon = userdata; @@ -380,6 +402,30 @@ static double balance(double l, double r) { return 0; } +/** @brief Called to enable RTP play + * + * Rather odd signature is to fit in with the other icons which all call @ref + * lib/eclient.h functions. + */ +static int enable_rtp(disorder_eclient attribute((unused)) *c, + disorder_eclient_no_response attribute((unused)) *completed, + void attribute((unused)) *v) { + start_rtp(); + return 0; +} + +/** @brief Called to disable RTP play + * + * Rather odd signature is to fit in with the other icons which all call @ref + * lib/eclient.h functions. + */ +static int disable_rtp(disorder_eclient attribute((unused)) *c, + disorder_eclient_no_response attribute((unused)) *completed, + void attribute((unused)) *v) { + stop_rtp(); + return 0; +} + /* Local Variables: c-basic-offset:2