[evince] [comics] Add support for cbt files



commit d68a91467efab8ef8a8f98589dd4c21b993b6e14
Author: Juanjo Marín <juanj marin juntadeandalucia es>
Date:   Fri Dec 11 14:40:43 2009 +0100

    [comics] Add support for cbt files
    
    Fixes bgo#588266.

 backend/comics/comics-document.c                |   26 ++++++++++++++++------
 backend/comics/comicsdocument.evince-backend.in |    2 +-
 configure.ac                                    |    2 +-
 3 files changed, 21 insertions(+), 9 deletions(-)
---
diff --git a/backend/comics/comics-document.c b/backend/comics/comics-document.c
index c871860..2e867b5 100644
--- a/backend/comics/comics-document.c
+++ b/backend/comics/comics-document.c
@@ -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) {
diff --git a/backend/comics/comicsdocument.evince-backend.in b/backend/comics/comicsdocument.evince-backend.in
index d46161d..90d4c01 100644
--- a/backend/comics/comicsdocument.evince-backend.in
+++ b/backend/comics/comicsdocument.evince-backend.in
@@ -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;
diff --git a/configure.ac b/configure.ac
index e7daa95..fc05dbc 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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/*;"



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]