# HG changeset patch # User William Pitcock # Date 1201893334 21600 # Node ID 254ec9932b3746a91eb9d894d2fbb4e22cd7fbe5 # Parent b3e82a1eb1295d278d8ebcb1f8f5928e2568557d# Parent 386c712a5b5bd06414d76b0102620fbf5f607d27 Automated merge with ssh://hg.atheme.org//hg/audacious diff -r b3e82a1eb129 -r 254ec9932b37 src/audacious/main.c --- a/src/audacious/main.c Fri Feb 01 13:15:05 2008 -0600 +++ b/src/audacious/main.c Fri Feb 01 13:15:34 2008 -0600 @@ -166,7 +166,7 @@ 0.0, /* equalizer preamp */ {0.0, 0.0, 0.0, 0.0, 0.0, /* equalizer bands */ 0.0, 0.0, 0.0, 0.0, 0.0}, - 1.5, /* GUI scale factor, set to 1.5 for testing purposes --majeru */ + 1.2, /* GUI scale factor, hardcoded for testing purposes --majeru */ NULL, /* skin */ NULL, /* output plugin */ NULL, /* file selector path */ @@ -614,6 +614,9 @@ cfg_db_get_float(db, NULL, eqtext, &cfg.equalizer_bands[i]); } + /* custom scale factor */ + cfg_db_get_float(db, NULL, "scale_factor", &cfg.scale_factor); + /* History */ if (cfg_db_get_int(db, NULL, "url_history_length", &length)) { for (i = 1; i <= length; i++) { @@ -884,6 +887,8 @@ g_free(str); } + cfg_db_set_float(db, NULL, "scale_factor", cfg.scale_factor); + if (bmp_active_skin != NULL) { if (bmp_active_skin->path) diff -r b3e82a1eb129 -r 254ec9932b37 src/audacious/playlist.c --- a/src/audacious/playlist.c Fri Feb 01 13:15:05 2008 -0600 +++ b/src/audacious/playlist.c Fri Feb 01 13:15:34 2008 -0600 @@ -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; diff -r b3e82a1eb129 -r 254ec9932b37 src/audacious/playlist.h --- a/src/audacious/playlist.h Fri Feb 01 13:15:05 2008 -0600 +++ b/src/audacious/playlist.h Fri Feb 01 13:15:34 2008 -0600 @@ -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); diff -r b3e82a1eb129 -r 254ec9932b37 src/audacious/ui_fileinfo.c --- a/src/audacious/ui_fileinfo.c Fri Feb 01 13:15:05 2008 -0600 +++ b/src/audacious/ui_fileinfo.c Fri Feb 01 13:15:34 2008 -0600 @@ -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(_("Raw Metadata")); gtk_expander_set_use_markup(GTK_EXPANDER(arrow_rawdata), TRUE); gtk_container_add(GTK_CONTAINER(alignment), arrow_rawdata); diff -r b3e82a1eb129 -r 254ec9932b37 src/audacious/ui_preferences.c --- a/src/audacious/ui_preferences.c Fri Feb 01 13:15:05 2008 -0600 +++ b/src/audacious/ui_preferences.c Fri Feb 01 13:15:34 2008 -0600 @@ -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, @@ -188,6 +191,7 @@ static void mainwin_font_set_cb(); static void playlist_font_set_cb(); GtkWidget *ui_preferences_chardet_table_populate(void); +static gint titlestring_timeout_counter = 0; static PreferencesWidget appearance_misc_widgets[] = { {WIDGET_LABEL, N_("_Fonts"), NULL, NULL, NULL, FALSE}, @@ -563,12 +567,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 @@ -588,6 +612,8 @@ cfg.titlestring_preset = position; gtk_widget_set_sensitive(GTK_WIDGET(data), (position == 6)); + + playlist_update_all_titles(); /* update titles */ } static void diff -r b3e82a1eb129 -r 254ec9932b37 src/audacious/ui_skinned_button.c --- a/src/audacious/ui_skinned_button.c Fri Feb 01 13:15:05 2008 -0600 +++ b/src/audacious/ui_skinned_button.c Fri Feb 01 13:15:34 2008 -0600 @@ -20,6 +20,7 @@ #include "ui_skinned_button.h" #include "util.h" +#include #define UI_SKINNED_BUTTON_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), ui_skinned_button_get_type(), UiSkinnedButtonPrivate)) typedef struct _UiSkinnedButtonPrivate UiSkinnedButtonPrivate; @@ -263,24 +264,24 @@ UiSkinnedButton *button = UI_SKINNED_BUTTON (widget); UiSkinnedButtonPrivate *priv = UI_SKINNED_BUTTON_GET_PRIVATE (button); widget->allocation = *allocation; - widget->allocation.x *= (priv->scaled ? cfg.scale_factor : 1); - widget->allocation.y *= (priv->scaled ? cfg.scale_factor : 1); + widget->allocation.x = ceil(widget->allocation.x*(priv->scaled ? cfg.scale_factor : 1)); + widget->allocation.y = ceil(widget->allocation.y*(priv->scaled ? cfg.scale_factor : 1)); if (GTK_WIDGET_REALIZED (widget)) { if ( button->event_window != NULL ) - gdk_window_move_resize(button->event_window, allocation->x*(priv->scaled ? cfg.scale_factor : 1), allocation->y*(priv->scaled ? cfg.scale_factor : 1), allocation->width, allocation->height); + gdk_window_move_resize(button->event_window, ceil(allocation->x*(priv->scaled ? cfg.scale_factor : 1)), ceil(allocation->y*(priv->scaled ? cfg.scale_factor : 1)), allocation->width, allocation->height); else - gdk_window_move_resize(widget->window, allocation->x*(priv->scaled ? cfg.scale_factor : 1), allocation->y*(priv->scaled ? cfg.scale_factor : 1), allocation->width, allocation->height); + gdk_window_move_resize(widget->window, ceil(allocation->x*(priv->scaled ? cfg.scale_factor : 1)), ceil(allocation->y*(priv->scaled ? cfg.scale_factor : 1)), allocation->width, allocation->height); } - if (button->x + priv->move_x == widget->allocation.x/(priv->scaled ? cfg.scale_factor : 1)) + if (button->x + priv->move_x == ceil(widget->allocation.x/(priv->scaled ? cfg.scale_factor : 1))) priv->move_x = 0; - if (button->y + priv->move_y == widget->allocation.y/(priv->scaled ? cfg.scale_factor : 1)) + if (button->y + priv->move_y == ceil(widget->allocation.y/(priv->scaled ? cfg.scale_factor : 1))) priv->move_y = 0; - button->x = widget->allocation.x/(priv->scaled ? cfg.scale_factor : 1); - button->y = widget->allocation.y/(priv->scaled ? cfg.scale_factor : 1); + button->x = ceil(widget->allocation.x/(priv->scaled ? cfg.scale_factor : 1)); + button->y = ceil(widget->allocation.y/(priv->scaled ? cfg.scale_factor : 1)); } static gboolean ui_skinned_button_expose(GtkWidget *widget, GdkEventExpose *event) { diff -r b3e82a1eb129 -r 254ec9932b37 src/audacious/ui_skinned_horizontal_slider.c --- a/src/audacious/ui_skinned_horizontal_slider.c Fri Feb 01 13:15:05 2008 -0600 +++ b/src/audacious/ui_skinned_horizontal_slider.c Fri Feb 01 13:15:34 2008 -0600 @@ -27,6 +27,7 @@ #include "ui_skinned_horizontal_slider.h" #include "main.h" #include "util.h" +#include #define UI_SKINNED_HORIZONTAL_SLIDER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), ui_skinned_horizontal_slider_get_type(), UiSkinnedHorizontalSliderPrivate)) typedef struct _UiSkinnedHorizontalSliderPrivate UiSkinnedHorizontalSliderPrivate; @@ -215,19 +216,19 @@ UiSkinnedHorizontalSliderPrivate *priv = UI_SKINNED_HORIZONTAL_SLIDER_GET_PRIVATE(horizontal_slider); widget->allocation = *allocation; - widget->allocation.x *= (priv->scaled ? cfg.scale_factor : 1); - widget->allocation.y *= (priv->scaled ? cfg.scale_factor : 1); + widget->allocation.x = ceil(widget->allocation.x*(priv->scaled ? cfg.scale_factor : 1)); + widget->allocation.y = ceil(widget->allocation.y*(priv->scaled ? cfg.scale_factor : 1)); if (priv->knob_height == priv->height) - priv->knob_height = allocation->height/(priv->scaled ? cfg.scale_factor : 1); - priv->width = allocation->width/(priv->scaled ? cfg.scale_factor : 1); - priv->height = allocation->height/(priv->scaled ? cfg.scale_factor : 1); + priv->knob_height = ceil(allocation->height/(priv->scaled ? cfg.scale_factor : 1)); + priv->width = ceil(allocation->width/(priv->scaled ? cfg.scale_factor : 1)); + priv->height = ceil(allocation->height/(priv->scaled ? cfg.scale_factor : 1)); if (GTK_WIDGET_REALIZED (widget)) gdk_window_move_resize(widget->window, widget->allocation.x, widget->allocation.y, allocation->width, allocation->height); - horizontal_slider->x = widget->allocation.x/(priv->scaled ? cfg.scale_factor : 1); - horizontal_slider->y = widget->allocation.y/(priv->scaled ? cfg.scale_factor : 1); + horizontal_slider->x = ceil(widget->allocation.x/(priv->scaled ? cfg.scale_factor : 1)); + horizontal_slider->y = ceil(widget->allocation.y/(priv->scaled ? cfg.scale_factor : 1)); } static gboolean ui_skinned_horizontal_slider_expose(GtkWidget *widget, GdkEventExpose *event) { @@ -356,7 +357,9 @@ priv->scaled = !priv->scaled; - gtk_widget_set_size_request(widget, priv->width*(priv->scaled ? cfg.scale_factor : 1), priv->height*(priv->scaled ? cfg.scale_factor : 1)); + gtk_widget_set_size_request(widget, + priv->width*(priv->scaled ? cfg.scale_factor : 1), + priv->height*(priv->scaled ? cfg.scale_factor : 1)); gtk_widget_queue_draw(GTK_WIDGET(horizontal_slider)); } diff -r b3e82a1eb129 -r 254ec9932b37 src/audacious/ui_skinned_textbox.c --- a/src/audacious/ui_skinned_textbox.c Fri Feb 01 13:15:05 2008 -0600 +++ b/src/audacious/ui_skinned_textbox.c Fri Feb 01 13:15:34 2008 -0600 @@ -252,14 +252,14 @@ if (GTK_WIDGET_REALIZED (widget)) gdk_window_move_resize(widget->window, widget->allocation.x, widget->allocation.y, allocation->width, allocation->height); - if (textbox->x + priv->move_x == widget->allocation.x/(priv->scaled ? cfg.scale_factor : 1)); + if (textbox->x + priv->move_x - widget->allocation.x/(priv->scaled ? cfg.scale_factor : 1) <3); priv->move_x = 0; - if (textbox->y + priv->move_y == widget->allocation.y/(priv->scaled ? cfg.scale_factor : 1)); + if (textbox->y + priv->move_y - widget->allocation.y/(priv->scaled ? cfg.scale_factor : 1) <3); priv->move_y = 0; textbox->x = widget->allocation.x/(priv->scaled ? cfg.scale_factor : 1); textbox->y = widget->allocation.y/(priv->scaled ? cfg.scale_factor : 1); - if (textbox->width != (guint) (widget->allocation.width / (priv->scaled ? cfg.scale_factor : 1))) { + if (textbox->width - (guint) (widget->allocation.width / (priv->scaled ? cfg.scale_factor : 1)) > 2) { textbox->width = (guint) (widget->allocation.width / (priv->scaled ? cfg.scale_factor : 1)); if (priv->pixbuf_text) g_free(priv->pixbuf_text); priv->pixbuf_text = NULL; diff -r b3e82a1eb129 -r 254ec9932b37 src/audacious/util.c --- a/src/audacious/util.c Fri Feb 01 13:15:05 2008 -0600 +++ b/src/audacious/util.c Fri Feb 01 13:15:34 2008 -0600 @@ -866,8 +866,8 @@ g_return_if_fail(obj != NULL); if (scale) { - GdkPixbuf *image = gdk_pixbuf_scale_simple(obj, width * cfg.scale_factor, height* cfg.scale_factor, GDK_INTERP_NEAREST); - gdk_draw_pixbuf(widget->window, NULL, image, 0, 0, 0, 0, width * cfg.scale_factor , height * cfg.scale_factor, GDK_RGB_DITHER_NONE, 0, 0); + GdkPixbuf *image = gdk_pixbuf_scale_simple(obj, width * cfg.scale_factor, height* cfg.scale_factor, GDK_INTERP_BILINEAR); + gdk_draw_pixbuf(widget->window, NULL, image, 0, 0, 0, 0, width * cfg.scale_factor , height * cfg.scale_factor, GDK_RGB_DITHER_NORMAL, 0, 0); g_object_unref(image); } else { gdk_draw_pixbuf(widget->window, NULL, obj, 0, 0, 0, 0, width, height, GDK_RGB_DITHER_NONE, 0, 0); diff -r b3e82a1eb129 -r 254ec9932b37 src/libid3tag/field.c --- a/src/libid3tag/field.c Fri Feb 01 13:15:05 2008 -0600 +++ b/src/libid3tag/field.c Fri Feb 01 13:15:34 2008 -0600 @@ -265,7 +265,7 @@ end = *ptr + length; - while (end - *ptr > 0) { + while (end - *ptr > 0 && **ptr != '\0') { latin1 = id3_parse_latin1(ptr, end - *ptr, 0); if (latin1 == 0) goto fail; @@ -304,7 +304,7 @@ end = *ptr + length; - while (end - *ptr > 0) { + while (end - *ptr > 0 && **ptr != '\0') { ucs4 = id3_parse_string(ptr, end - *ptr, *encoding, 0); if (ucs4 == 0) goto fail;