aboutsummaryrefslogtreecommitdiff
path: root/src/imagestore.c
diff options
context:
space:
mode:
authorThomas White <taw@bitwiz.org.uk>2013-08-27 23:00:18 +0200
committerThomas White <taw@bitwiz.org.uk>2013-08-27 23:00:18 +0200
commit326ca976b24850ed887f967b521bafac77d9223a (patch)
tree6a188f48621497aee39c6f6cf08af8f14e0bff3f /src/imagestore.c
parent3f9b053d662ec26564765b7984443a52b609163b (diff)
Try a global "image repository" folder
Diffstat (limited to 'src/imagestore.c')
-rw-r--r--src/imagestore.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/src/imagestore.c b/src/imagestore.c
index 7712e65..a6da607 100644
--- a/src/imagestore.c
+++ b/src/imagestore.c
@@ -120,22 +120,34 @@ static GdkPixbuf *try_all_locations(const char *filename, int w, ImageStore *is)
GError *error = NULL;
GdkPixbuf *t;
char *tmp;
+ const char *image_folder = "/home/taw/Documents/Slides"; /* FIXME ! */
/* Try the filename as is */
t = gdk_pixbuf_new_from_file_at_size(filename, w, -1, &error);
if ( t != NULL ) return t;
- if ( is->dname == NULL ) return NULL;
+ /* Try the file prefixed with the directory the presentation is in */
+ if ( is->dname != NULL ) {
- /* Try the file prefixed with the directory the presentation
- * is in */
+ error = NULL;
+ tmp = malloc(strlen(filename) + strlen(is->dname) + 2);
+ if ( tmp == NULL ) return NULL;
+ strcpy(tmp, is->dname);
+ strcat(tmp, "/");
+ strcat(tmp, filename);
+ t = gdk_pixbuf_new_from_file_at_size(tmp, w, -1, &error);
+ free(tmp);
+ if ( t != NULL ) return t;
+
+ }
+
+ /* Try prefixed with image pathname */
error = NULL;
- tmp = malloc(strlen(filename) + strlen(is->dname) + 2);
+ tmp = malloc(strlen(filename) + strlen(image_folder) + 2);
if ( tmp == NULL ) return NULL;
- strcpy(tmp, is->dname);
+ strcpy(tmp, image_folder);
strcat(tmp, "/");
strcat(tmp, filename);
- printf("Trying '%s'\n", tmp);
t = gdk_pixbuf_new_from_file_at_size(tmp, w, -1, &error);
free(tmp);
if ( t != NULL ) return t;