Evince
Evince is a document viewer capable of displaying multiple and single page document formats like PDF and Postscript.
|
#include <config.h>
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <glib.h>
#include <glib/gstdio.h>
#include <glib/gi18n-lib.h>
#include "ev-file-helpers.h"
Go to the source code of this file.
Macros | |
#define | N_ARGS 4 |
#define | BUFFER_SIZE 1024 |
Functions | |
static gboolean | _ev_dir_ensure_exists (const gchar *dir, int mode, GError **error) |
static const char * | _ev_tmp_dir (GError **error) |
void | _ev_file_helpers_init (void) |
void | _ev_file_helpers_shutdown (void) |
int | ev_mkstemp (const char *tmpl, char **file_name, GError **error) |
static void | close_fd_cb (gpointer fdptr) |
GFile * | ev_mkstemp_file (const char *tmpl, GError **error) |
static gchar * | _ev_g_mkdtemp (gchar *tmpl) |
gchar * | ev_mkdtemp (const char *tmpl, GError **error) |
void | ev_tmp_filename_unlink (const gchar *filename) |
void | ev_tmp_file_unlink (GFile *file) |
void | ev_tmp_uri_unlink (const gchar *uri) |
gboolean | ev_file_is_temp (GFile *file) |
gboolean | ev_xfer_uri_simple (const char *from, const char *to, GError **error) |
gboolean | ev_file_copy_metadata (const char *from, const char *to, GError **error) |
static gchar * | get_mime_type_from_uri (const gchar *uri, GError **error) |
static gchar * | get_mime_type_from_data (const gchar *uri, GError **error) |
gchar * | ev_file_get_mime_type (const gchar *uri, gboolean fast, GError **error) |
static gchar * | compression_run (const gchar *uri, EvCompressionType type, gboolean compress, GError **error) |
gchar * | ev_file_uncompress (const gchar *uri, EvCompressionType type, GError **error) |
gchar * | ev_file_compress (const gchar *uri, EvCompressionType type, GError **error) |
Variables | |
static gchar * | tmp_dir = NULL |
static const char * | compressor_cmds [] |
#define BUFFER_SIZE 1024 |
Definition at line 590 of file ev-file-helpers.c.
#define N_ARGS 4 |
Definition at line 589 of file ev-file-helpers.c.
|
static |
void _ev_file_helpers_init | ( | void | ) |
void _ev_file_helpers_shutdown | ( | void | ) |
|
static |
g_mkdtemp: : template directory name
Creates a temporary directory. See the mkdtemp() documentation on most UNIX-like systems.
The parameter is a string that should follow the rules for mkdtemp() templates, i.e. contain the string "XXXXXX". g_mkdtemp() is slightly more flexible than mkdtemp() in that the sequence does not have to occur at the very end of the template. The X string will be modified to form the name of a directory that didn't already exist. The string should be in the GLib file name encoding. Most importantly, on Windows it should be in UTF-8.
Return value: If a temporary directory was successfully created, will be returned with the XXXXXX string modified in such a way as to make the path unique. In case of errors, NULL is returned.
Definition at line 228 of file ev-file-helpers.c.
|
static |
|
static |
|
static |
gchar* ev_file_compress | ( | const gchar * | uri, |
EvCompressionType | type, | ||
GError ** | error | ||
) |
ev_file_compress: : a file URI : the compression type : a #GError location to store an error, or NULL
Compresses the file at .
If is EV_COMPRESSION_NONE, it does nothing and returns NULL.
Otherwise, it returns the filename of a temporary file containing the compressed data from the file at .
On error it returns NULL and fills in .
It is the caller's responsibility to unlink the temp file after use.
Returns: a newly allocated string URI, or NULL on error
Definition at line 735 of file ev-file-helpers.c.
gboolean ev_file_copy_metadata | ( | const char * | from, |
const char * | to, | ||
GError ** | error | ||
) |
ev_file_copy_metadata: : the source URI : the target URI : a #GError location to store an error, or NULL
Performs a g_file_copy_attributes() with G_FILE_COPY_ALL_METADATA from to .
Returns: TRUE if the attributes were copied successfully, FALSE otherwise.
Since: 3.4
Definition at line 444 of file ev-file-helpers.c.
gchar* ev_file_get_mime_type | ( | const gchar * | uri, |
gboolean | fast, | ||
GError ** | error | ||
) |
ev_file_get_mime_type: : the URI : whether to use fast MIME type detection : a #GError location to store an error, or NULL
Returns: a newly allocated string with the MIME type of the file at , or NULL on error or if the MIME type could not be determined
Definition at line 573 of file ev-file-helpers.c.
gboolean ev_file_is_temp | ( | GFile * | file) |
gchar* ev_file_uncompress | ( | const gchar * | uri, |
EvCompressionType | type, | ||
GError ** | error | ||
) |
ev_file_uncompress: : a file URI : the compression type : a #GError location to store an error, or NULL
Uncompresses the file at .
If is EV_COMPRESSION_NONE, it does nothing and returns NULL.
Otherwise, it returns the filename of a temporary file containing the decompressed data from the file at . On error it returns NULL and fills in .
It is the caller's responsibility to unlink the temp file after use.
Returns: a newly allocated string URI, or NULL on error
Definition at line 706 of file ev-file-helpers.c.
gchar* ev_mkdtemp | ( | const char * | tmpl, |
GError ** | error | ||
) |
ev_mkdtemp: : a template string; must end in 'XXXXXX' : a location to store a #GError
Creates a temp directory in the evince temp directory.
Returns: a newly allocated string with the temp directory name, or NULL on error with filled in
Definition at line 295 of file ev-file-helpers.c.
int ev_mkstemp | ( | const char * | tmpl, |
char ** | file_name, | ||
GError ** | error | ||
) |
ev_mkstemp: : a template string; must contain 'XXXXXX', but not necessarily as a suffix : a location to store the filename of the temp file : a location to store a #GError
Creates a temp file in the evince temp directory.
Returns: a file descriptor to the newly created temp file name, or %-1 on error with filled in
Definition at line 129 of file ev-file-helpers.c.
GFile* ev_mkstemp_file | ( | const char * | tmpl, |
GError ** | error | ||
) |
ev_mkstemp_file: : a template string; must contain 'XXXXXX', but not necessarily as a suffix : a location to store a #GError
Creates a temp #GFile in the evince temp directory. See ev_mkstemp() for more information.
Returns: (transfer full): a newly allocated #GFile for the newly created temp file name, or NULL on error with filled in
Definition at line 179 of file ev-file-helpers.c.
void ev_tmp_file_unlink | ( | GFile * | file) |
void ev_tmp_filename_unlink | ( | const gchar * | filename) |
void ev_tmp_uri_unlink | ( | const gchar * | uri) |
gboolean ev_xfer_uri_simple | ( | const char * | from, |
const char * | to, | ||
GError ** | error | ||
) |
ev_xfer_uri_simple: : the source URI : the target URI : a #GError location to store an error, or NULL
Performs a g_file_copy() from to .
Returns: TRUE on success, or FALSE on error with filled in
Definition at line 403 of file ev-file-helpers.c.
|
static |
|
static |
|
static |
Definition at line 582 of file ev-file-helpers.c.
|
static |
Definition at line 34 of file ev-file-helpers.c.