changeset 4553:47cc110bef0c

Hookify a visualization function
author mf0102 <0102@gmx.at>
date Sun, 18 May 2008 16:06:33 +0200
parents 1fe29814b90c
children 961906c766e4
files src/audacious/ui_main_evlisteners.c src/audacious/visualization.c
diffstat 2 files changed, 14 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/ui_main_evlisteners.c	Sun May 18 09:12:30 2008 +0200
+++ b/src/audacious/ui_main_evlisteners.c	Sun May 18 16:06:33 2008 +0200
@@ -263,6 +263,15 @@
 }
 
 static void
+ui_main_evlistener_visualization_timeout(gpointer hook_data, gpointer user_data)
+{
+    if (cfg.player_shaded && cfg.player_visible)
+        ui_svis_timeout_func(mainwin_svis, hook_data);
+    else
+        ui_vis_timeout_func(mainwin_vis, hook_data);
+}
+
+static void
 ui_main_evlistener_config_save(gpointer hook_data, gpointer user_data)
 {
     ConfigDb *db = (ConfigDb *) hook_data;
@@ -301,6 +310,7 @@
     hook_associate("ui jump to track show", ui_main_evlistener_ui_jump_to_track_show, NULL);
     hook_associate("filebrowser show", ui_main_evlistener_filebrowser_show, NULL);
     hook_associate("filebrowser hide", ui_main_evlistener_filebrowser_hide, NULL);
+    hook_associate("visualization timeout", ui_main_evlistener_visualization_timeout, NULL);
     hook_associate("config save", ui_main_evlistener_config_save, NULL);
 }
 
--- a/src/audacious/visualization.c	Sun May 18 09:12:30 2008 +0200
+++ b/src/audacious/visualization.c	Sun May 18 16:06:33 2008 +0200
@@ -284,12 +284,8 @@
     gint i;
 
     if (!pcm_data || nch < 1) {
-        if (cfg.vis_type != VIS_OFF) {
-            if (cfg.player_shaded && cfg.player_visible)
-                ui_svis_timeout_func(mainwin_svis, NULL);
-            else
-                ui_vis_timeout_func(mainwin_vis, NULL);
-        }
+        if (cfg.vis_type != VIS_OFF)
+            hook_call("visualization timeout", NULL);
         return;
     }
 
@@ -471,10 +467,8 @@
                intern_vis_data[i] = 0; */
         }
     }
-    if (cfg.player_shaded && cfg.player_visible)
-        ui_svis_timeout_func(mainwin_svis, intern_vis_data);
-    else
-        ui_vis_timeout_func(mainwin_vis, intern_vis_data);
+
+    hook_call("visualization timeout", intern_vis_data);
 }
 
 void