[file-roller] added support for xz compressed archives
- From: Paolo Bacchilega <paobac src gnome org>
- To: svn-commits-list gnome org
- Subject: [file-roller] added support for xz compressed archives
- Date: Mon, 15 Jun 2009 12:43:28 -0400 (EDT)
commit 060be4f28105a8142d34f6d968c29798ae8f6b57
Author: George Vlahavas <vlahavas gmail com>
Date: Mon Jun 15 18:41:17 2009 +0200
added support for xz compressed archives
GNOME bug #582237
data/file-roller.desktop.in.in | 2 +-
nautilus/nautilus-fileroller.c | 2 +
src/fr-command-cfile.c | 20 ++++++++++++++++
src/fr-command-tar.c | 50 ++++++++++++++++++++++++++++++++++++---
src/main.c | 5 ++++
5 files changed, 74 insertions(+), 5 deletions(-)
---
diff --git a/data/file-roller.desktop.in.in b/data/file-roller.desktop.in.in
index f39475e..0df2cc8 100644
--- a/data/file-roller.desktop.in.in
+++ b/data/file-roller.desktop.in.in
@@ -9,7 +9,7 @@ Terminal=false
Type=Application
Icon=file-roller
Categories=GTK;GNOME;Utility;Archiving;Compression;
-MimeType=application/x-7z-compressed;application/x-7z-compressed-tar;application/x-ace;application/x-alz;application/x-ar;application/x-arj;application/x-bzip;application/x-bzip-compressed-tar;application/x-bzip1;application/x-bzip1-compressed-tar;application/x-cabinet;application/x-cbr;application/x-cbz;application/x-cd-image;application/x-compress;application/x-compressed-tar;application/x-cpio;application/x-deb;application/x-ear;application/x-ms-dos-executable;application/x-gtar;application/x-gzip;application/x-gzpostscript;application/x-java-archive;application/x-lha;application/x-lhz;application/x-lzma;application/x-lzma-compressed-tar;application/x-lzop;application/x-lzop-compressed-tar;application/x-rar;application/x-rar-compressed;application/x-rpm;application/x-rzip;application/x-tar;application/x-tarz;application/x-stuffit;application/x-war;application/x-zip;application/x-zip-compressed;application/x-zoo;application/zip;multipart/x-zip;
+MimeType=application/x-7z-compressed;application/x-7z-compressed-tar;application/x-ace;application/x-alz;application/x-ar;application/x-arj;application/x-bzip;application/x-bzip-compressed-tar;application/x-bzip1;application/x-bzip1-compressed-tar;application/x-cabinet;application/x-cbr;application/x-cbz;application/x-cd-image;application/x-compress;application/x-compressed-tar;application/x-cpio;application/x-deb;application/x-ear;application/x-ms-dos-executable;application/x-gtar;application/x-gzip;application/x-gzpostscript;application/x-java-archive;application/x-lha;application/x-lhz;application/x-lzma;application/x-lzma-compressed-tar;application/x-lzop;application/x-lzop-compressed-tar;application/x-rar;application/x-rar-compressed;application/x-rpm;application/x-rzip;application/x-tar;application/x-tarz;application/x-stuffit;application/x-war;application/x-xz;application/x-xz-compressed-tar;application/x-zip;application/x-zip-compressed;application/x-zoo;application/
zip;multipart/x-zip;
X-GNOME-DocPath=file-roller/file-roller.xml
X-GNOME-Bugzilla-Bugzilla=GNOME
X-GNOME-Bugzilla-Product=file-roller
diff --git a/nautilus/nautilus-fileroller.c b/nautilus/nautilus-fileroller.c
index b797ac8..409331d 100644
--- a/nautilus/nautilus-fileroller.c
+++ b/nautilus/nautilus-fileroller.c
@@ -179,6 +179,8 @@ static char *mime_types[] = {
"application/x-tarz",
"application/x-stuffit",
"application/x-war",
+ "application/x-xz",
+ "application/x-xz-compressed-tar",
"application/x-zip",
"application/x-zip-compressed",
"application/x-zoo",
diff --git a/src/fr-command-cfile.c b/src/fr-command-cfile.c
index a34265d..9f2953b 100644
--- a/src/fr-command-cfile.c
+++ b/src/fr-command-cfile.c
@@ -257,6 +257,14 @@ fr_command_cfile_add (FrCommand *comm,
fr_process_end_command (comm->process);
compressed_filename = g_strconcat (filename, ".lzma", NULL);
}
+ else if (is_mime_type (comm->mime_type, "application/x-xz")) {
+ fr_process_begin_command (comm->process, "xz");
+ fr_process_set_working_dir (comm->process, temp_dir);
+ fr_process_add_arg (comm->process, "--");
+ fr_process_add_arg (comm->process, filename);
+ fr_process_end_command (comm->process);
+ compressed_filename = g_strconcat (filename, ".xz", NULL);
+ }
else if (is_mime_type (comm->mime_type, "application/x-lzop")) {
fr_process_begin_command (comm->process, "lzop");
fr_process_set_working_dir (comm->process, temp_dir);
@@ -374,6 +382,13 @@ fr_command_cfile_extract (FrCommand *comm,
fr_process_add_arg (comm->process, temp_file);
fr_process_end_command (comm->process);
}
+ else if (is_mime_type (comm->mime_type, "application/x-xz")) {
+ fr_process_begin_command (comm->process, "xz");
+ fr_process_add_arg (comm->process, "-f");
+ fr_process_add_arg (comm->process, "-d");
+ fr_process_add_arg (comm->process, temp_file);
+ fr_process_end_command (comm->process);
+ }
else if (is_mime_type (comm->mime_type, "application/x-lzop")) {
fr_process_begin_command (comm->process, "lzop");
fr_process_set_working_dir (comm->process, temp_dir);
@@ -431,6 +446,7 @@ const char *cfile_mime_type[] = { "application/x-gzip",
"application/x-lzma",
"application/x-lzop",
"application/x-rzip",
+ "application/x-xz",
NULL };
@@ -466,6 +482,10 @@ fr_command_cfile_get_capabilities (FrCommand *comm,
if (is_program_in_path ("lzma"))
capabilities |= FR_COMMAND_CAN_READ_WRITE;
}
+ else if (is_mime_type (mime_type, "application/x-xz")) {
+ if (is_program_in_path ("xz"))
+ capabilities |= FR_COMMAND_CAN_READ_WRITE;
+ }
else if (is_mime_type (mime_type, "application/x-lzop")) {
if (is_program_in_path ("lzop"))
capabilities |= FR_COMMAND_CAN_READ_WRITE;
diff --git a/src/fr-command-tar.c b/src/fr-command-tar.c
index 706f3a4..e7ffc23 100644
--- a/src/fr-command-tar.c
+++ b/src/fr-command-tar.c
@@ -206,13 +206,16 @@ add_compress_arg (FrCommand *comm)
else if (is_mime_type (comm->mime_type, "application/x-lzma-compressed-tar"))
fr_process_add_arg (comm->process, "--use-compress-program=lzma");
+ else if (is_mime_type (comm->mime_type, "application/x-xz-compressed-tar"))
+ fr_process_add_arg (comm->process, "--use-compress-program=xz");
+
else if (is_mime_type (comm->mime_type, "application/x-lzop-compressed-tar"))
fr_process_add_arg (comm->process, "--use-compress-program=lzop");
else if (is_mime_type (comm->mime_type, "application/x-7z-compressed-tar")) {
FrCommandTar *comm_tar = (FrCommandTar*) comm;
char *option;
-
+
option = g_strdup_printf ("--use-compress-program=%s", comm_tar->compress_command);
fr_process_add_arg (comm->process, option);
g_free (option);
@@ -551,6 +554,26 @@ fr_command_tar_recompress (FrCommand *comm)
new_name = g_strconcat (c_tar->uncomp_filename, ".lzma", NULL);
}
+ else if (is_mime_type (comm->mime_type, "application/x-xz-compressed-tar")) {
+ fr_process_begin_command (comm->process, "xz");
+ fr_process_set_sticky (comm->process, TRUE);
+ fr_process_set_begin_func (comm->process, begin_func__recompress, comm);
+ switch (comm->compression) {
+ case FR_COMPRESSION_VERY_FAST:
+ fr_process_add_arg (comm->process, "-1"); break;
+ case FR_COMPRESSION_FAST:
+ fr_process_add_arg (comm->process, "-3"); break;
+ case FR_COMPRESSION_NORMAL:
+ fr_process_add_arg (comm->process, "-6"); break;
+ case FR_COMPRESSION_MAXIMUM:
+ fr_process_add_arg (comm->process, "-9"); break;
+ }
+ fr_process_add_arg (comm->process, "-f");
+ fr_process_add_arg (comm->process, c_tar->uncomp_filename);
+ fr_process_end_command (comm->process);
+
+ new_name = g_strconcat (c_tar->uncomp_filename, ".xz", NULL);
+ }
else if (is_mime_type (comm->mime_type, "application/x-lzop-compressed-tar")) {
fr_process_begin_command (comm->process, "lzop");
fr_process_set_sticky (comm->process, TRUE);
@@ -688,6 +711,12 @@ get_uncompressed_name (FrCommandTar *c_tar,
if (file_extension_is (e_filename, ".tar.lzma"))
new_name[l - 5] = 0;
}
+ else if (is_mime_type (comm->mime_type, "application/x-xz-compressed-tar")) {
+ /* X.tar.xz --> X.tar
+ * (There doesn't seem to be a shorthand suffix) */
+ if (file_extension_is (e_filename, ".tar.xz"))
+ new_name[l - 5] = 0;
+ }
else if (is_mime_type (comm->mime_type, "application/x-lzop-compressed-tar")) {
/* X.tzo --> X.tar
* X.tar.lzo --> X.tar */
@@ -799,6 +828,14 @@ fr_command_tar_uncompress (FrCommand *comm)
fr_process_add_arg (comm->process, tmp_name);
fr_process_end_command (comm->process);
}
+ else if (is_mime_type (comm->mime_type, "application/x-xz-compressed-tar")) {
+ fr_process_begin_command (comm->process, "xz");
+ fr_process_set_begin_func (comm->process, begin_func__uncompress, comm);
+ fr_process_add_arg (comm->process, "-f");
+ fr_process_add_arg (comm->process, "-d");
+ fr_process_add_arg (comm->process, tmp_name);
+ fr_process_end_command (comm->process);
+ }
else if (is_mime_type (comm->mime_type, "application/x-lzop-compressed-tar")) {
fr_process_begin_command (comm->process, "lzop");
fr_process_set_begin_func (comm->process, begin_func__uncompress, comm);
@@ -848,8 +885,9 @@ const char *tar_mime_types[] = { "application/x-compressed-tar",
"application/x-tar",
"application/x-7z-compressed-tar",
"application/x-lzma-compressed-tar",
- "application/x-lzop-compressed-tar",
+ "application/x-lzop-compressed-tar",
"application/x-tarz",
+ "application/x-xz-compressed-tar",
NULL };
@@ -883,16 +921,20 @@ fr_command_tar_get_capabilities (FrCommand *comm,
if (is_program_in_path ("bzip2"))
capabilities |= FR_COMMAND_CAN_READ_WRITE;
}
- else if (is_mime_type (mime_type, "application/x-tarz")) {
+ else if (is_mime_type (mime_type, "application/x-tarz")) {
if (is_program_in_path ("compress") && is_program_in_path ("uncompress"))
capabilities |= FR_COMMAND_CAN_READ_WRITE;
else if (is_program_in_path ("gzip"))
- capabilities |= FR_COMMAND_CAN_READ;
+ capabilities |= FR_COMMAND_CAN_READ;
}
else if (is_mime_type (mime_type, "application/x-lzma-compressed-tar")) {
if (is_program_in_path ("lzma"))
capabilities |= FR_COMMAND_CAN_READ_WRITE;
}
+ else if (is_mime_type (mime_type, "application/x-xz-compressed-tar")) {
+ if (is_program_in_path ("xz"))
+ capabilities |= FR_COMMAND_CAN_READ_WRITE;
+ }
else if (is_mime_type (mime_type, "application/x-lzop-compressed-tar")) {
if (is_program_in_path ("lzop"))
capabilities |= FR_COMMAND_CAN_READ_WRITE;
diff --git a/src/main.c b/src/main.c
index e5ba2cf..90b9f72 100644
--- a/src/main.c
+++ b/src/main.c
@@ -112,6 +112,8 @@ FrMimeTypeDescription mime_type_desc[] = {
{ "application/x-tarz", ".tar.Z", N_("Tar compressed with compress (.tar.Z)"), 0 },
{ "application/x-stuffit", ".sit", NULL, 0 },
{ "application/x-war", ".war", N_("War (.war)"), 0 },
+ { "application/x-xz", ".xz", N_("Xz (.xz)"), 0 },
+ { "application/x-xz-compressed-tar", ".tar.xz", N_("Tar compressed with xz (.tar.xz)"), 0 },
{ "application/x-zoo", ".zoo", N_("Zoo (.zoo)"), 0 },
{ "application/zip", ".zip", N_("Zip (.zip)"), 0 },
{ NULL, NULL, NULL, 0 }
@@ -151,14 +153,17 @@ FrExtensionType file_ext_type[] = {
{ ".tar.lzma", "application/x-lzma-compressed-tar" },
{ ".tar.lzo", "application/x-lzop-compressed-tar" },
{ ".tar.7z", "application/x-7z-compressed-tar" },
+ { ".tar.xz", "application/x-xz-compressed-tar" },
{ ".tar.Z", "application/x-tarz" },
{ ".taz", "application/x-tarz" },
{ ".tbz", "application/x-bzip-compressed-tar" },
{ ".tbz2", "application/x-bzip-compressed-tar" },
{ ".tgz", "application/x-compressed-tar" },
+ { ".txz", "application/x-xz-compressed-tar" },
{ ".tzma", "application/x-lzma-compressed-tar" },
{ ".tzo", "application/x-lzop-compressed-tar" },
{ ".war", "application/x-war" },
+ { ".xz", "application/x-xz" },
{ ".z", "application/x-gzip" },
{ ".Z", "application/x-compress" },
{ ".zip", "application/zip" },
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]