Mercurial > audlegacy
changeset 3511:a1d398a05b52 trunk
Automated merge with file:/home/ccr/audacious/core
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 09 Sep 2007 23:21:49 +0300 |
parents | b2a82a73a788 (current diff) 95d8ceb5e1d7 (diff) |
children | 6f8005df972f |
files | src/audacious/playlist.c src/audacious/ui_skinned_playlist.c |
diffstat | 9 files changed, 170 insertions(+), 188 deletions(-) [+] |
line wrap: on
line diff
--- a/.hgtags Sun Sep 09 16:31:50 2007 +0300 +++ b/.hgtags Sun Sep 09 23:21:49 2007 +0300 @@ -2,3 +2,5 @@ 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/src/audacious/dock.c Sun Sep 09 16:31:50 2007 +0300 +++ b/src/audacious/dock.c Sun Sep 09 23:21:49 2007 +0300 @@ -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 Sun Sep 09 16:31:50 2007 +0300 +++ b/src/audacious/playlist.c Sun Sep 09 23:21:49 2007 +0300 @@ -410,7 +410,7 @@ void playlist_clear_only(Playlist *playlist) { - PLAYLIST_LOCK( playlist->mutex ); + PLAYLIST_LOCK(playlist); g_list_foreach(playlist->entries, (GFunc) playlist_entry_free, NULL); g_list_free(playlist->entries); @@ -419,7 +419,7 @@ playlist->tail = NULL; playlist->attribute = PLAYLIST_PLAIN; - PLAYLIST_UNLOCK( playlist->mutex ); + PLAYLIST_UNLOCK(playlist); } void @@ -456,11 +456,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; } @@ -502,18 +502,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); @@ -535,7 +535,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; @@ -551,7 +551,7 @@ } } - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); playlist_recalc_total_time(playlist); playlistwin_update_list(playlist); @@ -576,7 +576,7 @@ g_return_if_fail(playlist != NULL); - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); node = playlist->entries; @@ -592,7 +592,7 @@ node = next_node; } - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); playlist_recalc_total_time(playlist); @@ -618,11 +618,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; @@ -649,7 +649,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(); @@ -671,7 +672,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, FIELD_FORMATTER, NULL); entry->title = tuple_formatter_make_title_string(tuple, formatter ? @@ -1003,9 +1005,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; @@ -1097,23 +1099,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); } @@ -1126,7 +1128,7 @@ if (!playlist_get_length(playlist)) return; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); if ((playlist_position_before_jump != NULL) && playlist->queue == NULL) { @@ -1137,17 +1139,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; } @@ -1164,7 +1166,7 @@ else playlist->position = playlist->entries->data; } - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); playlist_check_pos_current(playlist); if (restart_playing) @@ -1182,7 +1184,7 @@ if (!playlist_get_length(playlist)) return; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); if ((playlist_position_before_jump != NULL) && playlist->queue == NULL) { @@ -1193,17 +1195,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; } @@ -1223,7 +1225,7 @@ playlist->position = node->data; } - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); playlist_check_pos_current(playlist); @@ -1239,7 +1241,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)) { @@ -1265,7 +1267,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); @@ -1277,7 +1279,7 @@ GList *tmp; PlaylistEntry *entry; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); if ((cfg.shuffle) && (playlist_position_before_jump == NULL)) { @@ -1292,7 +1294,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); @@ -1304,10 +1306,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; } @@ -1318,10 +1320,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; } @@ -1332,10 +1334,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; } @@ -1343,10 +1345,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); @@ -1357,10 +1359,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); } @@ -1380,21 +1382,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; } @@ -1405,7 +1407,7 @@ } playlist->position = node->data; - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); playlist_check_pos_current(playlist); if (restart_playing) @@ -1427,7 +1429,7 @@ hook_call("playback end", playlist->position); - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); if ((playlist_position_before_jump != NULL) && playlist->queue == NULL) { @@ -1438,7 +1440,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(); @@ -1446,7 +1448,7 @@ } if (cfg.stopaftersong) { - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); mainwin_clear_song_info(); mainwin_set_stopaftersong(FALSE); return; @@ -1464,7 +1466,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; @@ -1473,7 +1475,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(); @@ -1485,9 +1487,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; } @@ -1505,9 +1507,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; } @@ -1543,7 +1545,7 @@ else length = g_strdup(""); - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); text = convert_title_text(g_strconcat(numbers, title, length, NULL)); @@ -1798,9 +1800,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; } @@ -1815,16 +1817,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; } @@ -1840,10 +1842,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; } @@ -1865,7 +1867,7 @@ title = entry->title; } - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); if (!title) { gchar *realfn = NULL; @@ -2195,11 +2197,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 * @@ -2254,19 +2256,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 * @@ -2316,9 +2318,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 * @@ -2327,13 +2329,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); } @@ -2343,11 +2345,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(); } @@ -2358,13 +2360,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; } @@ -2372,9 +2374,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 @@ -2414,7 +2416,7 @@ ProbeResult *pr = NULL; time_t mtime; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); if ((node = g_list_nth(playlist->entries, pos))) { @@ -2423,7 +2425,7 @@ path = g_strdup(entry->filename); } - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); if (entry->tuple) mtime = tuple_get_int(entry->tuple, FIELD_MTIME, NULL); @@ -2472,7 +2474,7 @@ gchar *path = NULL; Tuple *tuple = NULL; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); if (playlist->entries && playlist->position) { @@ -2482,7 +2484,7 @@ tuple = playlist->position->tuple; } - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); if (tuple != NULL) { @@ -2519,6 +2521,19 @@ 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) { Playlist *playlist = playlist_get_active(); @@ -2539,7 +2554,7 @@ // on_load if (cfg.use_pl_metadata && cfg.get_info_on_load && - playlist_get_info_scan_active) { + playlist_get_info_scanning()) { for (node = playlist->entries; node; node = g_list_next(node)) { entry = node->data; @@ -2629,7 +2644,7 @@ update_playlistwin = FALSE; } - if (playlist_get_info_scan_active) { + if (playlist_get_info_scanning()) { continue; } @@ -2680,7 +2695,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); @@ -2715,7 +2730,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); @@ -2805,7 +2820,7 @@ break; } - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); for (node = playlist->entries; node; node = next_node) { PlaylistEntry *entry = PLAYLIST_ENTRY(node->data); @@ -2850,7 +2865,7 @@ } } - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); playlistwin_update_list(playlist); playlist_recalc_total_time(playlist); @@ -2865,12 +2880,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); } @@ -2907,9 +2922,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 @@ -2930,7 +2945,7 @@ onig_set_default_syntax( ONIG_SYNTAX_POSIX_BASIC ); #endif - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); if ( (regex_pattern = tuple_get_string(tuple, FIELD_TITLE, NULL)) != NULL ) { @@ -3060,7 +3075,7 @@ g_list_free( found_list ); - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); playlist_recalc_total_time(playlist); return num_of_entries_found; @@ -3071,14 +3086,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); } @@ -3087,14 +3102,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); } @@ -3104,7 +3119,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; @@ -3112,7 +3127,7 @@ invert_ok = TRUE; } - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); playlist_recalc_total_time(playlist); return invert_ok; @@ -3128,7 +3143,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++) { @@ -3137,7 +3152,7 @@ list = g_list_next(list); } - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); playlist_recalc_total_time(playlist); } @@ -3148,7 +3163,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; @@ -3171,7 +3186,7 @@ } } - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); playlistwin_update_list(playlist); playlist_recalc_total_time(playlist); @@ -3184,7 +3199,7 @@ { GList *node; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); if ((node = g_list_nth(playlist->entries, pos))) { PlaylistEntry *entry = node->data; @@ -3193,7 +3208,7 @@ playlist_entry_get_info(entry); } - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); playlistwin_update_list(playlist); playlist_recalc_total_time(playlist); @@ -3218,14 +3233,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 * @@ -3244,6 +3259,9 @@ void playlist_free(Playlist *playlist) { + if (!playlist) + return; + g_mutex_free( playlist->mutex ); g_free( playlist ); } @@ -3257,7 +3275,7 @@ playlist_add_playlist( newpl ); - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); while ( list != NULL ) { @@ -3267,7 +3285,7 @@ list = g_list_next(list); } - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); playlist_recalc_total_time(newpl); playlistwin_update_list(playlist); @@ -3283,7 +3301,7 @@ if (!playlist) return NULL; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); if (!playlist->position) { if (cfg.shuffle) @@ -3294,7 +3312,7 @@ filename = playlist->position->filename; - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); return filename; } @@ -3305,7 +3323,7 @@ if (!playlist) return NULL; - PLAYLIST_LOCK(playlist->mutex); + PLAYLIST_LOCK(playlist); if (!playlist->position) { if (cfg.shuffle) @@ -3314,7 +3332,7 @@ playlist->position = playlist->entries->data; } - PLAYLIST_UNLOCK(playlist->mutex); + PLAYLIST_UNLOCK(playlist); return playlist->position; }
--- a/src/audacious/playlist.h Sun Sep 09 16:31:50 2007 +0300 +++ b/src/audacious/playlist.h Sun Sep 09 23:21:49 2007 +0300 @@ -223,8 +223,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 Sun Sep 09 16:31:50 2007 +0300 +++ b/src/audacious/ui_jumptotrack.c Sun Sep 09 23:21:49 2007 +0300 @@ -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_playlist_manager.c Sun Sep 09 16:31:50 2007 +0300 +++ b/src/audacious/ui_playlist_manager.c Sun Sep 09 23:21:49 2007 +0300 @@ -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 Sun Sep 09 16:31:50 2007 +0300 +++ b/src/audacious/ui_skinned_playlist.c Sun Sep 09 23:21:49 2007 +0300 @@ -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 Sun Sep 09 16:31:50 2007 +0300 +++ b/src/audacious/util.c Sun Sep 09 23:21:49 2007 +0300 @@ -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 Sun Sep 09 16:31:50 2007 +0300 +++ b/src/audacious/util.h Sun Sep 09 23:21:49 2007 +0300 @@ -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);