/* Control bar ------------------------------------------------------------- */
-/** @brief Guard against feedback loop in volume control */
-static int suppress_set_volume;
+/** @brief Guard against feedback */
+int suppress_actions = 1;
/** @brief Definition of an icon
*
D(("volume_update"));
l = volume_l / 100.0;
r = volume_r / 100.0;
- ++suppress_set_volume;
+ ++suppress_actions;
gtk_adjustment_set_value(volume_adj, volume(l, r) * goesupto);
gtk_adjustment_set_value(balance_adj, balance(l, r));
- --suppress_set_volume;
+ --suppress_actions;
}
/** @brief Update the state of one of the control icons
gpointer userdata) {
const struct icon *icon = userdata;
- icon->action(client, 0, 0);
+ if(!suppress_actions)
+ icon->action(client, 0, 0);
}
static void clicked_menu(GtkMenuItem attribute((unused)) *menuitem,
gpointer userdata) {
const struct icon *icon = userdata;
- icon->action(client, 0, 0);
+ if(!suppress_actions)
+ icon->action(client, 0, 0);
}
static void toggled_menu(GtkCheckMenuItem *menuitem,
const struct icon *icon = userdata;
size_t n;
+ if(suppress_actions)
+ return;
/* This is a bit fiddlier than the others, we need to find the action for the
* new state. If the new state is active then we want the ICON_INACTIVE
* version and vica versa. */
double v = gtk_adjustment_get_value(volume_adj) / goesupto;
double b = gtk_adjustment_get_value(balance_adj);
- if(suppress_set_volume)
+ if(suppress_actions)
/* This is the result of an update from the server, not a change from the
* user. Don't feedback! */
return;
static void got_rtp_address(void attribute((unused)) *v,
int attribute((unused)) nvec,
char attribute((unused)) **vec) {
+ ++suppress_actions;
rtp_address_in_flight = 0;
rtp_supported = 1;
rtp_is_running = rtp_running();
control_monitor(0);
+ --suppress_actions;
}
/** @brief Called when a rtp-address command fails */
static void no_rtp_address(struct callbackdata attribute((unused)) *cbd,
int attribute((unused)) code,
const char attribute((unused)) *msg) {
+ ++suppress_actions;
rtp_address_in_flight = 0;
rtp_supported = 0;
rtp_is_running = 0;
control_monitor(0);
+ --suppress_actions;
}
/** @brief Called to check whether RTP play is available */
disorder_eclient_log(logclient, &log_callbacks, 0);
/* See if RTP play supported */
check_rtp_address();
+ suppress_actions = 0;
D(("enter main loop"));
MTAG("misc");
g_main_loop_run(mainloop);