[Xfce4-commits] r25255 - squeeze/trunk/libsqueeze
Stephan Arts
stephan at xfce.org
Fri Mar 23 00:22:17 CET 2007
Author: stephan
Date: 2007-03-22 23:22:17 +0000 (Thu, 22 Mar 2007)
New Revision: 25255
Modified:
squeeze/trunk/libsqueeze/command-builder-gnu-tar.c
squeeze/trunk/libsqueeze/macro-command.c
Log:
fixed add to gnu-tar
Modified: squeeze/trunk/libsqueeze/command-builder-gnu-tar.c
===================================================================
--- squeeze/trunk/libsqueeze/command-builder-gnu-tar.c 2007-03-22 19:17:53 UTC (rev 25254)
+++ squeeze/trunk/libsqueeze/command-builder-gnu-tar.c 2007-03-22 23:22:17 UTC (rev 25255)
@@ -139,7 +139,7 @@
}
static const gchar *
-lsq_command_builder_gnu_tar_get_compress_skeleton(LSQCommandBuilder *builder, LSQArchive *archive)
+lsq_command_builder_gnu_tar_get_decompress_skeleton(LSQCommandBuilder *builder, LSQArchive *archive)
{
const gchar *decompress_skeleton = NULL;
@@ -156,7 +156,7 @@
}
static const gchar *
-lsq_command_builder_gnu_tar_get_decompress_skeleton(LSQCommandBuilder *builder, LSQArchive *archive)
+lsq_command_builder_gnu_tar_get_compress_skeleton(LSQCommandBuilder *builder, LSQArchive *archive)
{
const gchar *compress_skeleton = NULL;
@@ -182,13 +182,28 @@
const gchar *compress_skeleton = NULL;
const gchar *decompress_skeleton = NULL;
LSQArchiveCommand *add_macro = NULL;
-
+ LSQArchiveCommand *decompress = NULL;
+ LSQArchiveCommand *compress = NULL;
+
compress_skeleton = lsq_command_builder_gnu_tar_get_compress_skeleton(builder, archive);
- decompress_skeleton = lsq_command_builder_gnu_tar_get_decompress_skeleton(builder, archive);
- if(decompress_skeleton)
+ if(compress_skeleton)
+ {
tmp_file = lsq_archive_request_temp_file(archive, ".tar");
+ compress = lsq_spawn_command_new(_("Compressing"),
+ archive,
+ compress_skeleton,
+ NULL,
+ NULL,
+ tmp_file);
+
+ if(!lsq_spawn_command_set_parse_func(LSQ_SPAWN_COMMAND(compress), 1, lsq_command_builder_gnu_tar_compress_parse_output, NULL))
+ {
+ g_critical("Could not set refresh parse function");
+ }
+ }
+
if(!lsq_archive_exists(archive))
{
add_skeleton = "tar %3$s -c -f %1$s %2$s";
@@ -196,6 +211,24 @@
else
{
add_skeleton = "tar %3$s -r -f %1$s %2$s";
+ decompress_skeleton = lsq_command_builder_gnu_tar_get_decompress_skeleton(builder, archive);
+
+
+ if(decompress_skeleton)
+ {
+ decompress = lsq_spawn_command_new(_("Decompressing"),
+ archive,
+ decompress_skeleton,
+ NULL,
+ NULL,
+ NULL);
+ g_object_set_data(G_OBJECT(decompress), LSQ_ARCHIVE_TEMP_FILE, tmp_file);
+
+ if(!lsq_spawn_command_set_parse_func(LSQ_SPAWN_COMMAND(decompress), 1, lsq_command_builder_gnu_tar_decompress_parse_output, NULL))
+ {
+ g_critical("Could not set refresh parse function");
+ }
+ }
}
LSQArchiveCommand *spawn = lsq_spawn_command_new(_("Adding files"),
archive,
@@ -203,32 +236,25 @@
files,
options,
tmp_file);
+ add_macro = lsq_macro_command_new(NULL, archive);
+ if(decompress)
+ {
+ lsq_macro_command_append(LSQ_MACRO_COMMAND(add_macro), decompress);
+ g_object_unref(decompress);
+ }
- if(decompress_skeleton)
+ lsq_macro_command_append(LSQ_MACRO_COMMAND(add_macro), spawn);
+ g_object_unref(spawn);
+
+ if(compress)
{
- LSQArchiveCommand *decompress = lsq_spawn_command_new(_("Decompressing"),
- archive,
- decompress_skeleton,
- NULL,
- NULL,
- tmp_file);
- LSQArchiveCommand *compress = lsq_spawn_command_new(_("Compressing"),
- archive,
- compress_skeleton,
- NULL,
- NULL,
- tmp_file);
- add_macro = lsq_macro_command_new(NULL, archive);
- lsq_macro_command_append(LSQ_MACRO_COMMAND(add_macro), decompress);
- lsq_macro_command_append(LSQ_MACRO_COMMAND(add_macro), spawn);
lsq_macro_command_append(LSQ_MACRO_COMMAND(add_macro), compress);
+ g_object_unref(compress);
}
- if(!add_macro)
- add_macro = spawn;
g_free(files);
- return NULL;
+ return add_macro;
}
Modified: squeeze/trunk/libsqueeze/macro-command.c
===================================================================
--- squeeze/trunk/libsqueeze/macro-command.c 2007-03-22 19:17:53 UTC (rev 25254)
+++ squeeze/trunk/libsqueeze/macro-command.c 2007-03-22 23:22:17 UTC (rev 25255)
@@ -135,6 +135,8 @@
archive_command = g_object_new(LSQ_TYPE_MACRO_COMMAND, NULL);
+ archive_command->archive = archive;
+
if(comment)
archive_command->comment = g_strdup(comment);
More information about the Xfce4-commits
mailing list