file-roller r2372 - in trunk: . src



Author: paobac
Date: Sun Jul 20 18:46:53 2008
New Revision: 2372
URL: http://svn.gnome.org/viewvc/file-roller?rev=2372&view=rev

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

	* TODO: updated.
	
	* src/fr-command-7z.c: add a -- to signal the end of the switches.
	Implemented extact progress to add and extract.
	Part of the bug #153281 â Progress bar should be exact
	
	* src/fr-archive.c: do not add the backup files, that is files ending 
	with ~,	to the archive. 


Modified:
   trunk/ChangeLog
   trunk/TODO
   trunk/src/fr-archive.c
   trunk/src/fr-command-7z.c
   trunk/src/fr-window.c

Modified: trunk/TODO
==============================================================================
--- trunk/TODO	(original)
+++ trunk/TODO	Sun Jul 20 18:46:53 2008
@@ -14,9 +14,9 @@
 
 [ ] #153281 â Progress bar should be exact
 
-[ ] #504584 â Incorrect comportment when extracting multi part rar files
+[x] #504584 â Incorrect comportment when extracting multi part rar files
 
-[ ] LP:#186921 â Asking for password with missing archive volume
+[x] LP:#186921 â Asking for password with missing archive volume
 
 [ ] #543225 â File-Roller is unable to open gzip-compressed files like pci.ids if they are missing an .gz extension
 

Modified: trunk/src/fr-archive.c
==============================================================================
--- trunk/src/fr-archive.c	(original)
+++ trunk/src/fr-archive.c	Sun Jul 20 18:46:53 2008
@@ -158,7 +158,7 @@
 #define MAX_CHUNK_LEN (NCARGS * 2 / 3) /* Max command line length */
 #define UNKNOWN_TYPE "application/octet-stream"
 #define SAME_FS (FALSE)
-#define NO_BACKUP_FILES (FALSE)
+#define NO_BACKUP_FILES (TRUE)
 #define NO_DOT_FILES (FALSE)
 #define IGNORE_CASE (FALSE)
 

Modified: trunk/src/fr-command-7z.c
==============================================================================
--- trunk/src/fr-command-7z.c	(original)
+++ trunk/src/fr-command-7z.c	Sun Jul 20 18:46:53 2008
@@ -20,12 +20,14 @@
  *  Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
  */
 
+#include <stdio.h>
 #include <config.h>
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
 
 #include <glib.h>
+#include <glib/gi18n.h>
 
 #include "file-data.h"
 #include "file-utils.h"
@@ -80,25 +82,6 @@
 	return mktime (&tm);
 }
 
-/*
-static void
-change_to_unix_dir_separator (char *path)
-{
-	char *c;
-
-	for (c = path; *c != 0; c++)
-		if ((*c == '\\') && (*(c+1) != '\\'))
-			*c = '/';
-}
-
-
-static char*
-to_dos (const char *path)
-{
-	return str_substitute (path, "/", "\\\\");
-}
-*/
-
 
 static void
 list__process_line (char     *line,
@@ -225,6 +208,7 @@
 	fr_process_add_arg (comm->process, "-bd");
 	fr_process_add_arg (comm->process, "-y");
 	add_password_arg (comm, comm->password, FALSE);
+	fr_process_add_arg (comm->process, "--");
 	fr_process_add_arg (comm->process, comm->filename);
 	fr_process_end_command (comm->process);
 
@@ -238,6 +222,43 @@
 }
 
 
