file-roller r2373 - in trunk: . src



Author: paobac
Date: Mon Jul 21 12:33:40 2008
New Revision: 2373
URL: http://svn.gnome.org/viewvc/file-roller?rev=2373&view=rev

Log:
2008-07-21  Paolo Bacchilega  <paobac svn gnome org>

	* TODO: updated
	* src/fr-window.c: disable progress log.
	
	* src/fr-command-*.c: 
	* src/fr-command.h: 
	* src/fr-command.c: 
	* src/fr-archive.c:
	
	Added ability to specify the file list in a file, for the commands
	that support this option.  This is usefull to avoid to execute a command
	multiple times when the file list is too long to pass it to the 
	command line at once.  


Modified:
   trunk/ChangeLog
   trunk/TODO
   trunk/src/fr-archive.c
   trunk/src/fr-command-7z.c
   trunk/src/fr-command-ace.c
   trunk/src/fr-command-alz.c
   trunk/src/fr-command-ar.c
   trunk/src/fr-command-arj.c
   trunk/src/fr-command-cfile.c
   trunk/src/fr-command-cpio.c
   trunk/src/fr-command-iso.c
   trunk/src/fr-command-jar.c
   trunk/src/fr-command-lha.c
   trunk/src/fr-command-rar.c
   trunk/src/fr-command-rpm.c
   trunk/src/fr-command-tar.c
   trunk/src/fr-command-unstuff.c
   trunk/src/fr-command-zip.c
   trunk/src/fr-command-zoo.c
   trunk/src/fr-command.c
   trunk/src/fr-command.h
   trunk/src/fr-window.c

Modified: trunk/TODO
==============================================================================
--- trunk/TODO	(original)
+++ trunk/TODO	Mon Jul 21 12:33:40 2008
@@ -1,9 +1,12 @@
 == ToDo ==
 
-[ ] optimization of the add_folder operation: if the command supports all the
+[x] optimization of the add_folder operation: if the command supports all the
     requested options add the folder directly instead of reading the folder 
     and adding the content in chunks.
     
+    Partially fixed for the commands that allow to specify the file list
+    in a file, that is: tar, rar, 7zip.
+    
 [ ] #525274 â File roller seems to be unable to create zipfiles without .zip extension
 
 [ ] #512825 â Fails extraction of files within directories named '.'
@@ -12,7 +15,9 @@
 
 [ ] #482560 â totem-like plugin installer for file-roller
 
-[ ] #153281 â Progress bar should be exact
+[x] #153281 â Progress bar should be exact
+
+    This is command dependent: fixed for tar, zip, 7zip, rar.
 
 [x] #504584 â Incorrect comportment when extracting multi part rar files
 

Modified: trunk/src/fr-archive.c
==============================================================================
--- trunk/src/fr-archive.c	(original)
+++ trunk/src/fr-archive.c	Mon Jul 21 12:33:40 2008
@@ -161,6 +161,7 @@
 #define NO_BACKUP_FILES (TRUE)
 #define NO_DOT_FILES (FALSE)
 #define IGNORE_CASE (FALSE)
+#define LIST_LENGTH_TO_USE_FILE 10 /* FIXME: find a good value */
 
 
 enum {
@@ -1327,7 +1328,7 @@
 }
 
 
-static void archive_remove (FrArchive *archive, GList *file_list);
+static void delete_from_archive (FrArchive *archive, GList *file_list);
 
 
 static GList *
@@ -1398,6 +1399,57 @@
 }
 
 
