diff options
author | infirit <[email protected]> | 2014-12-09 16:02:36 +0100 |
---|---|---|
committer | infirit <[email protected]> | 2014-12-09 23:02:28 +0100 |
commit | 30a41d9c9cb55687675d00b98835a5b54c120b43 (patch) | |
tree | f552ab311fdb7799e9b4a009d298fc95ebb9426d /libdocument/ev-file-helpers.c | |
parent | 0412a5fb05ca8726129a5f6f4d2ef599e804e444 (diff) | |
download | atril-30a41d9c9cb55687675d00b98835a5b54c120b43.tar.bz2 atril-30a41d9c9cb55687675d00b98835a5b54c120b43.tar.xz |
libdocument: Add xz compression support
Taken from evince commit: 38cfc027fc96ac19452c3138614e2c8deff63633
From: Christian Persch <[email protected]>
Diffstat (limited to 'libdocument/ev-file-helpers.c')
-rw-r--r-- | libdocument/ev-file-helpers.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/libdocument/ev-file-helpers.c b/libdocument/ev-file-helpers.c index 779b635c..23582ec8 100644 --- a/libdocument/ev-file-helpers.c +++ b/libdocument/ev-file-helpers.c @@ -525,8 +525,14 @@ ev_file_get_mime_type (const gchar *uri, } /* Compressed files support */ -#define BZIPCOMMAND "bzip2" -#define GZIPCOMMAND "gzip" + +static const char *compressor_cmds[] = { + NULL, + "bzip2", + "gzip", + "xz" +}; + #define N_ARGS 4 #define BUFFER_SIZE 1024 @@ -546,13 +552,13 @@ compression_run (const gchar *uri, if (type == EV_COMPRESSION_NONE) return NULL; - cmd = g_find_program_in_path ((type == EV_COMPRESSION_BZIP2) ? BZIPCOMMAND : GZIPCOMMAND); + cmd = g_find_program_in_path (compressor_cmds[type]); if (!cmd) { /* FIXME: better error codes! */ /* FIXME: i18n later */ g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_FAILED, "Failed to find the \"%s\" command in the search path.", - type == EV_COMPRESSION_BZIP2 ? BZIPCOMMAND : GZIPCOMMAND); + compressor_cmds[type]); return NULL; } |