]> www.fi.muni.cz Git - evince.git/commitdiff
[comics] Add support for cbt files
authorJuanjo Marín <juanj.marin@juntadeandalucia.es>
Fri, 11 Dec 2009 13:40:43 +0000 (14:40 +0100)
committerCarlos Garcia Campos <carlosgc@gnome.org>
Fri, 11 Dec 2009 13:40:43 +0000 (14:40 +0100)
Fixes bgo#588266.

backend/comics/comics-document.c
backend/comics/comicsdocument.evince-backend.in
configure.ac

index c871860dd4a6e704121a11844ebcca521404c65c..2e867b5c825871e6e20920c47ada466a989dc1a2 100644 (file)
@@ -40,7 +40,8 @@ typedef enum
        RARLABS,
        GNAUNRAR,
        UNZIP,
-       P7ZIP
+       P7ZIP,
+       TAR
 } ComicBookDecompressType;
 
 typedef struct _ComicsDocumentClass ComicsDocumentClass;
@@ -91,16 +92,19 @@ typedef struct {
 
 static const ComicBookDecompressCommand command_usage_def[] = {
         /* RARLABS unrar */
-       {"%s p -c- -ierr", "%s vb -c- -- %s", NULL             , FALSE, NO_OFFSET},
+       {"%s p -c- -ierr --", "%s vb -c- -- %s", NULL             , FALSE, NO_OFFSET},
 
         /* GNA! unrar */
-       {NULL            , "%s t %s"        , "%s -xf %s %s"   , TRUE , NO_OFFSET},
+       {NULL               , "%s t %s"        , "%s -xf %s %s"   , TRUE , NO_OFFSET},
 
         /* unzip */
-       {"%s -p -C"      , "%s -Z -1 -- %s" , NULL             , TRUE , NO_OFFSET},
+       {"%s -p -C --"      , "%s -Z -1 -- %s" , NULL             , TRUE , NO_OFFSET},
 
         /* 7zip */
-       {NULL            , "%s l -- %s"     , "%s x -y %s -o%s", FALSE, OFFSET_7Z}
+       {NULL               , "%s l -- %s"     , "%s x -y %s -o%s", FALSE, OFFSET_7Z},
+
+        /* tar */
+       {"%s -xOf"          , "%s -tf %s"      , NULL             , FALSE, NO_OFFSET}
 };
 
 static void       comics_document_document_thumbnails_iface_init (EvDocumentThumbnailsIface *iface);
@@ -350,6 +354,15 @@ comics_check_decompress_command    (gchar          *mime_type,
                                comics_document->command_usage = P7ZIP;
                                return TRUE;
                        }
+       } else if (!strcmp (mime_type, "application/x-cbt") ||
+                  !strcmp (mime_type, "application/x-tar")) {
+               /* tar utility (Tape ARchive) */
+               comics_document->selected_command =
+                               g_find_program_in_path ("tar");
+               if (comics_document->selected_command) {
+                       comics_document->command_usage = TAR;
+                       return TRUE;
+               }
        } else {
                g_set_error (error,
                             EV_DOCUMENT_ERROR,
@@ -850,11 +863,10 @@ extract_argv (EvDocument *document, gint page)
                quoted_filename = g_shell_quote (comics_document->page_names->pdata[page]);
        }
 
-       command_line = g_strdup_printf ("%s -- %s %s",
+       command_line = g_strdup_printf ("%s %s %s",
                                        comics_document->extract_command,
                                        quoted_archive,
                                        quoted_filename);
-
        g_shell_parse_argv (command_line, NULL, &argv, &err);
 
        if (err) {
index d46161d2f6bce29932d57ff9cf4f894068c20ed3..90d4c01ba2823ca45cc44e744d9b0cf5b083f81c 100644 (file)
@@ -1,4 +1,4 @@
 [Evince Backend]
 Module=comicsdocument
 _TypeDescription=Comic Books
-MimeType=application/x-cbr;application/x-cbz;application/x-cb7;
+MimeType=application/x-cbr;application/x-cbz;application/x-cb7;application/x-cbt;
index e7daa9558e16b542328a3157f99f8d5083b83b9a..fc05dbca2de4aeca02ae52a88821357ff5da0cf7 100644 (file)
@@ -700,7 +700,7 @@ if test "x$enable_tiff" = "xyes"; then
        EVINCE_MIME_TYPES="${EVINCE_MIME_TYPES}image/tiff;"
 fi
 if test "x$enable_comics" = "xyes"; then
-       EVINCE_MIME_TYPES="${EVINCE_MIME_TYPES}application/x-cbr;application/x-cbz;application/x-cb7;"
+       EVINCE_MIME_TYPES="${EVINCE_MIME_TYPES}application/x-cbr;application/x-cbz;application/x-cb7;application/x-cbt;"
 fi
 if test "x$enable_pixbuf" = "xyes"; then
        EVINCE_MIME_TYPES="${EVINCE_MIME_TYPES}image/*;"