gui/audio: Update album art when manually setting
If the user is fixing broken album art then we need to update the image immediately, otherwise the user will be confused. Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
eb5c0185e7
commit
4f1f76b764
18
gui/audio.c
18
gui/audio.c
|
@ -46,10 +46,10 @@ static GdkPixbuf *__audio_get_pixbuf(struct track *track)
|
||||||
return pix;
|
return pix;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __audio_get_cover(struct track *track)
|
static void __audio_set_cover(void)
|
||||||
{
|
{
|
||||||
GtkImage *cover = GTK_IMAGE(gui_builder_widget("o_cover"));
|
GtkImage *cover = GTK_IMAGE(gui_builder_widget("o_cover"));
|
||||||
GdkPixbuf *pix = __audio_get_pixbuf(track);
|
GdkPixbuf *pix = __audio_get_pixbuf(audio_cur_track());
|
||||||
|
|
||||||
if (pix) {
|
if (pix) {
|
||||||
gtk_image_set_from_pixbuf(cover, pix);
|
gtk_image_set_from_pixbuf(cover, pix);
|
||||||
|
@ -63,10 +63,14 @@ static void __audio_get_cover(struct track *track)
|
||||||
|
|
||||||
void __audio_select_cover(GtkButton *button)
|
void __audio_select_cover(GtkButton *button)
|
||||||
{
|
{
|
||||||
|
struct track *track = audio_cur_track();
|
||||||
GtkFileFilter *filter;
|
GtkFileFilter *filter;
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
gchar *path;
|
gchar *path;
|
||||||
|
|
||||||
|
if (!track)
|
||||||
|
return;
|
||||||
|
|
||||||
filter = gtk_file_filter_new();
|
filter = gtk_file_filter_new();
|
||||||
dialog = gtk_file_chooser_dialog_new("Choose an image",
|
dialog = gtk_file_chooser_dialog_new("Choose an image",
|
||||||
GTK_WINDOW(gui_builder_widget("o_window")),
|
GTK_WINDOW(gui_builder_widget("o_window")),
|
||||||
|
@ -81,7 +85,8 @@ void __audio_select_cover(GtkButton *button)
|
||||||
|
|
||||||
if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
|
if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
|
||||||
path = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
|
path = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
|
||||||
album_artwork_import(audio_cur_track()->tr_album, path);
|
album_artwork_import(track->tr_album, path);
|
||||||
|
__audio_set_cover();
|
||||||
g_free(path);
|
g_free(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +107,7 @@ static void __audio_load(struct track *track)
|
||||||
playlist_has(PL_FAVORITED, track));
|
playlist_has(PL_FAVORITED, track));
|
||||||
|
|
||||||
gui_view_scroll();
|
gui_view_scroll();
|
||||||
__audio_get_cover(track);
|
__audio_set_cover();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __audio_change_state(GstState state)
|
static void __audio_change_state(GstState state)
|
||||||
|
@ -152,15 +157,14 @@ void __audio_hide(GtkToggleButton *toggle, gpointer data)
|
||||||
|
|
||||||
static int __audio_timeout(gpointer data)
|
static int __audio_timeout(gpointer data)
|
||||||
{
|
{
|
||||||
struct track *track = audio_cur_track();
|
|
||||||
GtkAdjustment *progress = data;
|
GtkAdjustment *progress = data;
|
||||||
|
|
||||||
gtk_adjustment_set_upper(progress, audio_duration() / GST_SECOND);
|
gtk_adjustment_set_upper(progress, audio_duration() / GST_SECOND);
|
||||||
gtk_adjustment_set_value(progress, audio_position() / GST_SECOND);
|
gtk_adjustment_set_value(progress, audio_position() / GST_SECOND);
|
||||||
__audio_set_time_label("o_position", audio_position() / GST_SECOND);
|
__audio_set_time_label("o_position", audio_position() / GST_SECOND);
|
||||||
|
|
||||||
if (track && !__audio_have_cover)
|
if (audio_cur_track() && !__audio_have_cover)
|
||||||
__audio_get_cover(track);
|
__audio_set_cover();
|
||||||
|
|
||||||
return G_SOURCE_CONTINUE;
|
return G_SOURCE_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue