summaryrefslogtreecommitdiff
path: root/plugins/gtkui
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/gtkui')
-rw-r--r--plugins/gtkui/Makefile.am4
-rw-r--r--plugins/gtkui/coverart.c57
-rw-r--r--plugins/gtkui/ddbcellrenderertextmultiline.c4
-rw-r--r--plugins/gtkui/ddbcellrenderertextmultiline.h2
-rw-r--r--plugins/gtkui/ddbequalizer.c2
-rw-r--r--plugins/gtkui/ddbequalizer.h2
-rw-r--r--plugins/gtkui/ddbseekbar.c4
-rw-r--r--plugins/gtkui/ddbseekbar.h2
8 files changed, 31 insertions, 46 deletions
diff --git a/plugins/gtkui/Makefile.am b/plugins/gtkui/Makefile.am
index 55557ad8..cea8e94dc 100644
--- a/plugins/gtkui/Makefile.am
+++ b/plugins/gtkui/Makefile.am
@@ -36,7 +36,7 @@ GTKUI_SOURCES = gtkui.c gtkui.h\
EXTRA_DIST = $(gtkui_VALASOURCES) deadbeef.glade
-if PORTABLE
+if STATICLINK
pkglib_LTLIBRARIES = gtkui.la gtkui.fallback.la
else
pkglib_LTLIBRARIES = gtkui.la
@@ -49,7 +49,7 @@ gtkui_la_LIBADD = $(LDADD) $(GTKUI_DEPS_LIBS)
gtkui_la_CFLAGS = -std=c99 $(GTKUI_DEPS_CFLAGS)
# fallback lib
-if PORTABLE
+if STATICLINK
GTK_ROOT=../../../deadbeef-deps/gtk-debian/usr
gtkui_fallback_la_SOURCES = $(gtkui_VALABUILTSOURCES) $(GTKUI_SOURCES)
diff --git a/plugins/gtkui/coverart.c b/plugins/gtkui/coverart.c
index ffd2c2b2..0a8865a1 100644
--- a/plugins/gtkui/coverart.c
+++ b/plugins/gtkui/coverart.c
@@ -21,6 +21,7 @@
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
+#include <sys/stat.h>
#include "coverart.h"
#include "../artwork/artwork.h"
#include "gtkui.h"
@@ -36,6 +37,7 @@ extern DB_artwork_plugin_t *coverart_plugin;
typedef struct {
struct timeval tm;
char *fname;
+ time_t filetime;
int width;
GdkPixbuf *pixbuf;
} cached_pixbuf_t;
@@ -138,7 +140,10 @@ loading_thread (void *none) {
usleep (500000);
continue;
}
-
+ struct stat stat_buf;
+ if (stat (queue->fname, &stat_buf) < 0) {
+ trace ("failed to stat file %s\n", queue->fname);
+ }
// GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file (queue->fname, NULL);
GError *error = NULL;
GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file_at_scale (queue->fname, queue->width, queue->width, TRUE, &error);
@@ -150,6 +155,9 @@ loading_thread (void *none) {
error = NULL;
}
const char *defpath = coverart_plugin->get_default_cover ();
+ if (stat (defpath, &stat_buf) < 0) {
+ trace ("failed to stat file %s\n", queue->fname);
+ }
pixbuf = gdk_pixbuf_new_from_file_at_scale (defpath, queue->width, queue->width, TRUE, &error);
if (!pixbuf) {
fprintf (stderr, "gdk_pixbuf_new_from_file_at_scale %s %d failed, error: %s\n", defpath, queue->width, error->message);
@@ -162,43 +170,16 @@ loading_thread (void *none) {
if (!pixbuf) {
// make default empty image
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, 2, 2);
+ stat_buf.st_mtime = 0;
}
-#if 0
- else {
- int w, h;
- w = gdk_pixbuf_get_width (pixbuf);
- h = gdk_pixbuf_get_height (pixbuf);
- int width = queue->width;
- if (w != width) {
- int height;
- if (w > h) {
- height = width * h / w;
- }
- else if (h > w) {
- height = width;
- width = height * w / h;
- }
- else {
- height = width;
- }
- if (width < 5 || height < 5) {
- trace ("will not scale to %dx%d\n", width, height);
- queue_pop ();
- continue;
- }
- trace ("scaling %dx%d -> %dx%d\n", w, h, width, height);
- GdkPixbuf *scaled = gdk_pixbuf_scale_simple (pixbuf, width, height, GDK_INTERP_BILINEAR);
- g_object_unref (pixbuf);
- pixbuf = scaled;
- }
- }
-#endif
if (cache_min != -1) {
deadbeef->mutex_lock (mutex);
+ cache[cache_min].filetime = stat_buf.st_mtime;
cache[cache_min].pixbuf = pixbuf;
cache[cache_min].fname = strdup (queue->fname);
gettimeofday (&cache[cache_min].tm, NULL);
cache[cache_min].width = queue->width;
+ struct stat stat_buf;
deadbeef->mutex_unlock (mutex);
}
queue_pop ();
@@ -230,11 +211,15 @@ get_pixbuf (const char *fname, int width) {
for (int i = 0; i < CACHE_SIZE; i++) {
if (cache[i].pixbuf) {
if (!strcmp (fname, cache[i].fname) && cache[i].width == width) {
- gettimeofday (&cache[i].tm, NULL);
- GdkPixbuf *pb = cache[i].pixbuf;
- g_object_ref (pb);
- deadbeef->mutex_unlock (mutex);
- return pb;
+ // check if cached filetime hasn't changed
+ struct stat stat_buf;
+ if (!stat (fname, &stat_buf) && stat_buf.st_mtime == cache[i].filetime) {
+ gettimeofday (&cache[i].tm, NULL);
+ GdkPixbuf *pb = cache[i].pixbuf;
+ g_object_ref (pb);
+ deadbeef->mutex_unlock (mutex);
+ return pb;
+ }
}
}
}
diff --git a/plugins/gtkui/ddbcellrenderertextmultiline.c b/plugins/gtkui/ddbcellrenderertextmultiline.c
index 867c70e4..335faf7c 100644
--- a/plugins/gtkui/ddbcellrenderertextmultiline.c
+++ b/plugins/gtkui/ddbcellrenderertextmultiline.c
@@ -1,4 +1,4 @@
-/* ddbcellrenderertextmultiline.c generated by valac 0.10.0, the Vala compiler
+/* ddbcellrenderertextmultiline.c generated by valac 0.10.1, the Vala compiler
* generated from ddbcellrenderertextmultiline.vala, do not modify */
/*
@@ -213,7 +213,7 @@ static void ddb_cell_renderer_text_multiline_gtk_cell_renderer_text_editing_done
buf = _g_object_ref0 (gtk_text_view_get_buffer ((GtkTextView*) entry));
gtk_text_buffer_get_iter_at_offset (buf, &begin, 0);
gtk_text_buffer_get_iter_at_offset (buf, &end, -1);
- new_text = g_strdup (gtk_text_buffer_get_text (buf, &begin, &end, TRUE));
+ new_text = gtk_text_buffer_get_text (buf, &begin, &end, TRUE);
g_signal_emit_by_name ((GtkCellRendererText*) _self_, "edited", entry->tree_path, new_text);
_g_free0 (new_text);
_g_object_unref0 (buf);
diff --git a/plugins/gtkui/ddbcellrenderertextmultiline.h b/plugins/gtkui/ddbcellrenderertextmultiline.h
index 787beb50..aec8fc09 100644
--- a/plugins/gtkui/ddbcellrenderertextmultiline.h
+++ b/plugins/gtkui/ddbcellrenderertextmultiline.h
@@ -1,4 +1,4 @@
-/* ddbcellrenderertextmultiline.h generated by valac 0.10.0, the Vala compiler, do not modify */
+/* ddbcellrenderertextmultiline.h generated by valac 0.10.1, the Vala compiler, do not modify */
#ifndef __DDBCELLRENDERERTEXTMULTILINE_H__
diff --git a/plugins/gtkui/ddbequalizer.c b/plugins/gtkui/ddbequalizer.c
index 201277ad..24c3a992 100644
--- a/plugins/gtkui/ddbequalizer.c
+++ b/plugins/gtkui/ddbequalizer.c
@@ -1,4 +1,4 @@
-/* ddbequalizer.c generated by valac 0.10.0, the Vala compiler
+/* ddbequalizer.c generated by valac 0.10.1, the Vala compiler
* generated from ddbequalizer.vala, do not modify */
/*
diff --git a/plugins/gtkui/ddbequalizer.h b/plugins/gtkui/ddbequalizer.h
index 19f98c23..8f957648 100644
--- a/plugins/gtkui/ddbequalizer.h
+++ b/plugins/gtkui/ddbequalizer.h
@@ -1,4 +1,4 @@
-/* ddbequalizer.h generated by valac 0.10.0, the Vala compiler, do not modify */
+/* ddbequalizer.h generated by valac 0.10.1, the Vala compiler, do not modify */
#ifndef __DDBEQUALIZER_H__
diff --git a/plugins/gtkui/ddbseekbar.c b/plugins/gtkui/ddbseekbar.c
index 407b347c..44aae86f 100644
--- a/plugins/gtkui/ddbseekbar.c
+++ b/plugins/gtkui/ddbseekbar.c
@@ -1,4 +1,4 @@
-/* ddbseekbar.c generated by valac 0.10.0, the Vala compiler
+/* ddbseekbar.c generated by valac 0.10.1, the Vala compiler
* generated from ddbseekbar.vala, do not modify */
/*
@@ -138,7 +138,7 @@ static gboolean ddb_seekbar_real_configure_event (GtkWidget* base, GdkEventConfi
DdbSeekbar* ddb_seekbar_construct (GType object_type) {
- DdbSeekbar * self;
+ DdbSeekbar * self = NULL;
self = (DdbSeekbar*) gtk_widget_new (object_type, NULL);
return self;
}
diff --git a/plugins/gtkui/ddbseekbar.h b/plugins/gtkui/ddbseekbar.h
index f501a00c..84cf6e88 100644
--- a/plugins/gtkui/ddbseekbar.h
+++ b/plugins/gtkui/ddbseekbar.h
@@ -1,4 +1,4 @@
-/* ddbseekbar.h generated by valac 0.10.0, the Vala compiler, do not modify */
+/* ddbseekbar.h generated by valac 0.10.1, the Vala compiler, do not modify */
#ifndef __DDBSEEKBAR_H__