+static char Progress_Message[4196];
+static char Progress_Filename[4096];
+
+
+static void
+parse_progress_line (FrCommand  *comm,
+		     const char *prefix,
+		     const char *message_prefix,
+		     const char *line)
+{
+	int prefix_len;
+
+	prefix_len = strlen (prefix);
+	if (strncmp (line, prefix, prefix_len) == 0) {
+		double fraction;
+
+		strcpy (Progress_Filename, line + prefix_len);
+		sprintf (Progress_Message, "%s%s", message_prefix, file_name_from_path (Progress_Filename));
+		fr_command_message (comm, Progress_Message);
+
+		fraction= (double) ++comm->n_file / (comm->n_files + 1);
+		fr_command_progress (comm, fraction);
+	}
+}
+
+
+static void
+process_line__add (char     *line,
+		   gpointer  data)
+{
+	FrCommand *comm = FR_COMMAND (data);
+
+	if (comm->n_files != 0)
+		parse_progress_line (comm, "Compressing  ", _("Adding file: "), line);
+}
+
+
 static void
 fr_command_7z_add (FrCommand     *comm,
 		   GList         *file_list,
@@ -247,6 +268,11 @@
 {
 	GList *scan;
 
+	fr_process_use_standard_locale (comm->process, TRUE);
+	fr_process_set_out_line_func (comm->process,
+				      process_line__add,
+				      comm);
+
 	fr_command_7z_begin_command (comm);
 
 	if (update)
@@ -268,6 +294,7 @@
 	add_password_arg (comm, comm->password, FALSE);
 	if ((comm->password != NULL) && (*comm->password != 0) && comm->encrypt_header)
 		fr_process_add_arg (comm->process, "-mhe=on");
+	/* fr_process_add_arg (comm->process, "-ms=off"); FIXME: solid mode off? */
 
 	switch (comm->compression) {
 	case FR_COMPRESSION_VERY_FAST:
@@ -283,6 +310,7 @@
 	if (is_mime_type (comm->mime_type, "application/x-executable"))
 		fr_process_add_arg (comm->process, "-sfx");
 
+	fr_process_add_arg (comm->process, "--");
 	fr_process_add_arg (comm->process, comm->filename);
 
 	for (scan = file_list; scan; scan = scan->next) {
@@ -304,20 +332,33 @@
 	fr_process_add_arg (comm->process, "d");
 	fr_process_add_arg (comm->process, "-bd");
 	fr_process_add_arg (comm->process, "-y");
-
 	if (is_mime_type (comm->mime_type, "application/x-executable"))
 		fr_process_add_arg (comm->process, "-sfx");
 
+	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);
+	for (scan = file_list; scan; scan = scan->next) {
+		char *filename = scan->data;
+		fr_process_add_arg (comm->process, filename);
+	}
 
 	fr_process_end_command (comm->process);
 }
 
 
 static void
+process_line__extract (char     *line,
+		       gpointer  data)
+{
+	FrCommand *comm = FR_COMMAND (data);
+
+	if (comm->n_files != 0)
+		parse_progress_line (comm, "Extracting  ", _("Extracting file: "), line);
+}
+
+
+static void
 fr_command_7z_extract (FrCommand  *comm,
 		       GList      *file_list,
 		       const char *dest_dir,
@@ -327,6 +368,10 @@
 {
 	GList *scan;
 
+	fr_process_use_standard_locale (comm->process, TRUE);
+	fr_process_set_out_line_func (comm->process,
+				      process_line__extract,
+				      comm);
 	fr_command_7z_begin_command (comm);
 
 	if (junk_paths)
@@ -341,6 +386,7 @@
 	if (dest_dir != NULL)
 		fr_process_add_arg_concat (comm->process, "-o", dest_dir, NULL);
 
+	fr_process_add_arg (comm->process, "--");
 	fr_process_add_arg (comm->process, comm->filename);
 
 	for (scan = file_list; scan; scan = scan->next)
@@ -358,6 +404,7 @@
 	fr_process_add_arg (comm->process, "-bd");
 	fr_process_add_arg (comm->process, "-y");
 	add_password_arg (comm, comm->password, FALSE);
+	fr_process_add_arg (comm->process, "--");
 	fr_process_add_arg (comm->process, comm->filename);
 	fr_process_end_command (comm->process);
 }

Modified: trunk/src/fr-window.c
==============================================================================
--- trunk/src/fr-window.c	(original)
+++ trunk/src/fr-window.c	Sun Jul 20 18:46:53 2008
@@ -65,6 +65,7 @@
 #define PROGRESS_DIALOG_DEFAULT_WIDTH 400
 #define PROGRESS_TIMEOUT_MSECS 5000     /* FIXME */
 #define PROGRESS_BAR_HEIGHT 10
+#define LOG_PROGRESS 0
 
 #define HIDE_PROGRESS_TIMEOUT_MSECS 500 /* FIXME */
 #define DEFAULT_NAME_COLUMN_WIDTH 250



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