changeset 2633:8e4af29f7e17

dissociate hooks at plugin cleanup
author Tomasz Mon <desowin@gmail.com>
date Thu, 22 May 2008 20:26:00 +0200
parents 55bc7318ff40
children 43a07a0607da
files src/skins/plugin.c src/skins/ui_main.c src/skins/ui_main.h src/skins/ui_main_evlisteners.c src/skins/ui_main_evlisteners.h src/skins/ui_playlist_evlisteners.c src/skins/ui_playlist_evlisteners.h
diffstat 7 files changed, 51 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/skins/plugin.c	Thu May 22 21:11:35 2008 +0300
+++ b/src/skins/plugin.c	Thu May 22 20:26:00 2008 +0200
@@ -25,6 +25,8 @@
 #include "ui_skinned_window.h"
 #include "ui_manager.h"
 #include "icons-stock.h"
+#include "ui_main_evlisteners.h"
+#include "ui_playlist_evlisteners.h"
 #include <audacious/i18n.h>
 #include <libintl.h>
 
@@ -64,6 +66,8 @@
 
 void skins_cleanup(void) {
     if (plugin_is_active == TRUE) {
+        ui_main_evlistener_dissociate();
+        ui_playlist_evlistener_dissociate();
         skins_cfg_free();
         gtk_widget_destroy(mainwin);
         gtk_widget_destroy(equalizerwin);
--- a/src/skins/ui_main.c	Thu May 22 21:11:35 2008 +0300
+++ b/src/skins/ui_main.c	Thu May 22 20:26:00 2008 +0200
@@ -2402,12 +2402,6 @@
 
     mainwin_stime_sec = ui_skinned_textbox_new(SKINNED_WINDOW(mainwin)->fixed, 147, 4, 10, FALSE, SKIN_TEXT);
     g_signal_connect(mainwin_stime_sec, "button-press-event", G_CALLBACK(change_timer_mode_cb), NULL);
-
-
-    aud_hook_associate("playback audio error", (void *) mainwin_stop_pushed, NULL);
-    aud_hook_associate("playback audio error", (void *) run_no_output_device_dialog, NULL);
-
-    aud_hook_associate("playback seek", (HookFunction) mainwin_update_song_info, NULL);
 }
 
 static void
--- a/src/skins/ui_main.h	Thu May 22 21:11:35 2008 +0300
+++ b/src/skins/ui_main.h	Thu May 22 20:26:00 2008 +0200
@@ -172,6 +172,7 @@
                                 guint time,
                                 gpointer user_data);
 
+void run_no_output_device_dialog(gpointer hook_data, gpointer user_data);
 void mainwin_setup_menus(void);
 gboolean change_timer_mode_cb(GtkWidget *widget, GdkEventButton *event);
 
--- a/src/skins/ui_main_evlisteners.c	Thu May 22 21:11:35 2008 +0300
+++ b/src/skins/ui_main_evlisteners.c	Thu May 22 20:26:00 2008 +0200
@@ -332,5 +332,42 @@
 #endif
     aud_hook_associate("visualization timeout", ui_main_evlistener_visualization_timeout, NULL);
     aud_hook_associate("config save", ui_main_evlistener_config_save, NULL);
+
+    aud_hook_associate("playback audio error", (void *) mainwin_stop_pushed, NULL);
+    aud_hook_associate("playback audio error", (void *) run_no_output_device_dialog, NULL);
+
+    aud_hook_associate("playback seek", (HookFunction) mainwin_update_song_info, NULL);
 }
 
+void
+ui_main_evlistener_dissociate(void)
+{
+    aud_hook_dissociate("title change", ui_main_evlistener_title_change);
+    aud_hook_dissociate("hide seekbar", ui_main_evlistener_hide_seekbar);
+    aud_hook_dissociate("volume set", ui_main_evlistener_volume_change);
+    aud_hook_dissociate("playback begin", ui_main_evlistener_playback_begin);
+    aud_hook_dissociate("playback stop", ui_main_evlistener_playback_stop);
+    aud_hook_dissociate("playback pause", ui_main_evlistener_playback_pause);
+    aud_hook_dissociate("playback unpause", ui_main_evlistener_playback_unpause);
+    aud_hook_dissociate("playback seek", ui_main_evlistener_playback_seek);
+    aud_hook_dissociate("playback play file", ui_main_evlistener_playback_play_file);
+    aud_hook_dissociate("playlist end reached", ui_main_evlistener_playlist_end_reached);
+    aud_hook_dissociate("playlist info change", ui_main_evlistener_playlist_info_change);
+    aud_hook_dissociate("mainwin set always on top", ui_main_evlistener_mainwin_set_always_on_top);
+    aud_hook_dissociate("mainwin show", ui_main_evlistener_mainwin_show);
+    aud_hook_dissociate("equalizerwin show", ui_main_evlistener_equalizerwin_show);
+#if 0
+    aud_hook_dissociate("prefswin show", ui_main_evlistener_prefswin_show);
+    aud_hook_dissociate("aboutwin show", ui_main_evlistener_aboutwin_show);
+    aud_hook_dissociate("ui jump to track show", ui_main_evlistener_ui_jump_to_track_show);
+    aud_hook_dissociate("filebrowser show", ui_main_evlistener_filebrowser_show);
+    aud_hook_dissociate("filebrowser hide", ui_main_evlistener_filebrowser_hide);
+#endif
+    aud_hook_dissociate("visualization timeout", ui_main_evlistener_visualization_timeout);
+    aud_hook_dissociate("config save", ui_main_evlistener_config_save);
+
+    aud_hook_dissociate("playback audio error", (void *) mainwin_stop_pushed);
+    aud_hook_dissociate("playback audio error", (void *) run_no_output_device_dialog);
+
+    aud_hook_dissociate("playback seek", (HookFunction) mainwin_update_song_info);
+}
--- a/src/skins/ui_main_evlisteners.h	Thu May 22 21:11:35 2008 +0300
+++ b/src/skins/ui_main_evlisteners.h	Thu May 22 20:26:00 2008 +0200
@@ -24,5 +24,6 @@
 #define AUDACIOUS_UI_MAIN_EVLISTENERS_H
 
 void ui_main_evlistener_init(void);
+void ui_main_evlistener_dissociate(void);
 
 #endif /* AUDACIOUS_UI_MAIN_EVLISTENERS_H */
--- a/src/skins/ui_playlist_evlisteners.c	Thu May 22 21:11:35 2008 +0300
+++ b/src/skins/ui_playlist_evlisteners.c	Thu May 22 20:26:00 2008 +0200
@@ -55,3 +55,10 @@
     aud_hook_associate("playlist update", ui_playlist_evlistener_playlist_update, NULL);
     aud_hook_associate("playlistwin show", ui_playlist_evlistener_playlistwin_show, NULL);
 }
+
+void ui_playlist_evlistener_dissociate(void)
+{
+    aud_hook_dissociate("playlist update", ui_playlist_evlistener_playlist_update);
+    aud_hook_dissociate("playlistwin show", ui_playlist_evlistener_playlistwin_show);
+}
+
--- a/src/skins/ui_playlist_evlisteners.h	Thu May 22 21:11:35 2008 +0300
+++ b/src/skins/ui_playlist_evlisteners.h	Thu May 22 20:26:00 2008 +0200
@@ -22,5 +22,6 @@
 #define AUDACIOUS_UI_PLAYLIST_EVLISTENERS_H
 
 void ui_playlist_evlistener_init(void);
+void ui_playlist_evlistener_dissociate(void);
 
 #endif /* AUDACIOUS_UI_PLAYLIST_EVLISTENERS_H */