# HG changeset patch # User mf0102 <0102@gmx.at> # Date 1208974270 -7200 # Node ID 9fbb55542e737cf8a9dd530307feb53e35f7d509 # Parent 212790dd92baba326c471ba5636fb8b5c8cecb9f hookified many function calls diff -r 212790dd92ba -r 9fbb55542e73 src/audacious/playlist.c --- a/src/audacious/playlist.c Wed Apr 23 18:53:14 2008 +0200 +++ b/src/audacious/playlist.c Wed Apr 23 20:11:10 2008 +0200 @@ -62,7 +62,6 @@ #include "pluginenum.h" #include "strings.h" #include "ui_main.h" -#include "ui_playlist_manager.h" #include "ui_playlist.h" #include "util.h" #include "vfs.h" @@ -292,7 +291,7 @@ if (playlists_iter == NULL) playlists_iter = playlists; - playlist_manager_update(); + hook_call("playlist update", NULL); } void @@ -326,7 +325,7 @@ if (playlists_iter == NULL) playlists_iter = playlists; - playlist_manager_update(); + hook_call("playlist update", NULL); } GList * @@ -346,8 +345,7 @@ if (playlists_iter == NULL) playlists_iter = playlists; - playlistwin_update_list(playlist_get_active()); - playlist_manager_update(); + hook_call("playlist update", playlist_get_active()); } void @@ -361,8 +359,7 @@ if (playlists_iter == NULL) playlists_iter = playlists; - playlistwin_update_list(playlist_get_active()); - playlist_manager_update(); + hook_call("playlist update", playlist_get_active()); } void @@ -373,8 +370,7 @@ if (playlists_iter == NULL) playlists_iter = playlists; - playlistwin_update_list(playlist); - playlist_manager_update(); + hook_call("playlist update", playlist); } /* *********************** playlist code ********************** */ @@ -395,13 +391,13 @@ if (!title) { playlist->title = NULL; g_free(oldtitle); - playlist_manager_update(); + hook_call("playlist update", NULL); return FALSE; } playlist->title = str_to_utf8(title); g_free(oldtitle); - playlist_manager_update(); + hook_call("playlist update", NULL); return TRUE; } @@ -484,10 +480,9 @@ playlist_clear_only(playlist); playlist_generate_shuffle_list(playlist); - playlistwin_update_list(playlist); + hook_call("playlist update", playlist); playlist_recalc_total_time(playlist); PLAYLIST_INCR_SERIAL(playlist); - playlist_manager_update(); } static void @@ -574,15 +569,13 @@ playlist_recalc_total_time(playlist); PLAYLIST_INCR_SERIAL(playlist); - playlistwin_update_list(playlist); + hook_call("playlist update", playlist); if (restart_playing) { if (playlist->position) playback_initiate(); else hook_call("playlist end reached", NULL); } - - playlist_manager_update(); } void @@ -622,8 +615,7 @@ hook_call("playlist end reached", NULL); } - playlistwin_update_list(playlist); - playlist_manager_update(); + hook_call("playlist update", playlist); } static void @@ -770,8 +762,7 @@ g_free(pr); playlist_generate_shuffle_list(playlist); - playlistwin_update_list(playlist); - playlist_manager_update(); + hook_call("playlist update", playlist); return TRUE; } } @@ -1014,8 +1005,7 @@ playlist_recalc_total_time(playlist); playlist_generate_shuffle_list(playlist); - playlistwin_update_list(playlist); - playlist_manager_update(); + hook_call("playlist update", playlist); return entries; } @@ -1068,9 +1058,7 @@ playlist_recalc_total_time(playlist); PLAYLIST_INCR_SERIAL(playlist); playlist_generate_shuffle_list(playlist); - playlistwin_update_list(playlist); - - playlist_manager_update(); + hook_call("playlist update", playlist); return entries; } @@ -1211,8 +1199,7 @@ if (restart_playing) playback_initiate(); - playlistwin_update_list(playlist); - playlist_manager_update(); + hook_call("playlist update", playlist); } void @@ -1271,9 +1258,7 @@ if (restart_playing) playback_initiate(); else - playlistwin_update_list(playlist); - - playlist_manager_update(); + hook_call("playlist update", playlist); } void @@ -1310,7 +1295,7 @@ PLAYLIST_UNLOCK(playlist); playlist_recalc_total_time(playlist); - playlistwin_update_list(playlist); + hook_call("playlist update", playlist); } void @@ -1337,7 +1322,7 @@ PLAYLIST_UNLOCK(playlist); playlist_recalc_total_time(playlist); - playlistwin_update_list(playlist); + hook_call("playlist update", playlist); } gboolean @@ -1391,7 +1376,7 @@ PLAYLIST_UNLOCK(playlist); playlist_recalc_total_time(playlist); - playlistwin_update_list(playlist); + hook_call("playlist update", playlist); } void @@ -1404,7 +1389,7 @@ playlist->queue = g_list_remove(playlist->queue, entry); PLAYLIST_UNLOCK(playlist); - playlistwin_update_list(playlist); + hook_call("playlist update", playlist); } gint @@ -1453,7 +1438,7 @@ if (restart_playing) playback_initiate(); else - playlistwin_update_list(playlist); + hook_call("playlist update", playlist); } void @@ -1519,7 +1504,7 @@ playlist_check_pos_current(playlist); playback_initiate(); - playlistwin_update_list(playlist); + hook_call("playlist update", playlist); } gint @@ -1761,8 +1746,7 @@ new_len = playlist_get_length(playlist); playlist_generate_shuffle_list(playlist); - playlistwin_update_list(playlist); - playlist_manager_update(); + hook_call("playlist update", playlist); playlist_recalc_total_time(playlist); //tentative --yaz PLAYLIST_INCR_SERIAL(playlist); @@ -2335,7 +2319,7 @@ PLAYLIST_INCR_SERIAL(playlist); PLAYLIST_UNLOCK(playlist); playlist_recalc_total_time(playlist); - playlist_manager_update(); + hook_call("playlist update", playlist); } gint @@ -2470,10 +2454,10 @@ entry = node->data; if (playlist->attribute & PLAYLIST_STATIC || - (entry->tuple && - tuple_get_int(entry->tuple, FIELD_LENGTH, NULL) > -1 && - tuple_get_int(entry->tuple, FIELD_MTIME, NULL) != -1 && - entry->title_is_valid)) + (entry->tuple && + tuple_get_int(entry->tuple, FIELD_LENGTH, NULL) > -1 && + tuple_get_int(entry->tuple, FIELD_MTIME, NULL) != -1 && + entry->title_is_valid)) continue; AUDDBG("len=%d mtime=%d\n", @@ -2513,7 +2497,7 @@ if (update_playlistwin) { Playlist *playlist = playlist_get_active(); - event_queue("playlistwin update list", playlist); + event_queue("playlist update", playlist); PLAYLIST_INCR_SERIAL(playlist); update_playlistwin = FALSE; } @@ -2624,10 +2608,9 @@ PLAYLIST_UNLOCK(playlist); playlist_generate_shuffle_list(playlist); - playlistwin_update_list(playlist); + hook_call("playlist update", playlist); playlist_recalc_total_time(playlist); PLAYLIST_INCR_SERIAL(playlist); - playlist_manager_update(); } @@ -2744,11 +2727,9 @@ PLAYLIST_UNLOCK(playlist); - playlistwin_update_list(playlist); + hook_call("playlist update", playlist); playlist_recalc_total_time(playlist); PLAYLIST_INCR_SERIAL(playlist); - - playlist_manager_update(); } void @@ -3086,7 +3067,7 @@ PLAYLIST_UNLOCK(playlist); - playlistwin_update_list(playlist); + hook_call("playlist update", playlist); playlist_recalc_total_time(playlist); PLAYLIST_INCR_SERIAL(playlist); //tentative --yaz @@ -3109,7 +3090,7 @@ PLAYLIST_UNLOCK(playlist); - playlistwin_update_list(playlist); + hook_call("playlist update", playlist); playlist_recalc_total_time(playlist); PLAYLIST_INCR_SERIAL(playlist); //tentative --yaz } @@ -3194,8 +3175,7 @@ PLAYLIST_UNLOCK(playlist); playlist_recalc_total_time(newpl); - playlistwin_update_list(playlist); - playlist_manager_update(); + hook_call("playlist update", playlist); return newpl; } diff -r 212790dd92ba -r 9fbb55542e73 src/audacious/ui_playlist_evlisteners.c --- a/src/audacious/ui_playlist_evlisteners.c Wed Apr 23 18:53:14 2008 +0200 +++ b/src/audacious/ui_playlist_evlisteners.c Wed Apr 23 20:11:10 2008 +0200 @@ -25,16 +25,20 @@ #include "hook.h" #include "playlist.h" #include "ui_playlist.h" +#include "ui_playlist_manager.h" static void -ui_playlist_evlistener_playlistwin_update_list(gpointer hook_data, gpointer user_data) +ui_playlist_evlistener_playlist_update(gpointer hook_data, gpointer user_data) { Playlist *playlist = (Playlist *) hook_data; + if (playlist != NULL) + playlistwin_update_list(playlist); - playlistwin_update_list(playlist); + playlist_manager_update(); } void ui_playlist_evlistener_init(void) { - hook_associate("playlistwin update list", ui_playlist_evlistener_playlistwin_update_list, NULL); + hook_associate("playlist update", + ui_playlist_evlistener_playlist_update, NULL); }