chiark / gitweb /
more control state fiddling, starts nicely when server down now
[disorder] / disobedience / control.c
index ba5b2025a9de404780b727bde64f20a7133267b1..6efadda765d41ff8d2878e3a0cd1e21311f71f90 100644 (file)
@@ -51,8 +51,6 @@ static void volume_adjusted(GtkAdjustment *a, gpointer user_data);
 static gchar *format_volume(GtkScale *scale, gdouble value);
 static gchar *format_balance(GtkScale *scale, gdouble value);
 
-static void control_monitor(void *u);
-
 /* Control bar ------------------------------------------------------------- */
 
 static int suppress_set_volume;
@@ -87,6 +85,15 @@ static struct icon {
 
 GtkAdjustment *volume_adj, *balance_adj;
 
+/** @brief Called whenever last_state changes in any way */
+static void control_monitor(void attribute((unused)) *u) {
+  int n;
+
+  D(("control_monitor"));
+  for(n = 0; n < NICONS; ++n)
+    icons[n].update(&icons[n]);
+}
+
 /* Create the control bar */
 GtkWidget *control_widget(void) {
   GtkWidget *hbox = gtk_hbox_new(FALSE, 1), *vbox;
@@ -158,12 +165,11 @@ GtkWidget *control_widget(void) {
   return hbox;
 }
 
-/** @brief Update the control bar after some kind of state change */
-void control_update(void) {
+/** @brief Update the volume control when it changes */
+void volume_update(void) {
   double l, r;
 
-  D(("control_update"));
-  /*control_monitor(0, disorder_eclient_state(client));*/
+  D(("volume_update"));
   l = volume_l / 100.0;
   r = volume_r / 100.0;
   ++suppress_set_volume;
@@ -172,13 +178,6 @@ void control_update(void) {
   --suppress_set_volume;
 }
 
-static void control_monitor(void attribute((unused)) *u) {
-  int n;
-
-  for(n = 0; n < NICONS; ++n)
-    icons[n].update(&icons[n]);
-}
-
 /** @brief Update the state of one of the control icons
  * @param icon Target icon
  * @param visible True if this version of the button should be visible