]> Pileus Git - ~andy/gtk/blobdiff - demos/testpixbuf-scale.c
Fix optimization that was correct for the use here, but completely
[~andy/gtk] / demos / testpixbuf-scale.c
index a99977fbda35d4d98774be4a167716fb55ba60f5..68b57a5bca79652cfab8d5d0729f0eb20b82980e 100644 (file)
@@ -1,5 +1,4 @@
 #include <gtk/gtk.h>
-#include "gdk-pixbuf.h"
 
 #include <stdio.h>
 
@@ -52,6 +51,8 @@ expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
   return TRUE;
 }
 
+extern void pixbuf_init();
+
 int
 main(int argc, char **argv)
 {
@@ -61,6 +62,9 @@ main(int argc, char **argv)
        GtkWidget *hbox, *label, *hscale;
        GtkAdjustment *adjustment;
        GtkRequisition scratch_requisition;
+        GError *error;
+        
+       pixbuf_init ();
 
        gtk_init (&argc, &argv);
        gdk_rgb_init ();
@@ -70,9 +74,12 @@ main(int argc, char **argv)
                exit (1);
        }
 
-       pixbuf = gdk_pixbuf_new_from_file (argv[1]);
+        error = NULL;
+       pixbuf = gdk_pixbuf_new_from_file (argv[1], &error);
        if (!pixbuf) {
-               fprintf (stderr, "Cannot load %s\n", argv[1]);
+               fprintf (stderr, "Cannot load image: %s\n",
+                         error->message);
+                g_error_free (error);
                exit(1);
        }