#include <config.h>
#include <evince-document.h>
#include <gio/gio.h>
#include <locale.h>
#include <stdlib.h>
#include <string.h>
Go to the source code of this file.
#define DEFAULT_SLEEP_TIME (15 * G_USEC_PER_SEC) /* 15 seconds */ |
#define THUMBNAIL_SIZE 128 |
static void delete_temp_file |
( |
GFile * |
file) | |
|
|
static |
static gboolean evince_thumbnail_pngenc_get |
( |
EvDocument * |
document, |
|
|
const char * |
thumbnail, |
|
|
int |
size |
|
) |
| |
|
static |
Definition at line 198 of file evince-thumbnailer.c.
201 double width, height;
212 g_object_unref (page);
214 if (pixbuf != NULL) {
215 if (gdk_pixbuf_save (pixbuf, thumbnail,
"png", NULL, NULL)) {
216 g_object_unref (pixbuf);
220 g_object_unref (pixbuf);
static gpointer evince_thumbnail_pngenc_get_async |
( |
struct AsyncData * |
data) | |
|
|
static |
static EvDocument* evince_thumbnailer_get_document |
( |
GFile * |
file) | |
|
|
static |
Definition at line 130 of file evince-thumbnailer.c.
134 GFile *tmp_file = NULL;
135 GError *error = NULL;
140 gchar *base_name, *
template;
142 base_name = g_file_get_basename (file);
143 template = g_strdup_printf (
"document.XXXXXX-%s", base_name);
149 g_printerr (
"Error loading remote document: %s\n", error->message);
150 g_error_free (error);
155 g_file_copy (file, tmp_file, G_FILE_COPY_OVERWRITE,
156 NULL, NULL, NULL, &error);
158 g_printerr (
"Error loading remote document: %s\n", error->message);
159 g_error_free (error);
160 g_object_unref (tmp_file);
164 uri = g_file_get_uri (tmp_file);
166 uri = g_filename_to_uri (path, NULL, NULL);
173 g_object_weak_ref (G_OBJECT (document),
178 g_object_unref (tmp_file);
186 g_error_free (error);
189 g_printerr (
"Error loading document: %s\n", error->message);
190 g_error_free (error);
static char* get_local_path |
( |
GFile * |
file) | |
|
|
static |
Definition at line 120 of file evince-thumbnailer.c.
122 if (g_file_has_uri_scheme (file,
"trash") !=
FALSE ||
123 g_file_has_uri_scheme (file,
"recent") !=
FALSE) {
126 return g_file_get_path (file);
static char* get_target_uri |
( |
GFile * |
file) | |
|
|
static |
Definition at line 105 of file evince-thumbnailer.c.
110 info = g_file_query_info (file, G_FILE_ATTRIBUTE_STANDARD_TARGET_URI, G_FILE_QUERY_INFO_NONE, NULL, NULL);
113 target = g_strdup (g_file_info_get_attribute_string (info, G_FILE_ATTRIBUTE_STANDARD_TARGET_URI));
114 g_object_unref (info);
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 251 of file evince-thumbnailer.c.
254 GOptionContext *context;
258 GError *error = NULL;
260 setlocale (LC_ALL,
"");
262 context = g_option_context_new (
"- GNOME Document Thumbnailer");
265 if (!g_option_context_parse (context, &argc, &argv, &error)) {
266 g_printerr (
"%s\n", error->message);
267 g_error_free (error);
269 g_option_context_free (context);
276 if (!input || !output) {
278 g_option_context_free (context);
283 g_option_context_free (context);
286 g_printerr (
"Size cannot be smaller than 1 pixel\n");
296 file = g_file_new_for_commandline_arg (input);
298 g_object_unref (file);
311 gtk_init (&argc, &argv);
317 g_thread_new (
"ThmbnlrAsyncRndr",
323 g_object_unref (document);
326 return data.success ? 0 : -2;
330 g_object_unref (document);
336 g_object_unref (document);
static void print_usage |
( |
GOptionContext * |
context) | |
|
|
static |
Definition at line 241 of file evince-thumbnailer.c.
245 help = g_option_context_get_help (context,
TRUE, NULL);
246 g_print (
"%s", help);
static G_GNUC_NORETURN gpointer time_monitor |
( |
gpointer |
data) | |
|
|
static |
Definition at line 63 of file evince-thumbnailer.c.
65 const gchar *app_name;
72 app_name = g_get_application_name ();
74 app_name = g_get_prgname ();
75 g_printerr (
"%s couldn't process file: '%s'\n"
76 "Reason: Took too much time to process.\n",
static void time_monitor_start |
( |
const char * |
input) | |
|
|
static |
static void time_monitor_stop |
( |
void |
) | |
|
|
static |
const gchar** file_arguments |
|
static |
const GOptionEntry goption_options[] |
|
static |
Initial value:= {
{
"size",
's', 0, G_OPTION_ARG_INT, &
size, NULL,
"SIZE" },
{
"no-limit",
'l', G_OPTION_FLAG_REVERSE, G_OPTION_ARG_NONE, &
time_limit,
"Don't limit the thumbnailing time to 15 seconds", NULL },
{ G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &
file_arguments, NULL,
"<input> <ouput>" },
{ NULL }
}
Definition at line 47 of file evince-thumbnailer.c.
gboolean time_limit = TRUE |
|
static |