Mercurial > audlegacy
changeset 3479:26910525cec8 trunk
merge
author | Kieran Clancy <clancy.kieran+audacious@gmail.com> |
---|---|
date | Mon, 10 Sep 2007 14:18:18 +0930 |
parents | 481a4a88d3ec (current diff) b96b0b35d5cf (diff) |
children | 3f4ad59a5c02 |
files | src/audacious/playlist.c src/audacious/playlist.h |
diffstat | 11 files changed, 205 insertions(+), 217 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgtags Mon Sep 10 14:16:20 2007 +0930 +++ b/.hgtags Mon Sep 10 14:18:18 2007 +0930 @@ -1,3 +1,6 @@ 55a4a6da92a5e5bc68e352e47e0c9259818a1f92 audacious-1.4.0-dr1 40b4b64dfb42c81a6677532097c41037026b0b86 audacious-1.4.0-DR1 91a5f34b07803a8bae1e162446e40c08ddf33273 audacious-1.4.0-dr2 +e0d1499b428724311766c06e69a288cb10a42b32 audacious-1.4.0-dr3 +e00e1ab06ba63ac4122d2b122b072e299f2ab3f9 audacious-1.4.0-dr3 +45f44e987b127ce4610d9b0c9c3a6463c496f67d audacious-1.4.0-dr3
--- a/po/ja.po Mon Sep 10 14:16:20 2007 +0930 +++ b/po/ja.po Mon Sep 10 14:18:18 2007 +0930 @@ -14,7 +14,7 @@ "Project-Id-Version: audacious HEAD\n" "Report-Msgid-Bugs-To: http://bugs.audacious-media-player.org\n" "POT-Creation-Date: 2007-09-05 19:18+0200\n" -"PO-Revision-Date: 2007-09-04 20:46+0900\n" +"PO-Revision-Date: 2007-09-10 09:20+0900\n" "Last-Translator: dai <d+po@vdr.jp>\n" "Language-Team: Japanese <ja@li.org>\n" "MIME-Version: 1.0\n" @@ -544,7 +544,7 @@ #: src/audacious/glade/prefswin.glade:4364 msgid "Interpolation Engine:" -msgstr "" +msgstr "インターポレーションエンジン:" #: src/audacious/glade/prefswin.glade:4593 msgid "Reload Plugins" @@ -1823,18 +1823,16 @@ msgstr "選択範囲のソート" #: src/audacious/ui_manager.c:380 -#, fuzzy msgid "File" -msgstr "ファイア" +msgstr "ファイル" #: src/audacious/ui_manager.c:381 msgid "Help" -msgstr "" +msgstr "ヘルプ" #: src/audacious/ui_manager.c:383 -#, fuzzy msgid "Plugin Services" -msgstr "プラグイン" +msgstr "プラグインサービス" #: src/audacious/ui_manager.c:385 src/audacious/ui_manager.c:388 msgid "View Track Details"
--- a/src/audacious/dock.c Mon Sep 10 14:16:20 2007 +0930 +++ b/src/audacious/dock.c Mon Sep 10 14:18:18 2007 +0930 @@ -224,7 +224,6 @@ for (node = list; node; node = g_list_next(node)) { dw = node->data; gtk_window_move(dw->w, x + dw->offset_x, y + dw->offset_y); - gdk_flush(); } } @@ -471,7 +470,8 @@ return; gtk_window_present(w); - gdk_window_get_pointer(GTK_WIDGET(w)->window, &mx, &my, NULL); + mx = event->x; + my = event->y; gtk_object_set_data(GTK_OBJECT(w), "move_offset_x", GINT_TO_POINTER(mx)); gtk_object_set_data(GTK_OBJECT(w), "move_offset_y", GINT_TO_POINTER(my)); if (move_list) @@ -490,12 +490,10 @@ void dock_move_motion(GtkWindow * w, GdkEventMotion * event) { - gint offset_x, offset_y, win_x, win_y, x, y, mx, my; + gint offset_x, offset_y, win_x, win_y, x, y; GList *dlist; GList *window_list; - gdk_flush(); - if (!gtk_object_get_data(GTK_OBJECT(w), "is_moving")) return; @@ -508,10 +506,8 @@ gtk_window_get_position(w, &win_x, &win_y); - gdk_window_get_pointer(NULL, &mx, &my, NULL); - - x = mx - offset_x; - y = my - offset_y; + x = event->x_root - offset_x; + y = event->y_root - offset_y; calc_snap_offset(dlist, window_list, x, y, &offset_x, &offset_y); x += offset_x;
--- a/src/audacious/playlist.c Mon Sep 10 14:16:20 2007 +0930 +++ b/src/audacious/playlist.c Mon Sep 10 14:18:18 2007 +0930 @@ -45,11 +45,11 @@ #include <sys/errno.h> #if defined(USE_REGEX_ONIGURUMA) - #include <onigposix.h> +# include <onigposix.h> #elif defined(USE_REGEX_PCRE) - #include <pcreposix.h> +# include <pcreposix.h> #else - #include <regex.h> +# include <regex.h> #endif #include "input.h" @@ -102,11 +102,11 @@ * January 7, 2006, William Pitcock <nenolod@nenolod.net> */ -G_LOCK_DEFINE(playlist_get_info_going); //static gchar *playlist_current_name = NULL; static gboolean playlist_get_info_scan_active = FALSE; +GStaticRWLock playlist_get_info_rwlock = G_STATIC_RW_LOCK_INIT; static gboolean playlist_get_info_going = FALSE; static GThread *playlist_get_info_thread; @@ -441,12 +441,9 @@ } void -playlist_clear(Playlist *playlist) +playlist_clear_only(Playlist *playlist) { - if (!playlist) - return; - - PLAYLIST_LOCK( playlist->mutex ); + PLAYLIST_LOCK(playlist); g_list_foreach(playlist->entries, (GFunc) playlist_entry_free, NULL); g_list_free(playlist->entries); @@ -455,8 +452,16 @@ playlist->tail = NULL; playlist->attribute = PLAYLIST_PLAIN; - PLAYLIST_UNLOCK( playlist->mutex ); - + PLAYLIST_UNLOCK(playlist); +} + +void +playlist_clear(Playlist *playlist) +{ + if (!playlist) + return; + + playlist_clear_only(playlist); playlist_generate_shuffle_list(playlist); playlistwin_update_list(playlist); playlist_recalc_total_time(playlist); @@ -484,11 +489,11 @@ *set_info_text = TRUE; if (playback_get_playing()) { - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); ip_data.stop = TRUE; playback_stop(); ip_data.stop = FALSE; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); *restart_playing = TRUE; } @@ -530,18 +535,18 @@ if (!playlist) return; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); node = g_list_nth(playlist->entries, pos); if (!node) { - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); return; } playlist_delete_node(playlist, node, &set_info_text, &restart_playing); - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); playlist_recalc_total_time(playlist); @@ -563,7 +568,7 @@ GList *node, *fnode; gboolean set_info_text = FALSE, restart_playing = FALSE; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); for (fnode = filenames; fnode; fnode = g_list_next(fnode)) { node = playlist->entries; @@ -579,7 +584,7 @@ } } - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); playlist_recalc_total_time(playlist); playlistwin_update_list(playlist); @@ -604,7 +609,7 @@ g_return_if_fail(playlist != NULL); - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); node = playlist->entries; @@ -620,7 +625,7 @@ node = next_node; } - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); playlist_recalc_total_time(playlist); @@ -646,11 +651,11 @@ { g_return_if_fail(filename != NULL); - PLAYLIST_LOCK( playlist->mutex ); + PLAYLIST_LOCK(playlist); playlist->entries = g_list_insert(playlist->entries, playlist_entry_new(filename, title, len, dec), pos); - PLAYLIST_UNLOCK( playlist->mutex ); + PLAYLIST_UNLOCK(playlist); g_mutex_lock(mutex_scan); playlist_get_info_scan_active = TRUE; @@ -674,7 +679,8 @@ if(!playlist->tail) playlist->tail = g_list_last(playlist->entries); - PLAYLIST_LOCK( playlist->mutex ); + PLAYLIST_LOCK(playlist); + if(pos == -1) { // the common case GList *element; element = g_list_alloc(); @@ -696,7 +702,8 @@ playlist->entries = g_list_insert(playlist->entries, entry, pos); } - PLAYLIST_UNLOCK( playlist->mutex ); + PLAYLIST_UNLOCK(playlist); + if (tuple != NULL) { const gchar *formatter = tuple_get_string(tuple, "formatter"); entry->title = tuple_formatter_make_title_string(tuple, formatter ? @@ -1028,9 +1035,9 @@ g_free(decoded); - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); node = g_list_nth(playlist->entries, pos); - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); entries += i; @@ -1122,23 +1129,23 @@ if (!playlist) return; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); if (!playlist->position || !playlistwin_list) { - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); return; } pos = g_list_index(playlist->entries, playlist->position); if (playlistwin_item_visible(pos)) { - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); return; } bottom = MAX(0, playlist_get_length(playlist) - UI_SKINNED_PLAYLIST(playlistwin_list)->num_visible); row = CLAMP(pos - UI_SKINNED_PLAYLIST(playlistwin_list)->num_visible / 2, 0, bottom); - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); playlistwin_set_toprow(row); g_cond_signal(cond_scan); } @@ -1151,7 +1158,7 @@ if (!playlist_get_length(playlist)) return; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); if ((playlist_position_before_jump != NULL) && playlist->queue == NULL) { @@ -1162,17 +1169,17 @@ plist_pos_list = find_playlist_position_list(playlist); if (!cfg.repeat && !g_list_next(plist_pos_list) && playlist->queue == NULL) { - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); return; } if (playback_get_playing()) { /* We need to stop before changing playlist_position */ - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); ip_data.stop = TRUE; playback_stop(); ip_data.stop = FALSE; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); restart_playing = TRUE; } @@ -1189,7 +1196,7 @@ else playlist->position = playlist->entries->data; } - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); playlist_check_pos_current(playlist); if (restart_playing) @@ -1207,7 +1214,7 @@ if (!playlist_get_length(playlist)) return; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); if ((playlist_position_before_jump != NULL) && playlist->queue == NULL) { @@ -1218,17 +1225,17 @@ plist_pos_list = find_playlist_position_list(playlist); if (!cfg.repeat && !g_list_previous(plist_pos_list)) { - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); return; } if (playback_get_playing()) { /* We need to stop before changing playlist_position */ - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); ip_data.stop = TRUE; playback_stop(); ip_data.stop = FALSE; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); restart_playing = TRUE; } @@ -1248,7 +1255,7 @@ playlist->position = node->data; } - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); playlist_check_pos_current(playlist); @@ -1264,7 +1271,7 @@ GList *list = playlist_get_selected(playlist); GList *it = list; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); if ((cfg.shuffle) && (playlist_position_before_jump == NULL)) { @@ -1290,7 +1297,7 @@ playlist->queue = g_list_concat(playlist->queue, list); - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); playlist_recalc_total_time(playlist); playlistwin_update_list(playlist); @@ -1302,7 +1309,7 @@ GList *tmp; PlaylistEntry *entry; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); if ((cfg.shuffle) && (playlist_position_before_jump == NULL)) { @@ -1317,7 +1324,7 @@ } else playlist->queue = g_list_append(playlist->queue, entry); - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); playlist_recalc_total_time(playlist); playlistwin_update_list(playlist); @@ -1329,10 +1336,10 @@ PlaylistEntry *entry; GList *tmp; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); entry = g_list_nth_data(playlist->entries, pos); tmp = g_list_find(playlist->queue, entry); - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); return tmp != NULL; } @@ -1343,10 +1350,10 @@ PlaylistEntry *entry; gint tmp; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); entry = g_list_nth_data(playlist->entries, pos); tmp = g_list_index(playlist->queue, entry); - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); return tmp; } @@ -1357,10 +1364,10 @@ PlaylistEntry *entry; gint tmp; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); entry = g_list_nth_data(playlist->queue, pos); tmp = g_list_index(playlist->entries, entry); - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); return tmp; } @@ -1368,10 +1375,10 @@ void playlist_clear_queue(Playlist *playlist) { - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); g_list_free(playlist->queue); playlist->queue = NULL; - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); playlist_recalc_total_time(playlist); playlistwin_update_list(playlist); @@ -1382,10 +1389,10 @@ { void *entry; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); entry = g_list_nth_data(playlist->entries, pos); playlist->queue = g_list_remove(playlist->queue, entry); - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); playlistwin_update_list(playlist); } @@ -1405,21 +1412,21 @@ if (!playlist) return; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); node = g_list_nth(playlist->entries, pos); if (!node) { - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); return; } if (playback_get_playing()) { /* We need to stop before changing playlist_position */ - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); ip_data.stop = TRUE; playback_stop(); ip_data.stop = FALSE; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); restart_playing = TRUE; } @@ -1430,7 +1437,7 @@ } playlist->position = node->data; - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); playlist_check_pos_current(playlist); if (restart_playing) @@ -1452,7 +1459,7 @@ hook_call("playback end", playlist->position); - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); if ((playlist_position_before_jump != NULL) && playlist->queue == NULL) { @@ -1463,7 +1470,7 @@ plist_pos_list = find_playlist_position_list(playlist); if (cfg.no_playlist_advance) { - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); mainwin_clear_song_info(); if (cfg.repeat) playback_initiate(); @@ -1471,7 +1478,7 @@ } if (cfg.stopaftersong) { - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); mainwin_clear_song_info(); mainwin_set_stopaftersong(FALSE); return; @@ -1489,7 +1496,7 @@ playlist->position = playlist->entries->data; if (!cfg.repeat) { - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); hook_call("playlist end reached", playlist->position); mainwin_clear_song_info(); return; @@ -1498,7 +1505,7 @@ else playlist->position = g_list_next(plist_pos_list)->data; - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); playlist_check_pos_current(playlist); playback_initiate(); @@ -1510,9 +1517,9 @@ { gint length; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); length = g_list_length(playlist->queue); - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); return length; } @@ -1530,9 +1537,9 @@ g_return_val_if_fail(playlist != NULL, NULL); - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); if (!playlist->position) { - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); return NULL; } @@ -1568,7 +1575,7 @@ else length = g_strdup(""); - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); text = convert_title_text(g_strconcat(numbers, title, length, NULL)); @@ -1834,9 +1841,9 @@ { gint pos; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); pos = playlist_get_position_nolock(playlist); - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); return pos; } @@ -1851,16 +1858,16 @@ if (!playlist) return NULL; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); node = g_list_nth(playlist->entries, pos); if (!node) { - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); return NULL; } entry = node->data; filename = g_strdup(entry->filename); - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); return filename; } @@ -1876,10 +1883,10 @@ if (!playlist) return NULL; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); if (!(node = g_list_nth(playlist->entries, pos))) { - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); return NULL; } @@ -1901,7 +1908,7 @@ title = entry->title; } - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); if (!title) { gchar *realfn = NULL; @@ -2231,11 +2238,11 @@ playlist_sort(Playlist *playlist, PlaylistSortType type) { playlist_remove_dead_files(playlist); - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); playlist->entries = g_list_sort(playlist->entries, (GCompareFunc) playlist_compare_func_table[type]); - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); } static GList * @@ -2290,19 +2297,19 @@ void playlist_sort_selected(Playlist *playlist, PlaylistSortType type) { - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); playlist->entries = playlist_sort_selected_generic(playlist->entries, (GCompareFunc) playlist_compare_func_table [type]); - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); } void playlist_reverse(Playlist *playlist) { - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); playlist->entries = g_list_reverse(playlist->entries); - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); } static GList * @@ -2352,9 +2359,9 @@ void playlist_random(Playlist *playlist) { - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); playlist->entries = playlist_shuffle_list(playlist, playlist->entries); - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); } GList * @@ -2363,13 +2370,13 @@ GList *node, *list = NULL; gint i = 0; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); for (node = playlist->entries; node; node = g_list_next(node), i++) { PlaylistEntry *entry = node->data; if (entry->selected) list = g_list_prepend(list, GINT_TO_POINTER(i)); } - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); return g_list_reverse(list); } @@ -2379,11 +2386,11 @@ GList *node = NULL; gint i = 0; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); for (node = playlist->entries; node; node = g_list_next(node), i++) { PLAYLIST_ENTRY(node->data)->selected = FALSE; } - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); playlist_recalc_total_time(playlist); playlist_manager_update(); } @@ -2394,13 +2401,13 @@ GList *node; gint num = 0; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); for (node = playlist->entries; node; node = g_list_next(node)) { PlaylistEntry *entry = node->data; if (entry->selected) num++; } - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); return num; } @@ -2408,9 +2415,9 @@ static void playlist_generate_shuffle_list(Playlist *playlist) { - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); playlist_generate_shuffle_list_nolock(playlist); - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); } static void @@ -2450,7 +2457,7 @@ ProbeResult *pr = NULL; time_t mtime; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); if ((node = g_list_nth(playlist->entries, pos))) { @@ -2459,7 +2466,7 @@ path = g_strdup(entry->filename); } - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); if (entry->tuple) mtime = tuple_get_int(entry->tuple, "mtime"); @@ -2508,7 +2515,7 @@ gchar *path = NULL; Tuple *tuple = NULL; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); if (playlist->entries && playlist->position) { @@ -2518,7 +2525,7 @@ tuple = playlist->position->tuple; } - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); if (tuple != NULL) { @@ -2546,13 +2553,27 @@ { gboolean result; - G_LOCK(playlist_get_info_going); + g_static_rw_lock_reader_lock(&playlist_get_info_rwlock); result = playlist_get_info_going; - G_UNLOCK(playlist_get_info_going); + g_static_rw_lock_reader_unlock(&playlist_get_info_rwlock); return result; } + +static gboolean +playlist_get_info_scanning(void) +{ + gboolean result; + + g_mutex_lock(mutex_scan); + result = playlist_get_info_scan_active; + g_mutex_unlock(mutex_scan); + + return result; +} + + static gboolean playlist_request_win_update(gpointer unused) { @@ -2561,6 +2582,7 @@ return FALSE; /* to be called only once */ } + static gpointer playlist_get_info_func(gpointer arg) { @@ -2572,9 +2594,8 @@ Playlist *playlist = playlist_get_active(); // on_load - if (cfg.use_pl_metadata && - cfg.get_info_on_load && - playlist_get_info_scan_active) { + if (cfg.use_pl_metadata && cfg.get_info_on_load && + playlist_get_info_scanning()) { for (node = playlist->entries; node; node = g_list_next(node)) { entry = node->data; @@ -2640,9 +2661,8 @@ } } } // on_demand - else if (cfg.get_info_on_demand && - (!cfg.playlist_visible || cfg.playlist_shaded - || !cfg.use_pl_metadata)) + else if (cfg.get_info_on_demand && + (!cfg.playlist_visible || cfg.playlist_shaded || !cfg.use_pl_metadata)) { g_mutex_lock(mutex_scan); playlist_get_info_scan_active = FALSE; @@ -2663,7 +2683,7 @@ update_playlistwin = FALSE; } - if (playlist_get_info_scan_active) { + if (playlist_get_info_scanning()) { continue; } @@ -2680,9 +2700,9 @@ void playlist_start_get_info_thread(void) { - G_LOCK(playlist_get_info_going); + g_static_rw_lock_writer_lock(&playlist_get_info_rwlock); playlist_get_info_going = TRUE; - G_UNLOCK(playlist_get_info_going); + g_static_rw_lock_writer_unlock(&playlist_get_info_rwlock); playlist_get_info_thread = g_thread_create(playlist_get_info_func, NULL, TRUE, NULL); @@ -2691,9 +2711,9 @@ void playlist_stop_get_info_thread(void) { - G_LOCK(playlist_get_info_going); + g_static_rw_lock_writer_lock(&playlist_get_info_rwlock); playlist_get_info_going = FALSE; - G_UNLOCK(playlist_get_info_going); + g_static_rw_lock_writer_unlock(&playlist_get_info_rwlock); g_cond_broadcast(cond_scan); g_thread_join(playlist_get_info_thread); @@ -2705,6 +2725,7 @@ g_mutex_lock(mutex_scan); playlist_get_info_scan_active = TRUE; g_mutex_unlock(mutex_scan); + g_cond_signal(cond_scan); } @@ -2713,7 +2734,7 @@ { GList *node, *next_node; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); for (node = playlist->entries; node; node = next_node) { PlaylistEntry *entry = PLAYLIST_ENTRY(node->data); @@ -2748,7 +2769,7 @@ playlist->entries = g_list_delete_link(playlist->entries, node); } - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); playlist_generate_shuffle_list(playlist); playlistwin_update_list(playlist); @@ -2838,7 +2859,7 @@ break; } - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); for (node = playlist->entries; node; node = next_node) { PlaylistEntry *entry = PLAYLIST_ENTRY(node->data); @@ -2883,7 +2904,7 @@ } } - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); playlistwin_update_list(playlist); playlist_recalc_total_time(playlist); @@ -2898,12 +2919,12 @@ gboolean * total_more, gboolean * selection_more) { - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); *total_time = playlist->pl_total_time; *selection_time = playlist->pl_selection_time; *total_more = playlist->pl_total_more; *selection_more = playlist->pl_selection_more; - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); } @@ -2940,9 +2961,9 @@ static void playlist_recalc_total_time(Playlist *playlist) { - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); playlist_recalc_total_time_nolock(playlist); - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); } gint @@ -2958,7 +2979,7 @@ onig_set_default_syntax( ONIG_SYNTAX_POSIX_BASIC ); #endif - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); if ( tuple_get_string(tuple, "title") != NULL ) { @@ -3096,7 +3117,7 @@ g_list_free( found_list ); - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); playlist_recalc_total_time(playlist); return num_of_entries_found; @@ -3107,14 +3128,14 @@ { GList *list; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); for (list = playlist->entries; list; list = g_list_next(list)) { PlaylistEntry *entry = list->data; entry->selected = set; } - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); playlist_recalc_total_time(playlist); } @@ -3123,14 +3144,14 @@ { GList *list; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); for (list = playlist->entries; list; list = g_list_next(list)) { PlaylistEntry *entry = list->data; entry->selected = !entry->selected; } - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); playlist_recalc_total_time(playlist); } @@ -3140,7 +3161,7 @@ GList *list; gboolean invert_ok = FALSE; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); if ((list = g_list_nth(playlist->entries, pos))) { PlaylistEntry *entry = list->data; @@ -3148,7 +3169,7 @@ invert_ok = TRUE; } - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); playlist_recalc_total_time(playlist); return invert_ok; @@ -3164,7 +3185,7 @@ if (min_pos > max_pos) SWAP(min_pos, max_pos); - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); list = g_list_nth(playlist->entries, min_pos); for (i = min_pos; i <= max_pos && list; i++) { @@ -3173,7 +3194,7 @@ list = g_list_next(list); } - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); playlist_recalc_total_time(playlist); } @@ -3184,7 +3205,7 @@ GList *node; gboolean retval = FALSE; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); for (node = playlist->entries; node; node = g_list_next(node)) { PlaylistEntry *entry = node->data; @@ -3207,7 +3228,7 @@ } } - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); playlistwin_update_list(playlist); playlist_recalc_total_time(playlist); @@ -3220,7 +3241,7 @@ { GList *node; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); if ((node = g_list_nth(playlist->entries, pos))) { PlaylistEntry *entry = node->data; @@ -3229,7 +3250,7 @@ playlist_entry_get_info(entry); } - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); playlistwin_update_list(playlist); playlist_recalc_total_time(playlist); @@ -3254,14 +3275,14 @@ if (!playlist) return; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); playlist_position_before_jump = NULL; cfg.shuffle = shuffle; playlist_generate_shuffle_list_nolock(playlist); - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); } Playlist * @@ -3280,9 +3301,11 @@ void playlist_free(Playlist *playlist) { + if (!playlist) + return; + g_mutex_free( playlist->mutex ); g_free( playlist ); - return; } Playlist * @@ -3294,7 +3317,7 @@ playlist_add_playlist( newpl ); - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); while ( list != NULL ) { @@ -3304,7 +3327,7 @@ list = g_list_next(list); } - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); playlist_recalc_total_time(newpl); playlistwin_update_list(playlist); @@ -3320,7 +3343,7 @@ if (!playlist) return NULL; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); if (!playlist->position) { if (cfg.shuffle) @@ -3331,7 +3354,7 @@ filename = playlist->position->filename; - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); return filename; } @@ -3342,7 +3365,7 @@ if (!playlist) return NULL; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); if (!playlist->position) { if (cfg.shuffle) @@ -3351,7 +3374,7 @@ playlist->position = playlist->entries->data; } - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); return playlist->position; }
--- a/src/audacious/playlist.h Mon Sep 10 14:16:20 2007 +0930 +++ b/src/audacious/playlist.h Mon Sep 10 14:18:18 2007 +0930 @@ -126,6 +126,7 @@ void playlist_select_prev(void); GList * playlist_get_playlists(void); +void playlist_clear_only(Playlist *playlist); void playlist_clear(Playlist *playlist); void playlist_delete(Playlist *playlist, gboolean crop); @@ -227,8 +228,8 @@ PlaylistFormat playlist_format_get_from_name(const gchar * filename); gboolean is_playlist_name(const gchar * filename); -#define PLAYLIST_LOCK(m) g_mutex_lock(m) -#define PLAYLIST_UNLOCK(m) g_mutex_unlock(m) +#define PLAYLIST_LOCK(pl) g_mutex_lock(pl->mutex) +#define PLAYLIST_UNLOCK(pl) g_mutex_unlock(pl->mutex) G_LOCK_EXTERN(playlists);
--- a/src/audacious/ui_jumptotrack.c Mon Sep 10 14:16:20 2007 +0930 +++ b/src/audacious/ui_jumptotrack.c Mon Sep 10 14:18:18 2007 +0930 @@ -347,7 +347,7 @@ playlist = playlist_get_active(); - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); for (playlist_glist = playlist->entries; playlist_glist; playlist_glist = g_list_next(playlist_glist)) @@ -403,7 +403,7 @@ g_free(title); title = NULL; } - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); /* attach the model again to the treeview */ gtk_tree_view_set_model( GTK_TREE_VIEW(treeview) , GTK_TREE_MODEL(store) ); @@ -448,7 +448,7 @@ playlist = playlist_get_active(); - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); for (playlist_glist = playlist->entries; playlist_glist; playlist_glist = g_list_next(playlist_glist)) { @@ -478,7 +478,7 @@ } } - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); /* attach liststore to treeview */ gtk_tree_view_set_model(GTK_TREE_VIEW(treeview), GTK_TREE_MODEL(jtf_store));
--- a/src/audacious/ui_main.c Mon Sep 10 14:16:20 2007 +0930 +++ b/src/audacious/ui_main.c Mon Sep 10 14:18:18 2007 +0930 @@ -406,6 +406,8 @@ { GList *playlists = NULL, *playlists_top = NULL; + playlist_stop_get_info_thread(); + gtk_widget_hide(equalizerwin); gtk_widget_hide(playlistwin); gtk_widget_hide(mainwin); @@ -417,7 +419,6 @@ plugin_system_cleanup(); - playlist_stop_get_info_thread(); /* free and clear each playlist */ playlists = playlist_get_playlists();
--- a/src/audacious/ui_playlist_manager.c Mon Sep 10 14:16:20 2007 +0930 +++ b/src/audacious/ui_playlist_manager.c Mon Sep 10 14:18:18 2007 +0930 @@ -60,12 +60,12 @@ gchar *pl_name = NULL; Playlist *playlist = (Playlist*)playlists->data; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); /* for each playlist, pick name and number of entries */ pl_name = (gchar*)playlist_get_current_name( playlist ); for (entries = playlist->entries; entries; entries = g_list_next(entries)) entriesnum++; - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); gtk_list_store_append( store , &iter ); gtk_list_store_set( store, &iter, @@ -207,7 +207,7 @@ GtkWidget *pmenu = (GtkWidget*)g_object_get_data( G_OBJECT(lv) , "menu" ); gtk_menu_popup( GTK_MENU(pmenu) , NULL , NULL , NULL , NULL , (event != NULL) ? event->button : 0, - gdk_event_get_time((GdkEvent*)event)); + event->time); return TRUE; }
--- a/src/audacious/ui_skinned_playlist.c Mon Sep 10 14:16:20 2007 +0930 +++ b/src/audacious/ui_skinned_playlist.c Mon Sep 10 14:18:18 2007 +0930 @@ -290,14 +290,14 @@ if (!playlist) return; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); if ((list = playlist->entries) == NULL) { - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); return; } if (PLAYLIST_ENTRY(list->data)->selected) { /* We are at the top */ - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); return; } while (list) { @@ -305,7 +305,7 @@ glist_moveup(list); list = g_list_next(list); } - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); if (pl->prev_selected != -1) pl->prev_selected--; if (pl->prev_min != -1) @@ -321,16 +321,16 @@ if (!playlist) return; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); if (!(list = g_list_last(playlist->entries))) { - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); return; } if (PLAYLIST_ENTRY(list->data)->selected) { /* We are at the bottom */ - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); return; } @@ -340,7 +340,7 @@ list = g_list_previous(list); } - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); if (pl->prev_selected != -1) pl->prev_selected++; @@ -484,7 +484,7 @@ pl->first = CLAMP(pl->first, 0, max_first); - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); list = playlist->entries; list = g_list_nth(list, pl->first); @@ -763,7 +763,7 @@ gdk_gc_set_clip_origin(gc, 0, 0); gdk_gc_set_clip_rectangle(gc, NULL); - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); gdk_draw_drawable(widget->window, gc, obj, 0, 0, 0, 0, priv->width, priv->height);
--- a/src/audacious/util.c Mon Sep 10 14:16:20 2007 +0930 +++ b/src/audacious/util.c Mon Sep 10 14:18:18 2007 +0930 @@ -894,7 +894,7 @@ * Return value: A GTK widget handle for the message box. **/ GtkWidget * -xmms_show_message(const gchar * title, const gchar * text, +audacious_info_dialog(const gchar * title, const gchar * text, const gchar * button_text, gboolean modal, GtkSignalFunc button_action, gpointer action_data) { @@ -970,28 +970,3 @@ return datadir; } - -/** - * xmms_check_realtime_priority: - * - * Legacy function included for compatibility with XMMS. - * - * Return value: FALSE - **/ -gboolean -xmms_check_realtime_priority(void) -{ - return FALSE; -} - -/** - * xmms_usleep: - * @usec: The amount of microseconds to sleep. - * - * Legacy function included for compatibility with XMMS. - **/ -void -xmms_usleep(gint usec) -{ - g_usleep(usec); -}
--- a/src/audacious/util.h Mon Sep 10 14:16:20 2007 +0930 +++ b/src/audacious/util.h Mon Sep 10 14:18:18 2007 +0930 @@ -91,23 +91,14 @@ GdkPixmap *audacious_pixmap_resize(GdkWindow *src, GdkGC *src_gc, GdkPixmap *in, gint width, gint height); -/* XMMS names */ - -#define bmp_info_dialog(title, text, button_text, model, button_action, action_data) \ - xmms_show_message(title, text, button_text, model, button_action, action_data) - -#define bmp_usleep(usec) \ - xmms_usleep(usec) - -#define bmp_check_realtime_priority() \ - xmms_check_realtime_priority() - -GtkWidget *xmms_show_message(const gchar * title, const gchar * text, +GtkWidget *audacious_info_dialog(const gchar * title, const gchar * text, const gchar * button_text, gboolean modal, GtkSignalFunc button_action, gpointer action_data); -gboolean xmms_check_realtime_priority(void); -void xmms_usleep(gint usec); + +/* FIXME! Remove this completely -ccr */ +#define xmms_check_realtime_priority(N) FALSE + GdkPixmap *create_dblsize_pixmap(GdkPixmap *pix);