X-Git-Url: https://git.street.me.uk/andy/viking.git/blobdiff_plain/90e25247d8aaecef70a0bb6d6717867a7d0462e2..de2fc9aa9e8db8e0258c8328161c6b5eda176a0a:/src/thumbnails.c diff --git a/src/thumbnails.c b/src/thumbnails.c index 5b06f625..5a7b2a1e 100644 --- a/src/thumbnails.c +++ b/src/thumbnails.c @@ -26,13 +26,21 @@ * */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include -#include +#ifdef HAVE_UNISTD_H +#include +#endif #include #include +#include +#include #include "viking.h" #include "thumbnails.h" -#include "thumbnails_pixbuf.h" +#include "icons/icons.h" #ifdef __CYGWIN__ #ifdef __CYGWIN_USE_BIG_TYPES__ @@ -53,21 +61,24 @@ #define MAX(a,b) (((a)>(b))?(a):(b)) #endif +#define HOME_DIR g_get_home_dir() + #ifdef WINDOWS -#define HOME_DIR "C:\\VIKING" #define THUMB_DIR "\\THUMBNAILS\\" /* viking maps default viking\maps */ #define THUMB_SUB_DIR "normal\\" -#define mkdir(a,b) mkdir(a) #define realpath(X,Y) _fullpath(Y,X,MAX_PATH) #else -#define HOME_DIR g_get_home_dir() #define THUMB_DIR "/.thumbnails/" #define THUMB_SUB_DIR "normal/" #endif #define PIXMAP_THUMB_SIZE 128 +#ifndef MAXPATHLEN +#define MAXPATHLEN 1024 +#endif + static char *md5_hash(const char *message); static char *pathdup(const char *path); static GdkPixbuf *save_thumbnail(const char *pathname, GdkPixbuf *full); @@ -86,7 +97,7 @@ gboolean a_thumbnails_exists ( const gchar *filename ) GdkPixbuf *a_thumbnails_get_default () { - return gdk_pixbuf_from_pixdata ( &tnnyl_pixbuf, FALSE, NULL ); + return gdk_pixbuf_from_pixdata ( &thumbnails_pixbuf, FALSE, NULL ); } /* filename must be absolute. you could have a function to make sure it exists and absolutize it */ @@ -176,13 +187,9 @@ static GdkPixbuf *save_thumbnail(const char *pathname, GdkPixbuf *full) g_free(path); to = g_string_new(HOME_DIR); -#ifndef WINDOWS - mkdir(to->str, 0700); -#endif g_string_append(to, THUMB_DIR); - mkdir(to->str, 0700); g_string_append(to, THUMB_SUB_DIR); - mkdir(to->str, 0700); + g_mkdir_with_parents(to->str, 0700); g_string_append(to, md5); name_len = to->len + 4; /* Truncate to this length when renaming */ #ifdef WINDOWS