]> git.street.me.uk Git - andy/viking.git/blobdiff - src/thumbnails.c
Add a startup option to load a default map (as defined by layer default for the map...
[andy/viking.git] / src / thumbnails.c
index 0461114b65554655f631eb1b75c0e42d20e4c670..bd97f312ce167b67d1bb2f8ba1f7337a6a3ece6b 100644 (file)
@@ -55,7 +55,6 @@
 
 #undef MIN /* quit yer whining, gcc */
 #undef MAX
-#include <sys/param.h> /* for realpath() */
 #ifndef MAX
 /* We need MAX macro and some system does not offer it */
 #define MAX(a,b) (((a)>(b))?(a):(b))
@@ -66,8 +65,6 @@
 #ifdef WINDOWS
 #define THUMB_DIR "\\THUMBNAILS\\" /* viking maps default viking\maps */
 #define THUMB_SUB_DIR "normal\\"
-#define realpath(X,Y) _fullpath(Y,X,MAX_PATH)
-
 #else
 #define THUMB_DIR "/.thumbnails/"
 #define THUMB_SUB_DIR "normal/"
@@ -122,7 +119,7 @@ GdkPixbuf *a_thumbnails_scale_pixbuf(GdkPixbuf *src, int max_w, int max_h)
 
        if (w <= max_w && h <= max_h)
        {
-               gdk_pixbuf_ref(src);
+               g_object_ref ( G_OBJECT ( src ) );
                return src;
        }
        else
@@ -145,6 +142,9 @@ static GdkPixbuf *child_create_thumbnail(const gchar *path)
        GdkPixbuf *image, *tmpbuf;
 
        image = gdk_pixbuf_new_from_file(path, NULL);
+       if (!image)
+         return NULL;
+
        tmpbuf = gdk_pixbuf_apply_embedded_orientation(image);
        g_object_unref(G_OBJECT(image));
        image = tmpbuf;
@@ -152,7 +152,7 @@ static GdkPixbuf *child_create_thumbnail(const gchar *path)
        if (image)
         {
                GdkPixbuf *thumb = save_thumbnail(path, image);
-               gdk_pixbuf_unref ( image );
+               g_object_unref ( G_OBJECT ( image ) );
                return thumb;
        }
 
@@ -286,7 +286,7 @@ GdkPixbuf *a_thumbnails_get(const gchar *pathname)
        goto out;
 err:
        if (thumb)
-               gdk_pixbuf_unref(thumb);
+               g_object_unref ( G_OBJECT ( thumb ) );
        thumb = NULL;
 out:
        g_free(path);
@@ -302,7 +302,7 @@ static char *pathdup(const char *path)
 
        g_return_val_if_fail(path != NULL, NULL);
 
-       if (realpath(path, real))
+       if (file_realpath(path, real))
                return g_strdup(real);
 
        return g_strdup(path);