gnome-nds-thumbnailer r10 - trunk



Author: hadess
Date: Thu May  1 15:23:15 2008
New Revision: 10
URL: http://svn.gnome.org/viewvc/gnome-nds-thumbnailer?rev=10&view=rev

Log:
2008-05-01  Bastien Nocera  <hadess hadess net>

	* Makefile.am:
	* configure.ac:
	* gnome-nds-thumbnailer.c (main): Use GVFS' FUSE
	support to support remote NDS files



Modified:
   trunk/ChangeLog
   trunk/Makefile.am
   trunk/configure.ac
   trunk/gnome-nds-thumbnailer.c

Modified: trunk/Makefile.am
==============================================================================
--- trunk/Makefile.am	(original)
+++ trunk/Makefile.am	Thu May  1 15:23:15 2008
@@ -3,9 +3,9 @@
 
 gnome_nds_thumbnailer_SOURCES = gnome-nds-thumbnailer.c
 
-gnome_nds_thumbnailer_CPPFLAGS = $(GDK_PIXBUF_CFLAGS)
+gnome_nds_thumbnailer_CPPFLAGS = $(GDK_PIXBUF_CFLAGS) $(GIO_CFLAGS)
 
-gnome_nds_thumbnailer_LDADD = $(GDK_PIXBUF_LIBS)
+gnome_nds_thumbnailer_LDADD = $(GDK_PIXBUF_LIBS) $(GIO_LIBS)
 
 
 schemasdir = $(GCONF_SCHEMA_FILE_DIR)

Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac	(original)
+++ trunk/configure.ac	Thu May  1 15:23:15 2008
@@ -13,6 +13,8 @@
 AC_SUBST(GDK_PIXBUF_CFLAGS)
 AC_SUBST(GDK_PIXBUF_LIBS)
 
+PKG_CHECK_MODULES(GIO, gio-2.0, [], [AC_MSG_FAILURE([You need glib 2.16 or newer installed])])
+
 AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
 
 if test x$GCONFTOOL = "xno"; then

Modified: trunk/gnome-nds-thumbnailer.c
==============================================================================
--- trunk/gnome-nds-thumbnailer.c	(original)
+++ trunk/gnome-nds-thumbnailer.c	Thu May  1 15:23:15 2008
@@ -22,6 +22,7 @@
 
 #include <string.h>
 #include <glib.h>
+#include <gio/gio.h>
 #include <gdk-pixbuf/gdk-pixbuf.h>
 
 /* From specs at http://www.bottledlight.com/ds/index.php/FileFormats/NDSFormat
@@ -123,7 +124,8 @@
 	GdkPixbuf *pixbuf, *scaled;
 	GError *error = NULL;
 	GOptionContext *context;
-	char *input, *output;
+	const char *output;
+	char *input;
 
 	/* Options parsing */
 	context = g_option_context_new ("Thumbnail Nintendo DS ROMs");
@@ -149,12 +151,26 @@
 		g_print ("Expects an input and an output file\n");
 		return 1;
 	}
-	input = filenames[0];
+
+	{
+		GFile *file;
+
+		file = g_file_new_for_commandline_arg (filenames[0]);
+		input = g_file_get_path (file);
+		g_object_unref (file);
+	}
+
+	if (input == NULL) {
+		g_print ("Only local files are supported\n");
+		return 1;
+	}
+
 	output = filenames[1];
 
 	map = g_mapped_file_new (input, FALSE, &error);
 	if (!map) {
 		g_warning ("Couldn't map %s: %s", input, error->message);
+		g_free (input);
 		g_error_free (error);
 		return 1;
 	}
@@ -169,6 +185,7 @@
 	/* Check the version is version 1 */
 	if (base[offset] != 0x1 || base[offset + 1] != 0x0) {
 		g_warning ("Unsupported icon version, probably not an NDS file");
+		g_free (input);
 		return 1;
 	}
 
@@ -187,10 +204,12 @@
 	g_object_unref (pixbuf);
 	if (gdk_pixbuf_save (scaled, output, "png", &error, NULL) == FALSE) {
 		g_warning ("Couldn't save the thumbnail '%s' for file '%s': %s", output, input, error->message);
+		g_free (input);
 		g_error_free (error);
 		return 1;
 	}
 
+	g_free (input);
 	g_object_unref (scaled);
 
 	return 0;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]