chiark / gitweb /
Rearrange crazy control.c logic. No longer are there two widgets per
[disorder] / disobedience / disobedience.c
index 2a65d673fcc4ca88add0b98a641d126c72edda8e..6ee4803def54105d99108cc57d3a2751fa7c965d 100644 (file)
@@ -318,7 +318,7 @@ static gboolean periodic_fast(gpointer attribute((unused)) data) {
        && (nl != volume_l || nr != volume_r)) {
       volume_l = nl;
       volume_r = nr;
-      volume_update();
+      event_raise("volume-changed", 0);
     }
   }
   return TRUE;
@@ -342,10 +342,10 @@ static gboolean maybe_send_nop(gpointer attribute((unused)) data) {
     disorder_eclient_nop(client, nop_completed, 0);
   }
   if(rtp_supported) {
-    const int old_state = rtp_is_running;
+    const int rtp_was_running = rtp_is_running;
     rtp_is_running = rtp_running();
-    if(old_state != rtp_is_running)
-      control_monitor(0);
+    if(rtp_was_running != rtp_is_running)
+      event_raise("rtp-changed", 0);
   }
   return TRUE;                          /* keep call me please */
 }
@@ -355,6 +355,9 @@ static void got_rtp_address(void attribute((unused)) *v,
                             const char *error,
                             int attribute((unused)) nvec,
                             char attribute((unused)) **vec) {
+  const int rtp_was_supported = rtp_supported;
+  const int rtp_was_running = rtp_is_running;
+
   ++suppress_actions;
   rtp_address_in_flight = 0;
   if(error) {
@@ -364,9 +367,10 @@ static void got_rtp_address(void attribute((unused)) *v,
   } else {
     rtp_supported = 1;
     rtp_is_running = rtp_running();
-    control_monitor(0);
   }
-  control_monitor(0);
+  if(rtp_supported != rtp_was_supported
+     || rtp_is_running != rtp_was_running)
+    event_raise("rtp-changed", 0);
   --suppress_actions;
 }