Professional Documents
Culture Documents
Gnome Thumbnailer Skeleton
Gnome Thumbnailer Skeleton
#include <string.h>
#include <glib.h>
#include <gio/gio.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include "gnome-thumbnailer-skeleton.h"
#ifndef THUMBNAILER_USAGE
#error "THUMBNAILER_USAGE must be set"
#endif
#ifdef THUMBNAILER_RETURNS_PIXBUF
/* Nothing */
#elif THUMBNAILER_RETURNS_DATA
char *data = NULL;
gsize length;
#endif
g_type_init ();
/* Options parsing */
context = g_option_context_new (THUMBNAILER_USAGE);
g_option_context_add_main_entries (context, entries, NULL);
output = filenames[1];
#ifdef THUMBNAILER_RETURNS_PIXBUF
pixbuf = file_to_pixbuf (input_filename, &error);
#elif THUMBNAILER_RETURNS_DATA
data = file_to_data (input_filename, &length, &error);
if (data) {
GInputStream *mem_stream;
if (!pixbuf) {
g_warning ("Could not thumbnail '%s': %s", filenames[0], error-
>message);
g_error_free (error);
g_strfreev (filenames);
return 1;
}
g_object_unref (pixbuf);
return 0;
}