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 9bb7c96..c84f51d 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 void volume_changed(const char *event,
+                           void *eventdata,
+                           void *callbackdata);
+
 /* 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);
+  event_register("volume-changed", volume_changed, 0);
   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;
 
-  D(("volume_update"));
+  D(("volume_changed"));
   l = volume_l / 100.0;
   r = volume_r / 100.0;
   ++suppress_actions;
index 2a65d67..76ea604 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;
index aec1e95..9049d67 100644 (file)
@@ -200,9 +200,6 @@ void users_set_sensitive(int sensitive);
 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;
index 42fc778..38d83f0 100644 (file)
@@ -86,7 +86,7 @@ void all_update(void) {
   ++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;
 }
@@ -194,7 +194,7 @@ static void log_volume(void attribute((unused)) *v,
     volume_l = l;
     volume_r = r;
     ++suppress_actions;
-    volume_update();
+    event_raise("volume-changed", 0);
     --suppress_actions;
   }
 }