]> www.fi.muni.cz Git - evince.git/blobdiff - thumbnailer/evince-thumbnailer.c
[libdocument] Do not require GAppInfo to support uris when opening an attachment
[evince.git] / thumbnailer / evince-thumbnailer.c
index da0f5d45ed0ae9bfc6bf844922d00e2a3915e3ea..31486bf63be08af0cd20be49dde04139fcce093f 100644 (file)
 #include <stdlib.h>
 #include <string.h>
 
+#ifdef G_OS_WIN32
+#ifdef DATADIR
+#undef DATADIR
+#endif
+#include <io.h>
+#include <conio.h>
+#define _WIN32_WINNT 0x0500
+#include <windows.h>
+#endif
+
 #define THUMBNAIL_SIZE 128
 
 static gint size = THUMBNAIL_SIZE;
@@ -74,7 +84,7 @@ evince_thumbnail_pngenc_get (EvDocument *document, const char *thumbnail, int si
 
        page = ev_document_get_page (document, 0);
        
-       ev_document_get_page_size (document, page, &width, &height);
+       ev_document_get_page_size (document, 0, &width, &height);
 
        rc = ev_render_context_new (page, 0, size / width);
        pixbuf = ev_document_thumbnails_get_thumbnail (EV_DOCUMENT_THUMBNAILS (document),
@@ -88,7 +98,13 @@ evince_thumbnail_pngenc_get (EvDocument *document, const char *thumbnail, int si
                if (overlaid_icon_name) {
                        GdkPixbuf *overlaid_pixbuf;
 
+#ifdef G_OS_WIN32
+                       gchar *dir = g_win32_get_package_installation_directory_of_module (NULL);
+                       gchar *overlaid_icon_path = g_build_filename (dir, "share", "evince", overlaid_icon_name, NULL);
+                       g_free (dir);
+#else
                        gchar *overlaid_icon_path = g_strdup_printf ("%s/%s", DATADIR, overlaid_icon_name);
+#endif
                        overlaid_pixbuf = gdk_pixbuf_new_from_file (overlaid_icon_path, NULL);
                        g_free (overlaid_icon_path);
                        if (overlaid_pixbuf != NULL) {
@@ -180,8 +196,8 @@ main (int argc, char *argv[])
        
        g_option_context_free (context);
 
-       if (size < 40) {
-               g_print ("Size cannot be smaller than 40 pixels\n");
+       if (size < 1) {
+               g_print ("Size cannot be smaller than 1 pixel\n");
                return -1;
        }