chiark / gitweb /
More event_*
authorRichard Kettlewell <rjk@greenend.org.uk>
Sun, 8 Jun 2008 16:59:28 +0000 (17:59 +0100)
committerRichard Kettlewell <rjk@greenend.org.uk>
Sun, 8 Jun 2008 16:59:28 +0000 (17:59 +0100)
disobedience/control.c
disobedience/disobedience.c
disobedience/disobedience.h
disobedience/log.c

index 9bb7c96620415d45efa41a218b7f0eb8a319555c..c84f51d15f673cbef8efce083e9a5ea68d955485 100644 (file)
@@ -65,6 +65,10 @@ 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 gchar *format_volume(GtkScale *scale, gdouble value);
 static gchar *format_balance(GtkScale *scale, gdouble value);
 
+static void volume_changed(const char *event,
+                           void *eventdata,
+                           void *callbackdata);
+
 /* Control bar ------------------------------------------------------------- */
 
 /** @brief Guard against feedback */
 /* Control bar ------------------------------------------------------------- */
 
 /** @brief Guard against feedback */
@@ -303,14 +307,17 @@ GtkWidget *control_widget(void) {
   g_signal_connect(G_OBJECT(balance_widget), "format-value",
                    G_CALLBACK(format_balance), 0);
   register_monitor(control_monitor, 0, -1UL);
   g_signal_connect(G_OBJECT(balance_widget), "format-value",
                    G_CALLBACK(format_balance), 0);
   register_monitor(control_monitor, 0, -1UL);
+  event_register("volume-changed", volume_changed, 0);
   return hbox;
 }
 
 /** @brief Update the volume control when it changes */
   return hbox;
 }
 
 /** @brief Update the volume control when it changes */
-void volume_update(void) {
+static void volume_changed(const char attribute((unused)) *event,
+                           void attribute((unused)) *eventdata,
+                           void attribute((unused)) *callbackdata) {
   double l, r;
 
   double l, r;
 
-  D(("volume_update"));
+  D(("volume_changed"));
   l = volume_l / 100.0;
   r = volume_r / 100.0;
   ++suppress_actions;
   l = volume_l / 100.0;
   r = volume_r / 100.0;
   ++suppress_actions;
index 2a65d673fcc4ca88add0b98a641d126c72edda8e..76ea604a87766140dd46278362a32da81b74d8e9 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;
        && (nl != volume_l || nr != volume_r)) {
       volume_l = nl;
       volume_r = nr;
-      volume_update();
+      event_raise("volume-changed", 0);
     }
   }
   return TRUE;
     }
   }
   return TRUE;
index aec1e950c00d44c80a8544643e90e1540b6ed67b..9049d674a1ea456f1ef179733bed43f1d31aa912 100644 (file)
@@ -200,9 +200,6 @@ void users_set_sensitive(int sensitive);
 GtkWidget *control_widget(void);
 /* Make the controls widget */
 
 GtkWidget *control_widget(void);
 /* Make the controls widget */
 
-void volume_update(void);
-/* Called whenever we think the volume control has changed */
-
 void control_monitor(void *u);
 
 extern int suppress_actions;
 void control_monitor(void *u);
 
 extern int suppress_actions;
index 42fc778dc2c3398a3999c70a1b03012f2c21aaca..38d83f0c3e49a5dcc6cf571b98a3928facb81d94 100644 (file)
@@ -86,7 +86,7 @@ void all_update(void) {
   ++suppress_actions;
   event_raise("queue-changed", 0);
   event_raise("recent-changed", 0);
   ++suppress_actions;
   event_raise("queue-changed", 0);
   event_raise("recent-changed", 0);
-  volume_update();
+  event_raise("volume-changed", 0);
   event_raise("added-changed", 0);
   --suppress_actions;
 }
   event_raise("added-changed", 0);
   --suppress_actions;
 }
@@ -194,7 +194,7 @@ static void log_volume(void attribute((unused)) *v,
     volume_l = l;
     volume_r = r;
     ++suppress_actions;
     volume_l = l;
     volume_r = r;
     ++suppress_actions;
-    volume_update();
+    event_raise("volume-changed", 0);
     --suppress_actions;
   }
 }
     --suppress_actions;
   }
 }