summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-03-13 18:46:36 +0100
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2010-03-13 18:46:36 +0100
commit8c96fe77fdd34ee8b94f2cf60cd29db3c6c3d60f (patch)
tree3b61e08dd862127abfaf5e861a4a5a1fdae48857 /plugins
parent3438d32384da18fa4b1ebaa397efabfcb981c0f7 (diff)
few fixes/improvements to artwork loading;
fix tabstrip widget drawing when dragging tabs
Diffstat (limited to 'plugins')
-rw-r--r--plugins/artwork/artwork.c32
-rw-r--r--plugins/artwork/artwork.h3
-rw-r--r--plugins/gtkui/coverart.c7
-rw-r--r--plugins/gtkui/coverart.h2
-rw-r--r--plugins/gtkui/ddbtabstrip.c2
-rw-r--r--plugins/gtkui/mainplaylist.c3
6 files changed, 34 insertions, 15 deletions
diff --git a/plugins/artwork/artwork.c b/plugins/artwork/artwork.c
index 47e43d69..15c56dd8 100644
--- a/plugins/artwork/artwork.c
+++ b/plugins/artwork/artwork.c
@@ -397,15 +397,29 @@ artwork_load (DB_functions_t *api) {
}
void
-artwork_reset (void) {
- trace ("artwork: reset\n");
- clear_queue = 1;
- deadbeef->mutex_lock (mutex);
- deadbeef->mutex_unlock (mutex);
- deadbeef->cond_signal (cond);
- trace ("artwork: waiting for clear to complete\n");
- while (clear_queue) {
- usleep (100000);
+artwork_reset (int fast) {
+ if (fast) {
+ deadbeef->mutex_lock (mutex);
+ while (queue && queue->next) {
+ cover_query_t *next = queue->next->next;
+ free (queue->next->fname);
+ free (queue->next->artist);
+ free (queue->next->album);
+ queue->next = next;
+ if (next == NULL) {
+ queue_tail = queue;
+ }
+ }
+ deadbeef->mutex_unlock (mutex);
+ }
+ else {
+ trace ("artwork: reset\n");
+ clear_queue = 1;
+ deadbeef->cond_signal (cond);
+ trace ("artwork: waiting for clear to complete\n");
+ while (clear_queue) {
+ usleep (100000);
+ }
}
}
diff --git a/plugins/artwork/artwork.h b/plugins/artwork/artwork.h
index 247a820a..35b29fb1 100644
--- a/plugins/artwork/artwork.h
+++ b/plugins/artwork/artwork.h
@@ -19,7 +19,8 @@ typedef struct {
// returns filename of cached image, or NULL
char* (*get_album_art) (const char *fname, const char *artist, const char *album, artwork_callback callback, void *user_data);
// this has to be called to clear queue on exit, before caller terminates
- void (*reset) (void);
+ // `fast=1' means "don't wait, just flush queue"
+ void (*reset) (int fast);
} DB_artwork_plugin_t;
#endif /*__ARTWORK_H*/
diff --git a/plugins/gtkui/coverart.c b/plugins/gtkui/coverart.c
index 3d9ba76b..27b2a5af 100644
--- a/plugins/gtkui/coverart.c
+++ b/plugins/gtkui/coverart.c
@@ -248,7 +248,7 @@ get_cover_art (const char *fname, const char *artist, const char *album, int wid
}
void
-reset_cover_art_cache (void) {
+coverart_reset_queue (void) {
deadbeef->mutex_lock (mutex);
if (queue) {
load_query_t *q = queue->next;
@@ -264,6 +264,9 @@ reset_cover_art_cache (void) {
tail = queue;
}
deadbeef->mutex_unlock (mutex);
+ if (coverart_plugin) {
+ coverart_plugin->reset (1);
+ }
}
void
@@ -280,7 +283,7 @@ cover_art_free (void) {
if (coverart_plugin) {
trace ("resetting artwork plugin...\n");
- coverart_plugin->reset ();
+ coverart_plugin->reset (0);
}
if (tid) {
diff --git a/plugins/gtkui/coverart.h b/plugins/gtkui/coverart.h
index 3f3db904..75a96429 100644
--- a/plugins/gtkui/coverart.h
+++ b/plugins/gtkui/coverart.h
@@ -33,7 +33,7 @@ GdkPixbuf *
get_cover_art (const char *fname, const char *artist, const char *album, int width);
void
-reset_cover_art_cache (void);
+coverart_reset_queue (void);
void
cover_art_init (void);
diff --git a/plugins/gtkui/ddbtabstrip.c b/plugins/gtkui/ddbtabstrip.c
index 7ce03c8f..ec279d1c 100644
--- a/plugins/gtkui/ddbtabstrip.c
+++ b/plugins/gtkui/ddbtabstrip.c
@@ -310,7 +310,7 @@ tabstrip_draw (GtkWidget *widget) {
need_draw_moving = 1;
}
if (need_draw_moving) {
- x = -ts->hscrollpos;
+ x = -ts->hscrollpos + tabs_left_margin;
for (idx = 0; idx < 10; idx++) {
w = widths[idx];
if (idx == ts->dragging) {
diff --git a/plugins/gtkui/mainplaylist.c b/plugins/gtkui/mainplaylist.c
index 4b2b4b38..87d0276d 100644
--- a/plugins/gtkui/mainplaylist.c
+++ b/plugins/gtkui/mainplaylist.c
@@ -192,7 +192,7 @@ main_column_size_changed (DdbListview *listview, int col) {
return;
}
if (inf->id == DB_COLUMN_ALBUM_ART) {
- reset_cover_art_cache ();
+ coverart_reset_queue ();
}
}
@@ -204,6 +204,7 @@ void main_col_free_user_data (void *data) {
void
main_vscroll_changed (int pos) {
+ coverart_reset_queue ();
int curr = deadbeef->plt_get_curr ();
char conf[100];
snprintf (conf, sizeof (conf), "playlist.scroll.%d", curr);