*/
#include "config.h"
-#include "../gtk/gtkcompat.h" /* versioning */
+#define __GTK_H_INSIDE__
+#include "../gtk/gtkversion.h" /* versioning */
+#undef __GTK_H_INSIDE__
#include "gdk-pixbuf.h"
#include "gdk-pixdata.h"
-#include <stdio.h>
+#include <glib/gprintf.h>
+#include <stdlib.h>
#include <string.h>
/* --- defines --- */
#undef G_LOG_DOMAIN
#define G_LOG_DOMAIN "Gdk-Pixbuf-CSource"
-#define PRG_NAME "gdk-pixbuf-csource"
-#define PKG_NAME "Gtk+"
+#define PRG_NAME "gdk-pixbuf-csource-3.0"
+#define PKG_NAME "GTK+"
#define PKG_HTTP_HOME "http://www.gtk.org"
gen_type | gen_ctype |
(with_decoder ? GDK_PIXDATA_DUMP_RLE_DECODER : 0));
- fprintf (f_out, "%s\n", gstring->str);
+ g_fprintf (f_out, "%s\n", gstring->str);
g_free (free_me);
}
{
GdkPixbuf *pixbuf;
GError *error = NULL;
+ gchar *infilename;
/* initialize glib/GdkPixbuf */
- g_type_init (0);
+ g_type_init ();
/* parse args and do fast exits */
parse_args (&argc, &argv);
return 1;
}
- pixbuf = gdk_pixbuf_new_from_file (argv[1], &error);
+#ifdef G_OS_WIN32
+ infilename = g_locale_to_utf8 (argv[1], -1, NULL, NULL, NULL);
+#else
+ infilename = argv[1];
+#endif
+
+ pixbuf = gdk_pixbuf_new_from_file (infilename, &error);
if (!pixbuf)
{
- fprintf (stderr, "failed to load \"%s\": %s\n",
+ g_fprintf (stderr, "failed to load \"%s\": %s\n",
argv[1],
error->message);
g_error_free (error);
}
print_csource (stdout, pixbuf);
- gdk_pixbuf_unref (pixbuf);
+ g_object_unref (pixbuf);
}
else /* parse name, file pairs */
{
while (j--)
{
+#ifdef G_OS_WIN32
+ infilename = g_locale_to_utf8 (*p, -1, NULL, NULL, NULL);
+#else
+ infilename = *p;
+#endif
+
if (!toggle)
- image_name = *p++;
+ {
+ image_name = infilename;
+ p++;
+ }
else
{
- pixbuf = gdk_pixbuf_new_from_file (*p, &error);
+ pixbuf = gdk_pixbuf_new_from_file (infilename, &error);
if (!pixbuf)
{
- fprintf (stderr, "failed to load \"%s\": %s\n",
+ g_fprintf (stderr, "failed to load \"%s\": %s\n",
*p,
error->message);
g_error_free (error);
return 1;
}
print_csource (stdout, pixbuf);
- gdk_pixbuf_unref (pixbuf);
+ g_object_unref (pixbuf);
p++;
}
toggle = !toggle;
{
if (!print_help)
{
- fprintf (bout, "%s version ", PRG_NAME);
- fprintf (bout, "%u.%u.%u", GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
- fprintf (bout, "\n");
- fprintf (bout, "%s comes with ABSOLUTELY NO WARRANTY.\n", PRG_NAME);
- fprintf (bout, "You may redistribute copies of %s under the terms of\n", PRG_NAME);
- fprintf (bout, "the GNU Lesser General Public License which can be found in the\n");
- fprintf (bout, "%s source package. Sources, examples and contact\n", PKG_NAME);
- fprintf (bout, "information are available at %s\n", PKG_HTTP_HOME);
+ g_fprintf (bout, "%s version ", PRG_NAME);
+ g_fprintf (bout, "%d.%d.%d", GTK_MAJOR_VERSION, GTK_MINOR_VERSION, GTK_MICRO_VERSION);
+ g_fprintf (bout, "\n");
+ g_fprintf (bout, "%s comes with ABSOLUTELY NO WARRANTY.\n", PRG_NAME);
+ g_fprintf (bout, "You may redistribute copies of %s under the terms of\n", PRG_NAME);
+ g_fprintf (bout, "the GNU Lesser General Public License which can be found in the\n");
+ g_fprintf (bout, "%s source package. Sources, examples and contact\n", PKG_NAME);
+ g_fprintf (bout, "information are available at %s\n", PKG_HTTP_HOME);
}
else
{
- fprintf (bout, "Usage: %s [options] [image]\n", PRG_NAME);
- fprintf (bout, " %s [options] --build-list [[name image]...]\n", PRG_NAME);
- fprintf (bout, " --stream generate pixbuf data stream\n");
- fprintf (bout, " --struct generate GdkPixdata structure\n");
- fprintf (bout, " --macros generate image size/pixel macros\n");
- fprintf (bout, " --rle use one byte run-length-encoding\n");
- fprintf (bout, " --raw provide raw image data copy\n");
- fprintf (bout, " --extern generate extern symbols\n");
- fprintf (bout, " --static generate static symbols\n");
- fprintf (bout, " --decoder provide rle decoder\n");
- fprintf (bout, " --name=identifier C macro/variable name\n");
- fprintf (bout, " --build-list parse (name, image) pairs\n");
- fprintf (bout, " -h, --help show this help message\n");
- fprintf (bout, " -v, --version print version informations\n");
- fprintf (bout, " --g-fatal-warnings make warnings fatal (abort)\n");
+ g_fprintf (bout, "Usage: %s [options] [image]\n", PRG_NAME);
+ g_fprintf (bout, " %s [options] --build-list [[name image]...]\n", PRG_NAME);
+ g_fprintf (bout, " --stream generate pixbuf data stream\n");
+ g_fprintf (bout, " --struct generate GdkPixdata structure\n");
+ g_fprintf (bout, " --macros generate image size/pixel macros\n");
+ g_fprintf (bout, " --rle use one byte run-length-encoding\n");
+ g_fprintf (bout, " --raw provide raw image data copy\n");
+ g_fprintf (bout, " --extern generate extern symbols\n");
+ g_fprintf (bout, " --static generate static symbols\n");
+ g_fprintf (bout, " --decoder provide rle decoder\n");
+ g_fprintf (bout, " --name=identifier C macro/variable name\n");
+ g_fprintf (bout, " --build-list parse (name, image) pairs\n");
+ g_fprintf (bout, " -h, --help show this help message\n");
+ g_fprintf (bout, " -v, --version print version informations\n");
+ g_fprintf (bout, " --g-fatal-warnings make warnings fatal (abort)\n");
}
}
-#include "x"