+static gboolean
+save_list_to_temp_file (GList   *file_list,
+		        char   **list_dir,
+		        char   **list_filename,
+		        GError **error)
+{
+	gboolean           error_occurred = FALSE;
+	GFile             *list_file;
+	GFileOutputStream *ostream;
+
+	if (error != NULL)
+		*error = NULL;
+	*list_dir = get_temp_work_dir ();
+	*list_filename = g_build_filename (*list_dir, "file-list", NULL);
+	list_file = g_file_new_for_path (*list_filename);
+	ostream = g_file_create (list_file, G_FILE_CREATE_PRIVATE, NULL, error);
+
+	if (ostream != NULL) {
+		GList *scan;
+
+		for (scan = file_list; scan != NULL; scan = scan->next) {
+			char *filename = scan->data;
+
+			if ((g_output_stream_write (G_OUTPUT_STREAM (ostream), filename, strlen (filename), NULL, error) < 0)
+			    || (g_output_stream_write (G_OUTPUT_STREAM (ostream), "\n", 1, NULL, error) < 0))
+			{
+				error_occurred = TRUE;
+				break;
+			}
+		}
+		if (! error_occurred && ! g_output_stream_close (G_OUTPUT_STREAM (ostream), NULL, error))
+			error_occurred = TRUE;
+		g_object_unref (ostream);
+	}
+	else
+		error_occurred = TRUE;
+
+	if (error_occurred) {
+		remove_local_directory (*list_dir);
+		g_free (*list_dir);
+		g_free (*list_filename);
+		*list_dir = NULL;
+		*list_filename = NULL;
+	}
+
+	g_object_unref (list_file);
+
+	return ! error_occurred;
+}
+
+
 void
 fr_archive_add (FrArchive     *archive,
 		GList         *file_list,
@@ -1413,6 +1465,7 @@
 	gboolean  base_dir_created = FALSE;
 	GList    *scan;
 	char     *tmp_base_dir = NULL;
+	gboolean  error_occurred = FALSE;
 
 	if (file_list == NULL)
 		return;
@@ -1485,7 +1538,8 @@
 	 * delete the files first. */
 
 	if ((! update && ! archive->command->propAddCanReplace)
-	    || (update && ! archive->command->propAddCanUpdate)) {
+	    || (update && ! archive->command->propAddCanUpdate))
+	{
 		GList *del_list = NULL;
 
 		for (scan = new_file_list; scan != NULL; scan = scan->next) {
@@ -1497,7 +1551,7 @@
 		/* delete */
 
 		if (del_list != NULL) {
-			archive_remove (archive, del_list);
+			delete_from_archive (archive, del_list);
 			fr_process_set_ignore_error (archive->process, TRUE);
 			g_list_free (del_list);
 		}
@@ -1507,42 +1561,88 @@
 
 	fr_command_set_n_files (archive->command, g_list_length (new_file_list));
 
-	for (scan = new_file_list; scan != NULL; ) {
-		GList *prev = scan->prev;
-		GList *chunk_list;
-		int    l;
-
-		chunk_list = scan;
-		l = 0;
-		while ((scan != NULL) && (l < MAX_CHUNK_LEN)) {
-			if (l == 0)
-				l = strlen (scan->data);
-			prev = scan;
-			scan = scan->next;
-			if (scan != NULL)
-				l += strlen (scan->data);
+	if (archive->command->propListFromFile
+	    && (archive->command->n_files > LIST_LENGTH_TO_USE_FILE))
+	{
+		char   *list_dir;
+		char   *list_filename;
+		GError *error = NULL;
+
+		if (! save_list_to_temp_file (new_file_list, &list_dir, &list_filename, &error)) {
+			archive->process->error.type = FR_PROC_ERROR_GENERIC;
+			archive->process->error.status = 0;
+			archive->process->error.gerror = g_error_copy (error);
+			g_signal_emit_by_name (G_OBJECT (archive->process),
+					       "done",
+					       FR_ACTION_ADDING_FILES);
+			g_clear_error (&error);
+			error_occurred = TRUE;
+		}
+		else {
+			fr_command_add (archive->command,
+					list_filename,
+					new_file_list,
+					tmp_base_dir,
+					update,
+					recursive);
+
+			/* remove the temp dir */
+
+			fr_process_begin_command (archive->process, "rm");
+			fr_process_set_working_dir (archive->process, g_get_tmp_dir());
+			fr_process_set_sticky (archive->process, TRUE);
+			fr_process_add_arg (archive->process, "-rf");
+			fr_process_add_arg (archive->process, list_dir);
+			fr_process_end_command (archive->process);
 		}
 
-		prev->next = NULL;
-		fr_command_add (archive->command,
-				chunk_list,
-				tmp_base_dir,
-				update,
-				recursive);
-		prev->next = scan;
+		g_free (list_filename);
+		g_free (list_dir);
+	}
+	else {
+		/* specify the file list on the command line, splitting
+		 * in more commands to avoid to overflow the command line
+		 * length limit. */
+		for (scan = new_file_list; scan != NULL; ) {
+			GList *prev = scan->prev;
+			GList *chunk_list;
+			int    l;
+
+			chunk_list = scan;
+			l = 0;
+			while ((scan != NULL) && (l < MAX_CHUNK_LEN)) {
+				if (l == 0)
+					l = strlen (scan->data);
+				prev = scan;
+				scan = scan->next;
+				if (scan != NULL)
+					l += strlen (scan->data);
+			}
+
+			prev->next = NULL;
+			fr_command_add (archive->command,
+					NULL,
+					chunk_list,
+					tmp_base_dir,
+					update,
+					recursive);
+			prev->next = scan;
+		}
 	}
 
 	path_list_free (new_file_list);
 
-	fr_command_recompress (archive->command);
+	if (! error_occurred) {
+		fr_command_recompress (archive->command);
 
-	if (base_dir_created) { /* remove the temp dir */
-		fr_process_begin_command (archive->process, "rm");
-		fr_process_set_working_dir (archive->process, g_get_tmp_dir());
-		fr_process_set_sticky (archive->process, TRUE);
-		fr_process_add_arg (archive->process, "-rf");
-		fr_process_add_arg (archive->process, tmp_base_dir);
-		fr_process_end_command (archive->process);
+		if (base_dir_created) { /* remove the temp dir */
+			fr_process_begin_command (archive->process, "rm");
+			fr_process_set_working_dir (archive->process, g_get_tmp_dir());
+			fr_process_set_sticky (archive->process, TRUE);
+			fr_process_add_arg (archive->process, "-rf");
+			fr_process_add_arg (archive->process, tmp_base_dir);
+			fr_process_end_command (archive->process);
+		}
 	}
 
 	g_free (tmp_base_dir);
@@ -2148,6 +2248,7 @@
 		basedir = remove_level_from_path (fullpath);
 		singleton = g_list_prepend (NULL, (char*)file_name_from_path (fullpath));
 		fr_command_add (archive->command,
+				NULL,
 				singleton,
 				basedir,
 				data->update,
@@ -2246,8 +2347,8 @@
 
 
 static void
-archive_remove (FrArchive *archive,
-		GList     *file_list)
+delete_from_archive (FrArchive *archive,
+		     GList     *file_list)
 {
 	gboolean  file_list_created = FALSE;
 	GList    *tmp_file_list = NULL;
@@ -2301,26 +2402,54 @@
 		g_list_free (file_list);
 
 	fr_command_set_n_files (archive->command, g_list_length (tmp_file_list));
-	for (scan = tmp_file_list; scan != NULL; ) {
-		GList *prev = scan->prev;
-		GList *chunk_list;
-		int    l;
 
-		chunk_list = scan;
-		l = 0;
-		while ((scan != NULL) && (l < MAX_CHUNK_LEN)) {
-			if (l == 0)
-				l = strlen (scan->data);
-			prev = scan;
-			scan = scan->next;
-			if (scan != NULL)
-				l += strlen (scan->data);
+	if (archive->command->propListFromFile
+	    && (archive->command->n_files > LIST_LENGTH_TO_USE_FILE))
+	{
+		char *list_dir;
+		char *list_filename;
+
+		if (save_list_to_temp_file (tmp_file_list, &list_dir, &list_filename, NULL)) {
+			fr_command_delete (archive->command,
+					   list_filename,
+					   tmp_file_list);
+
+			/* remove the temp dir */
+
+			fr_process_begin_command (archive->process, "rm");
+			fr_process_set_working_dir (archive->process, g_get_tmp_dir());
+			fr_process_set_sticky (archive->process, TRUE);
+			fr_process_add_arg (archive->process, "-rf");
+			fr_process_add_arg (archive->process, list_dir);
+			fr_process_end_command (archive->process);
 		}
 
-		prev->next = NULL;
-		fr_command_delete (archive->command, chunk_list);
-		prev->next = scan;
+		g_free (list_filename);
+		g_free (list_dir);
+	}
+	else {
+		for (scan = tmp_file_list; scan != NULL; ) {
+			GList *prev = scan->prev;
+			GList *chunk_list;
+			int    l;
+
+			chunk_list = scan;
+			l = 0;
+			while ((scan != NULL) && (l < MAX_CHUNK_LEN)) {
+				if (l == 0)
+					l = strlen (scan->data);
+				prev = scan;
+				scan = scan->next;
+				if (scan != NULL)
+					l += strlen (scan->data);
+			}
+
+			prev->next = NULL;
+			fr_command_delete (archive->command, NULL, chunk_list);
+			prev->next = scan;
+		}
 	}
+
 	g_list_free (tmp_file_list);
 }
 
@@ -2338,7 +2467,7 @@
 	fr_archive_stoppable (archive, FALSE);
 	g_object_set (archive->command, "compression", compression, NULL);
 	fr_command_uncompress (archive->command);
-	archive_remove (archive, file_list);
+	delete_from_archive (archive, file_list);
 	fr_command_recompress (archive->command);
 }
 
@@ -2403,20 +2532,22 @@
 
 
 static void
-extract_in_chunks (FrCommand  *command,
-		   GList      *file_list,
-		   const char *dest_dir,
-		   gboolean    overwrite,
-		   gboolean    skip_older,
-		   gboolean    junk_paths,
-		   const char *password)
+extract_from_archive (FrArchive  *archive,
+		      GList      *file_list,
+		      const char *dest_dir,
+		      gboolean    overwrite,
+		      gboolean    skip_older,
+		      gboolean    junk_paths,
+		      const char *password)
 {
-	GList *scan;
+	FrCommand *command = archive->command;
+	GList     *scan;
 
 	g_object_set (command, "password", password, NULL);
 
 	if (file_list == NULL) {
 		fr_command_extract (command,
+				    NULL,
 				    file_list,
 				    dest_dir,
 				    overwrite,
@@ -2425,30 +2556,61 @@
 		return;
 	}
 
-	for (scan = file_list; scan != NULL; ) {
-		GList *prev = scan->prev;
-		GList *chunk_list;
-		int    l;
-
-		chunk_list = scan;
-		l = 0;
-		while ((scan != NULL) && (l < MAX_CHUNK_LEN)) {
-			if (l == 0)
-				l = strlen (scan->data);
-			prev = scan;
-			scan = scan->next;
-			if (scan != NULL)
-				l += strlen (scan->data);
+	if (command->propListFromFile
+	    && (g_list_length (file_list) > LIST_LENGTH_TO_USE_FILE))
+	{
+		char *list_dir;
+		char *list_filename;
+
+		if (save_list_to_temp_file (file_list, &list_dir, &list_filename, NULL)) {
+			fr_command_extract (command,
+					    list_filename,
+					    file_list,
+					    dest_dir,
+					    overwrite,
+					    skip_older,
+					    junk_paths);
+
+			/* remove the temp dir */
+
+			fr_process_begin_command (archive->process, "rm");
+			fr_process_set_working_dir (archive->process, g_get_tmp_dir());
+			fr_process_set_sticky (archive->process, TRUE);
+			fr_process_add_arg (archive->process, "-rf");
+			fr_process_add_arg (archive->process, list_dir);
+			fr_process_end_command (archive->process);
 		}
 
-		prev->next = NULL;
-		fr_command_extract (command,
-				    chunk_list,
-				    dest_dir,
-				    overwrite,
-				    skip_older,
-				    junk_paths);
-		prev->next = scan;
+		g_free (list_filename);
+		g_free (list_dir);
+	}
+	else {
+		for (scan = file_list; scan != NULL; ) {
+			GList *prev = scan->prev;
+			GList *chunk_list;
+			int    l;
+
+			chunk_list = scan;
+			l = 0;
+			while ((scan != NULL) && (l < MAX_CHUNK_LEN)) {
+				if (l == 0)
+					l = strlen (scan->data);
+				prev = scan;
+				scan = scan->next;
+				if (scan != NULL)
+					l += strlen (scan->data);
+			}
+
+			prev->next = NULL;
+			fr_command_extract (command,
+					    NULL,
+					    chunk_list,
+					    dest_dir,
+					    overwrite,
+					    skip_older,
+					    junk_paths);
+			prev->next = scan;
+		}
 	}
 }
 
@@ -2668,13 +2830,13 @@
 			filtered = file_list;
 
 		if (! (created_filtered_list && (filtered == NULL)))
-			extract_in_chunks (archive->command,
-					   filtered,
-					   destination,
-					   overwrite,
-					   skip_older,
-					   junk_paths,
-					   password);
+			extract_from_archive (archive,
+					      filtered,
+					      destination,
+					      overwrite,
+					      skip_older,
+					      junk_paths,
+					      password);
 
 		if (created_filtered_list && (filtered != NULL))
 			g_list_free (filtered);
@@ -2764,13 +2926,13 @@
 		char *temp_dir;
 
 		temp_dir = get_temp_work_dir ();
-		extract_in_chunks (archive->command,
-				   filtered,
-				   temp_dir,
-				   overwrite,
-				   skip_older,
-				   junk_paths,
-				   password);
+		extract_from_archive (archive,
+				      filtered,
+				      temp_dir,
+				      overwrite,
+				      skip_older,
+				      junk_paths,
+				      password);
 
 		if (use_base_dir) {
 			GList *tmp_list = compute_list_base_path (base_dir, filtered, junk_paths, archive->command->propExtractCanJunkPaths);
@@ -2793,13 +2955,13 @@
 		g_free (temp_dir);
 	}
 	else
-		extract_in_chunks (archive->command,
-				   filtered,
-				   destination,
-				   overwrite,
-				   skip_older,
-				   junk_paths,
-				   password);
+		extract_from_archive (archive,
+				      filtered,
+				      destination,
+				      overwrite,
+				      skip_older,
+				      junk_paths,
+				      password);
 
 	if (filtered != NULL)
 		g_list_free (filtered);

Modified: trunk/src/fr-command-7z.c
==============================================================================
--- trunk/src/fr-command-7z.c	(original)
+++ trunk/src/fr-command-7z.c	Mon Jul 21 12:33:40 2008
@@ -261,6 +261,7 @@
 
 static void
 fr_command_7z_add (FrCommand     *comm,
+		   const char    *from_file,
 		   GList         *file_list,
 		   const char    *base_dir,
 		   gboolean       update,
@@ -310,21 +311,23 @@
 	if (is_mime_type (comm->mime_type, "application/x-executable"))
 		fr_process_add_arg (comm->process, "-sfx");
 
+	if (from_file != NULL)
+		fr_process_add_arg_concat (comm->process, "-i@", from_file, NULL);
+
 	fr_process_add_arg (comm->process, "--");
 	fr_process_add_arg (comm->process, comm->filename);
-
-	for (scan = file_list; scan; scan = scan->next) {
-		char *filename = scan->data;
-		fr_process_add_arg (comm->process, filename);
-	}
+	if (from_file == NULL)
+		for (scan = file_list; scan; scan = scan->next)
+			fr_process_add_arg (comm->process, scan->data);
 
 	fr_process_end_command (comm->process);
 }
 
 
 static void
-fr_command_7z_delete (FrCommand *comm,
-		      GList     *file_list)
+fr_command_7z_delete (FrCommand  *comm,
+		      const char *from_file,
+		      GList      *file_list)
 {
 	GList *scan;
 
@@ -335,13 +338,14 @@
 	if (is_mime_type (comm->mime_type, "application/x-executable"))
 		fr_process_add_arg (comm->process, "-sfx");
 
+	if (from_file != NULL)
+		fr_process_add_arg_concat (comm->process, "-i@", from_file, NULL);
+
 	fr_process_add_arg (comm->process, "--");
 	fr_process_add_arg (comm->process, comm->filename);
-
-	for (scan = file_list; scan; scan = scan->next) {
-		char *filename = scan->data;
-		fr_process_add_arg (comm->process, filename);
-	}
+	if (from_file == NULL)
+		for (scan = file_list; scan; scan = scan->next)
+			fr_process_add_arg (comm->process, scan->data);
 
 	fr_process_end_command (comm->process);
 }
@@ -360,6 +364,7 @@
 
 static void
 fr_command_7z_extract (FrCommand  *comm,
+		       const char *from_file,
 		       GList      *file_list,
 		       const char *dest_dir,
 		       gboolean    overwrite,
@@ -386,11 +391,14 @@
 	if (dest_dir != NULL)
 		fr_process_add_arg_concat (comm->process, "-o", dest_dir, NULL);
 
+	if (from_file != NULL)
+		fr_process_add_arg_concat (comm->process, "-i@", from_file, NULL);
+
 	fr_process_add_arg (comm->process, "--");
 	fr_process_add_arg (comm->process, comm->filename);
-
-	for (scan = file_list; scan; scan = scan->next)
-		fr_process_add_arg (comm->process, scan->data);
+	if (from_file == NULL)
+		for (scan = file_list; scan; scan = scan->next)
+			fr_process_add_arg (comm->process, scan->data);
 
 	fr_process_end_command (comm->process);
 }
@@ -520,6 +528,7 @@
 	comm->propExtractCanJunkPaths      = TRUE;
 	comm->propPassword                 = TRUE;
 	comm->propTest                     = TRUE;
+	comm->propListFromFile             = TRUE;
 }
 
 

Modified: trunk/src/fr-command-ace.c
==============================================================================
--- trunk/src/fr-command-ace.c	(original)
+++ trunk/src/fr-command-ace.c	Mon Jul 21 12:33:40 2008
@@ -182,8 +182,9 @@
 
 static void
 fr_command_ace_extract (FrCommand   *comm,
+			const char  *from_file,
 			GList       *file_list,
-			const char *dest_dir,
+			const char  *dest_dir,
 			gboolean     overwrite,
 			gboolean     skip_older,
 			gboolean     junk_paths)

Modified: trunk/src/fr-command-alz.c
==============================================================================
--- trunk/src/fr-command-alz.c	(original)
+++ trunk/src/fr-command-alz.c	Mon Jul 21 12:33:40 2008
@@ -250,6 +250,7 @@
 
 static void
 fr_command_alz_extract (FrCommand  *comm,
+		        const char *from_file,
 			GList      *file_list,
 			const char *dest_dir,
 			gboolean    overwrite,

Modified: trunk/src/fr-command-ar.c
==============================================================================
--- trunk/src/fr-command-ar.c	(original)
+++ trunk/src/fr-command-ar.c	Mon Jul 21 12:33:40 2008
@@ -204,6 +204,7 @@
 
 static void
 fr_command_ar_add (FrCommand     *comm,
+		   const char    *from_file,
 		   GList         *file_list,
 		   const char    *base_dir,
 		   gboolean       update,
@@ -231,8 +232,9 @@
 
 
 static void
-fr_command_ar_delete (FrCommand *comm,
-		      GList     *file_list)
+fr_command_ar_delete (FrCommand  *comm,
+		      const char *from_file,
+		      GList      *file_list)
 {
 	GList *scan;
 
@@ -247,6 +249,7 @@
 
 static void
 fr_command_ar_extract (FrCommand  *comm,
+		       const char *from_file,
 		       GList      *file_list,
 		       const char *dest_dir,
 		       gboolean    overwrite,

Modified: trunk/src/fr-command-arj.c
==============================================================================
--- trunk/src/fr-command-arj.c	(original)
+++ trunk/src/fr-command-arj.c	Mon Jul 21 12:33:40 2008
@@ -178,6 +178,7 @@
 
 static void
 fr_command_arj_add (FrCommand     *comm,
+		    const char    *from_file,
 		    GList         *file_list,
 		    const char    *base_dir,
 		    gboolean       update,
@@ -223,8 +224,9 @@
 
 
 static void
-fr_command_arj_delete (FrCommand *comm,
-		       GList     *file_list)
+fr_command_arj_delete (FrCommand  *comm,
+		       const char *from_file,
+		       GList      *file_list)
 {
 	GList *scan;
 
@@ -245,6 +247,7 @@
 
 static void
 fr_command_arj_extract (FrCommand  *comm,
+			const char *from_file,
 			GList      *file_list,
 			const char *dest_dir,
 			gboolean    overwrite,

Modified: trunk/src/fr-command-cfile.c
==============================================================================
--- trunk/src/fr-command-cfile.c	(original)
+++ trunk/src/fr-command-cfile.c	Mon Jul 21 12:33:40 2008
@@ -200,6 +200,7 @@
 
 static void
 fr_command_cfile_add (FrCommand     *comm,
+		      const char    *from_file,
 		      GList         *file_list,
 		      const char    *base_dir,
 		      gboolean       update,
@@ -305,8 +306,9 @@
 
 
 static void
-fr_command_cfile_delete (FrCommand *comm,
-			 GList     *file_list)
+fr_command_cfile_delete (FrCommand  *comm,
+			 const char *from_file,
+			 GList      *file_list)
 {
 	/* never called */
 }
@@ -314,6 +316,7 @@
 
 static void
 fr_command_cfile_extract (FrCommand  *comm,
+			  const char *from_file,
 			  GList      *file_list,
 			  const char *dest_dir,
 			  gboolean    overwrite,

Modified: trunk/src/fr-command-cpio.c
==============================================================================
--- trunk/src/fr-command-cpio.c	(original)
+++ trunk/src/fr-command-cpio.c	Mon Jul 21 12:33:40 2008
@@ -195,7 +195,8 @@
 
 
 static void
-fr_command_cpio_extract (FrCommand  *comm,
+fr_command_cpio_extract (FrCommand *comm,
+			const char *from_file,
 			GList      *file_list,
 			const char *dest_dir,
 			gboolean    overwrite,

Modified: trunk/src/fr-command-iso.c
==============================================================================
--- trunk/src/fr-command-iso.c	(original)
+++ trunk/src/fr-command-iso.c	Mon Jul 21 12:33:40 2008
@@ -152,6 +152,7 @@
 
 static void
 fr_command_iso_extract (FrCommand  *comm,
+			const char *from_file,
 			GList      *file_list,
 			const char *dest_dir,
 			gboolean    overwrite,

Modified: trunk/src/fr-command-jar.c
==============================================================================
--- trunk/src/fr-command-jar.c	(original)
+++ trunk/src/fr-command-jar.c	Mon Jul 21 12:33:40 2008
@@ -50,6 +50,7 @@
 
 static void
 fr_command_jar_add (FrCommand     *comm,
+		    const char    *from_file,
 		    GList         *file_list,
 		    const char    *base_dir,
 		    gboolean       update,
@@ -117,10 +118,10 @@
 	}
 
 	if (zip_list != NULL)
-		parent_class->add (comm, zip_list, base_dir, update, FALSE);
+		parent_class->add (comm, NULL, zip_list, base_dir, update, FALSE);
 
 	if (jar_list != NULL)
-		parent_class->add (comm, jar_list, tmp_dir, update, FALSE);
+		parent_class->add (comm, NULL, jar_list, tmp_dir, update, FALSE);
 
 	fr_process_begin_command (proc, "rm");
 	fr_process_set_working_dir (proc, "/");

Modified: trunk/src/fr-command-lha.c
==============================================================================
--- trunk/src/fr-command-lha.c	(original)
+++ trunk/src/fr-command-lha.c	Mon Jul 21 12:33:40 2008
@@ -226,6 +226,7 @@
 
 static void
 fr_command_lha_add (FrCommand     *comm,
+		    const char    *from_file,
 		    GList         *file_list,
 		    const char    *base_dir,
 		    gboolean       update,
@@ -248,8 +249,9 @@
 
 
 static void
-fr_command_lha_delete (FrCommand *comm,
-		       GList     *file_list)
+fr_command_lha_delete (FrCommand  *comm,
+		       const char *from_file,
+		       GList      *file_list)
 {
 	GList *scan;
 
@@ -264,6 +266,7 @@
 
 static void
 fr_command_lha_extract (FrCommand  *comm,
+			const char *from_file,
 			GList      *file_list,
 			const char *dest_dir,
 			gboolean    overwrite,

Modified: trunk/src/fr-command-rar.c
==============================================================================
--- trunk/src/fr-command-rar.c	(original)
+++ trunk/src/fr-command-rar.c	Mon Jul 21 12:33:40 2008
@@ -286,6 +286,7 @@
 
 static void
 fr_command_rar_add (FrCommand     *comm,
+		    const char    *from_file,
 		    GList         *file_list,
 		    const char    *base_dir,
 		    gboolean       update,
@@ -324,13 +325,14 @@
 	/* disable percentage indicator */
 	fr_process_add_arg (comm->process, "-Idp");
 
-	/* stop switches scanning */
-	fr_process_add_arg (comm->process, "--");
+	if (from_file != NULL)
+		fr_process_add_arg_concat (comm->process, "-n@", from_file, NULL);
 
+	fr_process_add_arg (comm->process, "--");
 	fr_process_add_arg (comm->process, comm->filename);
-
-	for (scan = file_list; scan; scan = scan->next)
-		fr_process_add_arg (comm->process, scan->data);
+	if (from_file == NULL)
+		for (scan = file_list; scan; scan = scan->next)
+			fr_process_add_arg (comm->process, scan->data);
 
 	fr_process_end_command (comm->process);
 }
@@ -358,8 +360,9 @@
 
 
 static void
-fr_command_rar_delete (FrCommand *comm,
-		       GList     *file_list)
+fr_command_rar_delete (FrCommand  *comm,
+		       const char *from_file,
+		       GList      *file_list)
 {
 	GList *scan;
 
@@ -371,13 +374,15 @@
 	fr_process_begin_command (comm->process, "rar");
 	fr_process_add_arg (comm->process, "d");
 
-	/* stop switches scanning */
-	fr_process_add_arg (comm->process, "--");
+	if (from_file != NULL)
+		fr_process_add_arg_concat (comm->process, "-n@", from_file, NULL);
 
+	fr_process_add_arg (comm->process, "--");
 	fr_process_add_arg (comm->process, comm->filename);
+	if (from_file == NULL)
+		for (scan = file_list; scan; scan = scan->next)
+			fr_process_add_arg (comm->process, scan->data);
 
-	for (scan = file_list; scan; scan = scan->next)
-		fr_process_add_arg (comm->process, scan->data);
 	fr_process_end_command (comm->process);
 }
 
@@ -405,6 +410,7 @@
 
 static void
 fr_command_rar_extract (FrCommand  *comm,
+			const char *from_file,
 			GList      *file_list,
 			const char *dest_dir,
 			gboolean    overwrite,
@@ -441,13 +447,14 @@
 	/* disable percentage indicator */
 	fr_process_add_arg (comm->process, "-Idp");
 
-	/* stop switches scanning */
-	fr_process_add_arg (comm->process, "--");
+	if (from_file != NULL)
+		fr_process_add_arg_concat (comm->process, "-n@", from_file, NULL);
 
+	fr_process_add_arg (comm->process, "--");
 	fr_process_add_arg (comm->process, comm->filename);
-
-	for (scan = file_list; scan; scan = scan->next)
-		fr_process_add_arg (comm->process, scan->data);
+	if (from_file == NULL)
+		for (scan = file_list; scan; scan = scan->next)
+			fr_process_add_arg (comm->process, scan->data);
 
 	if (dest_dir != NULL)
 		fr_process_add_arg (comm->process, dest_dir);
@@ -591,6 +598,7 @@
 	comm->propExtractCanJunkPaths      = TRUE;
 	comm->propPassword                 = TRUE;
 	comm->propTest                     = TRUE;
+	comm->propListFromFile             = TRUE;
 }
 
 

Modified: trunk/src/fr-command-rpm.c
==============================================================================
--- trunk/src/fr-command-rpm.c	(original)
+++ trunk/src/fr-command-rpm.c	Mon Jul 21 12:33:40 2008
@@ -168,6 +168,7 @@
 
 static void
 fr_command_rpm_extract (FrCommand  *comm,
+		        const char  *from_file,
 			GList      *file_list,
 			const char *dest_dir,
 			gboolean    overwrite,

Modified: trunk/src/fr-command-tar.c
==============================================================================
--- trunk/src/fr-command-tar.c	(original)
+++ trunk/src/fr-command-tar.c	Mon Jul 21 12:33:40 2008
@@ -289,6 +289,7 @@
 
 static void
 fr_command_tar_add (FrCommand     *comm,
+		    const char    *from_file,
 		    GList         *file_list,
 		    const char    *base_dir,
 		    gboolean       update,
@@ -316,10 +317,17 @@
 
 	fr_process_add_arg (comm->process, "-rf");
 
-	fr_process_add_arg (comm->process, c_tar->uncomp_filename);
+	if (from_file != NULL) {
+		fr_process_add_arg (comm->process, "-T");
+		fr_process_add_arg (comm->process, from_file);
+	}
+
 	fr_process_add_arg (comm->process, "--");
-	for (scan = file_list; scan; scan = scan->next)
-		fr_process_add_arg (comm->process, scan->data);
+	fr_process_add_arg (comm->process, c_tar->uncomp_filename);
+	if (from_file == NULL)
+		for (scan = file_list; scan; scan = scan->next)
+			fr_process_add_arg (comm->process, scan->data);
+
 	fr_process_end_command (comm->process);
 }
 
@@ -342,8 +350,9 @@
 
 
 static void
-fr_command_tar_delete (FrCommand *comm,
-		       GList     *file_list)
+fr_command_tar_delete (FrCommand  *comm,
+		       const char *from_file,
+		       GList      *file_list)
 {
 	FrCommandTar *c_tar = FR_COMMAND_TAR (comm);
 	GList        *scan;
@@ -359,11 +368,18 @@
 	fr_process_add_arg (comm->process, "-v");
 	fr_process_add_arg (comm->process, "--delete");
 	fr_process_add_arg (comm->process, "-f");
-	fr_process_add_arg (comm->process, c_tar->uncomp_filename);
+
+	if (from_file != NULL) {
+		fr_process_add_arg (comm->process, "-T");
+		fr_process_add_arg (comm->process, from_file);
+	}
 
 	fr_process_add_arg (comm->process, "--");
-	for (scan = file_list; scan; scan = scan->next)
-		fr_process_add_arg (comm->process, scan->data);
+	fr_process_add_arg (comm->process, c_tar->uncomp_filename);
+	if (from_file == NULL)
+		for (scan = file_list; scan; scan = scan->next)
+			fr_process_add_arg (comm->process, scan->data);
+
 	fr_process_end_command (comm->process);
 }
 
@@ -378,6 +394,7 @@
 
 static void
 fr_command_tar_extract (FrCommand  *comm,
+		        const char *from_file,
 			GList      *file_list,
 			const char *dest_dir,
 			gboolean    overwrite,
@@ -402,7 +419,6 @@
 		fr_process_add_arg (comm->process, "--keep-newer-files");
 
 	fr_process_add_arg (comm->process, "-xf");
-	fr_process_add_arg (comm->process, comm->filename);
 	add_compress_arg (comm);
 
 	if (dest_dir != NULL) {
@@ -410,9 +426,16 @@
 		fr_process_add_arg (comm->process, dest_dir);
 	}
 
+	if (from_file != NULL) {
+		fr_process_add_arg (comm->process, "-T");
+		fr_process_add_arg (comm->process, from_file);
+	}
+
 	fr_process_add_arg (comm->process, "--");
-	for (scan = file_list; scan; scan = scan->next)
-		fr_process_add_arg (comm->process, scan->data);
+	fr_process_add_arg (comm->process, comm->filename);
+	if (from_file == NULL)
+		for (scan = file_list; scan; scan = scan->next)
+			fr_process_add_arg (comm->process, scan->data);
 
 	fr_process_end_command (comm->process);
 }
@@ -920,6 +943,7 @@
 	comm->propTest                      = FALSE;
 	comm->propCanDeleteNonEmptyFolders  = FALSE;
 	comm->propCanExtractNonEmptyFolders = FALSE;
+	comm->propListFromFile              = TRUE;
 
 	comm_tar->msg = NULL;
 	comm_tar->uncomp_filename = NULL;

Modified: trunk/src/fr-command-unstuff.c
==============================================================================
--- trunk/src/fr-command-unstuff.c	(original)
+++ trunk/src/fr-command-unstuff.c	Mon Jul 21 12:33:40 2008
@@ -213,6 +213,7 @@
 
 static void
 fr_command_unstuff_extract (FrCommand  *comm,
+			    const char  *from_file,
 			    GList      *file_list,
 			    const char *dest_dir,
 			    gboolean    overwrite,

Modified: trunk/src/fr-command-zip.c
==============================================================================
--- trunk/src/fr-command-zip.c	(original)
+++ trunk/src/fr-command-zip.c	Mon Jul 21 12:33:40 2008
@@ -209,6 +209,7 @@
 
 static void
 fr_command_zip_add (FrCommand     *comm,
+		    const char    *from_file,
 		    GList         *file_list,
 		    const char    *base_dir,
 		    gboolean       update,
@@ -245,7 +246,6 @@
 	}
 
 	fr_process_add_arg (comm->process, comm->filename);
-
 	for (scan = file_list; scan; scan = scan->next)
 		fr_process_add_arg (comm->process, scan->data);
 
@@ -254,8 +254,9 @@
 
 
 static void
-fr_command_zip_delete (FrCommand *comm,
-		       GList     *file_list)
+fr_command_zip_delete (FrCommand  *comm,
+		       const char *from_file,
+		       GList      *file_list)
 {
 	GList *scan;
 
@@ -265,8 +266,8 @@
 
 	fr_process_begin_command (comm->process, "zip");
 	fr_process_add_arg (comm->process, "-d");
-	fr_process_add_arg (comm->process, comm->filename);
 
+	fr_process_add_arg (comm->process, comm->filename);
 	for (scan = file_list; scan; scan = scan->next)
 		fr_process_add_arg (comm->process, scan->data);
 
@@ -276,6 +277,7 @@
 
 static void
 fr_command_zip_extract (FrCommand  *comm,
+			const char *from_file,
 			GList      *file_list,
 			const char *dest_dir,
 			gboolean    overwrite,
@@ -303,8 +305,8 @@
 	if (junk_paths)
 		fr_process_add_arg (comm->process, "-j");
 	add_password_arg (comm, comm->password);
-	fr_process_add_arg (comm->process, comm->filename);
 
+	fr_process_add_arg (comm->process, comm->filename);
 	for (scan = file_list; scan; scan = scan->next)
 		fr_process_add_arg (comm->process, scan->data);
 

Modified: trunk/src/fr-command-zoo.c
==============================================================================
--- trunk/src/fr-command-zoo.c	(original)
+++ trunk/src/fr-command-zoo.c	Mon Jul 21 12:33:40 2008
@@ -236,6 +236,7 @@
 
 static void
 fr_command_zoo_add (FrCommand     *comm,
+		    const char    *from_file,
 		    GList         *file_list,
 		    const char    *base_dir,
 		    gboolean       update,
@@ -264,6 +265,7 @@
 
 static void
 fr_command_zoo_delete (FrCommand *comm,
+		       const char  *from_file,
 		       GList     *file_list)
 {
 	GList        *scan;
@@ -282,6 +284,7 @@
 
 static void
 fr_command_zoo_extract (FrCommand  *comm,
+			const char  *from_file,
 			GList      *file_list,
 			const char *dest_dir,
 			gboolean    overwrite,

Modified: trunk/src/fr-command.c
==============================================================================
--- trunk/src/fr-command.c	(original)
+++ trunk/src/fr-command.c	Mon Jul 21 12:33:40 2008
@@ -114,6 +114,7 @@
 
 static void
 base_fr_command_add (FrCommand     *comm,
+		     const char    *from_file,
 		     GList         *file_list,
 		     const char    *base_dir,
 		     gboolean       update,
@@ -123,14 +124,16 @@
 
 
 static void
-base_fr_command_delete (FrCommand *comm,
-			GList     *file_list)
+base_fr_command_delete (FrCommand  *comm,
+		        const char *from_file,
+			GList       *file_list)
 {
 }
 
 
 static void
 base_fr_command_extract (FrCommand  *comm,
+		         const char *from_file,
 			 GList      *file_list,
 			 const char *dest_dir,
 			 gboolean    overwrite,
@@ -586,6 +589,7 @@
 
 void
 fr_command_add (FrCommand     *comm,
+		const char    *from_file,
 		GList         *file_list,
 		const char    *base_dir,
 		gboolean       update,
@@ -598,6 +602,7 @@
 	fr_process_set_err_line_func (FR_COMMAND (comm)->process, NULL, NULL);
 
 	FR_COMMAND_GET_CLASS (G_OBJECT (comm))->add (comm,
+						     from_file,
 						     file_list,
 						     base_dir,
 						     update,
@@ -606,8 +611,9 @@
 
 
 void
-fr_command_delete (FrCommand *comm,
-		   GList     *file_list)
+fr_command_delete (FrCommand   *comm,
+		   const char  *from_file,
+		   GList       *file_list)
 {
 	fr_command_progress (comm, -1.0);
 
@@ -615,12 +621,13 @@
 	fr_process_set_out_line_func (FR_COMMAND (comm)->process, NULL, NULL);
 	fr_process_set_err_line_func (FR_COMMAND (comm)->process, NULL, NULL);
 
-	FR_COMMAND_GET_CLASS (G_OBJECT (comm))->delete (comm, file_list);
+	FR_COMMAND_GET_CLASS (G_OBJECT (comm))->delete (comm, from_file, file_list);
 }
 
 
 void
 fr_command_extract (FrCommand  *comm,
+		    const char *from_file,
 		    GList      *file_list,
 		    const char *dest_dir,
 		    gboolean    overwrite,
@@ -634,6 +641,7 @@
 	fr_process_set_err_line_func (FR_COMMAND (comm)->process, NULL, NULL);
 
 	FR_COMMAND_GET_CLASS (G_OBJECT (comm))->extract (comm,
+							 from_file,
 							 file_list,
 							 dest_dir,
 							 overwrite,

Modified: trunk/src/fr-command.h
==============================================================================
--- trunk/src/fr-command.h	(original)
+++ trunk/src/fr-command.h	Mon Jul 21 12:33:40 2008
@@ -97,6 +97,7 @@
 	guint          propCanExtractAll : 1;
 	guint          propCanDeleteNonEmptyFolders : 1;
 	guint          propCanExtractNonEmptyFolders : 1;
+	guint          propListFromFile : 1;
 
 	/*<private>*/
 
@@ -119,13 +120,16 @@
 
 	void          (*list)             (FrCommand     *comm);
 	void          (*add)              (FrCommand     *comm,
+					   const char    *from_file,
 				           GList         *file_list,
 				           const char    *base_dir,
 				           gboolean       update,
 				           gboolean       recursive);
 	void          (*delete)           (FrCommand     *comm,
+			                   const char    *from_file,
 				           GList         *file_list);
 	void          (*extract)          (FrCommand     *comm,
+			                   const char    *from_file,
 				           GList         *file_list,
 				           const char    *dest_dir,
 				           gboolean       overwrite,
@@ -162,13 +166,16 @@
 					       const char    *filename);
 void           fr_command_list                (FrCommand     *comm);
 void           fr_command_add                 (FrCommand     *comm,
+					       const char    *from_file,
 					       GList         *file_list,
 					       const char    *base_dir,
 					       gboolean       update,
 					       gboolean       recursive);
 void           fr_command_delete              (FrCommand     *comm,
+					       const char    *from_file,
 					       GList         *file_list);
 void           fr_command_extract             (FrCommand     *comm,
+					       const char    *from_file,
 					       GList         *file_list,
 					       const char    *dest_dir,
 					       gboolean       overwrite,

Modified: trunk/src/fr-window.c
==============================================================================
--- trunk/src/fr-window.c	(original)
+++ trunk/src/fr-window.c	Mon Jul 21 12:33:40 2008
@@ -63,11 +63,11 @@
 #define CHECK_CLIPBOARD_TIMEOUT 500
 
 #define PROGRESS_DIALOG_DEFAULT_WIDTH 400
-#define PROGRESS_TIMEOUT_MSECS 5000     /* FIXME */
+#define PROGRESS_TIMEOUT_MSECS 5000
 #define PROGRESS_BAR_HEIGHT 10
-#define LOG_PROGRESS 0
+#undef  LOG_PROGRESS
 
-#define HIDE_PROGRESS_TIMEOUT_MSECS 500 /* FIXME */
+#define HIDE_PROGRESS_TIMEOUT_MSECS 500
 #define DEFAULT_NAME_COLUMN_WIDTH 250
 #define OTHER_COLUMNS_WIDTH 100
 #define RECENT_ITEM_MAX_WIDTH 25



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