Mercurial > audlegacy
changeset 4244:8b9b5d04aac4
Automated merge with file:/home/asphyx/ahinea/audacious-newaudio
author | Eugene Zagidullin <e.asphyx@gmail.com> |
---|---|
date | Mon, 04 Feb 2008 05:55:43 +0300 |
parents | 9f3cc7f3aaf6 (diff) ec266557f845 (current diff) |
children | 96df51b80892 |
files | src/audacious/ui_preferences.c |
diffstat | 4 files changed, 65 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/audacious/playlist.c Mon Feb 04 05:49:27 2008 +0300 +++ b/src/audacious/playlist.c Mon Feb 04 05:55:43 2008 +0300 @@ -228,7 +228,18 @@ /* renew tuple if file mtime is newer than tuple mtime. */ if (entry->tuple){ if (tuple_get_int(entry->tuple, FIELD_MTIME, NULL) == modtime) { - g_free(pr); + if (pr != NULL) g_free(pr); + + if (entry->title_is_valid == FALSE) { /* update title even tuple is present and up to date --asphyx */ + AUDDBG("updating title from actual tuple\n"); + formatter = tuple_get_string(entry->tuple, FIELD_FORMATTER, NULL); + if (entry->title != NULL) g_free(entry->title); + entry->title = tuple_formatter_make_title_string(entry->tuple, formatter ? + formatter : get_gentitle_format()); + entry->title_is_valid = TRUE; + AUDDBG("new title: \"%s\"\n", entry->title); + } + return TRUE; } else { mowgli_object_unref(entry->tuple); @@ -242,7 +253,7 @@ tuple = entry->decoder->get_song_tuple(entry->filename); if (tuple == NULL) { - g_free(pr); + if (pr != NULL) g_free(pr); return FALSE; } @@ -253,10 +264,11 @@ formatter = tuple_get_string(tuple, FIELD_FORMATTER, NULL); entry->title = tuple_formatter_make_title_string(tuple, formatter ? formatter : get_gentitle_format()); + entry->title_is_valid = TRUE; entry->length = tuple_get_int(tuple, FIELD_LENGTH, NULL); entry->tuple = tuple; - g_free(pr); + if (pr != NULL) g_free(pr); return TRUE; } @@ -743,6 +755,7 @@ g_free(entry->title); entry->title = tuple_formatter_make_title_string(tuple, formatter ? formatter : get_gentitle_format()); + entry->title_is_valid = TRUE; entry->length = tuple_get_int(tuple, FIELD_LENGTH, NULL); entry->tuple = tuple; } @@ -2564,7 +2577,7 @@ if(playlist->attribute & PLAYLIST_STATIC || // live lock fix (entry->tuple && tuple_get_int(entry->tuple, FIELD_LENGTH, NULL) > -1 && - tuple_get_int(entry->tuple, FIELD_MTIME, NULL) != -1)) { + tuple_get_int(entry->tuple, FIELD_MTIME, NULL) != -1 && entry->title_is_valid)) { update_playlistwin = TRUE; continue; } @@ -2579,7 +2592,7 @@ tuple_get_int(entry->tuple, FIELD_LENGTH, NULL) > -1 && tuple_get_int(entry->tuple, FIELD_MTIME, NULL) != -1) { update_playlistwin = TRUE; - break; + break; /* hmmm... --asphyx */ } } @@ -2609,7 +2622,7 @@ 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)) { + tuple_get_int(entry->tuple, FIELD_MTIME, NULL) != -1 && entry->title_is_valid)) { continue; } @@ -2696,6 +2709,7 @@ void playlist_start_get_info_scan(void) { + AUDDBG("waking up scan thread\n"); g_mutex_lock(mutex_scan); playlist_get_info_scan_active = TRUE; g_mutex_unlock(mutex_scan); @@ -2704,6 +2718,23 @@ } void +playlist_update_all_titles(void) /* update titles after format changing --asphyx */ +{ + PlaylistEntry *entry; + GList *node; + Playlist *playlist = playlist_get_active(); + + AUDDBG("invalidating titles\n"); + PLAYLIST_LOCK(playlist); + for (node = playlist->entries; node; node = g_list_next(node)) { + entry = node->data; + entry->title_is_valid = FALSE; + } + PLAYLIST_UNLOCK(playlist); + playlist_start_get_info_scan(); +} + +void playlist_remove_dead_files(Playlist *playlist) { GList *node, *next_node;
--- a/src/audacious/playlist.h Mon Feb 04 05:49:27 2008 +0300 +++ b/src/audacious/playlist.h Mon Feb 04 05:55:43 2008 +0300 @@ -70,6 +70,7 @@ gboolean selected; InputPlugin *decoder; Tuple *tuple; /* cached entry tuple, if available */ + gboolean title_is_valid; /* set it to FALSE after title format changing to update title even if tuple is present --asphyx */ }; #define PLAYLIST(x) ((Playlist *)(x)) @@ -165,6 +166,7 @@ void playlist_start_get_info_thread(void); void playlist_stop_get_info_thread(); void playlist_start_get_info_scan(void); +void playlist_update_all_titles(void); void playlist_sort(Playlist *playlist, PlaylistSortType type); void playlist_sort_selected(Playlist *playlist, PlaylistSortType type);
--- a/src/audacious/ui_fileinfo.c Mon Feb 04 05:49:27 2008 +0300 +++ b/src/audacious/ui_fileinfo.c Mon Feb 04 05:55:43 2008 +0300 @@ -703,6 +703,7 @@ gtk_box_pack_start(GTK_BOX(vbox3), alignment, TRUE, TRUE, 0); alignment = gtk_alignment_new(0.5, 0.5, 1, 1); + gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 6, 0, 0); arrow_rawdata = gtk_expander_new(_("<span size=\"small\">Raw Metadata</span>")); gtk_expander_set_use_markup(GTK_EXPANDER(arrow_rawdata), TRUE); gtk_container_add(GTK_CONTAINER(alignment), arrow_rawdata);
--- a/src/audacious/ui_preferences.c Mon Feb 04 05:49:27 2008 +0300 +++ b/src/audacious/ui_preferences.c Mon Feb 04 05:55:43 2008 +0300 @@ -44,6 +44,7 @@ #include "general.h" #include "output.h" #include "visualization.h" +#include "playlist.h" #include "main.h" #include "ui_skinned_textbox.h" @@ -62,6 +63,8 @@ #include "build_stamp.h" +#define TITLESTRING_UPDATE_TIMEOUT 3 + enum CategoryViewCols { CATEGORY_VIEW_COL_ICON, CATEGORY_VIEW_COL_NAME, @@ -580,12 +583,32 @@ gtk_entry_set_text(GTK_ENTRY(entry), cfg.gentitle_format); } +static gboolean +titlestring_timeout_proc (gpointer data) +{ + titlestring_timeout_counter--; + + if(titlestring_timeout_counter <= 0) { + titlestring_timeout_counter = 0; + playlist_update_all_titles(); + return FALSE; + } else { + return TRUE; + } +} + static void on_titlestring_entry_changed(GtkWidget * entry, gpointer data) { g_free(cfg.gentitle_format); cfg.gentitle_format = g_strdup(gtk_entry_get_text(GTK_ENTRY(entry))); + + if(titlestring_timeout_counter == 0) { + g_timeout_add_seconds (1, (GSourceFunc) titlestring_timeout_proc, NULL); + } + + titlestring_timeout_counter = TITLESTRING_UPDATE_TIMEOUT; } static void @@ -605,6 +628,8 @@ cfg.titlestring_preset = position; gtk_widget_set_sensitive(GTK_WIDGET(data), (position == 6)); + + playlist_update_all_titles(); /* update titles */ } static void