[file-roller] added a special case for encrypted multivolume 7z archives



commit f76214b236e740c162e10d9152917aa37f64418d
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Mon Jun 15 21:06:09 2009 +0200

    added a special case for encrypted multivolume 7z archives
    
    GNOME Bug #582712

 src/actions.c       |    4 ++--
 src/fr-command-7z.c |   25 +++++++++++++++++++++++++
 src/fr-command.c    |    7 +++----
 3 files changed, 30 insertions(+), 6 deletions(-)
---
diff --git a/src/actions.c b/src/actions.c
index d46a66f..7507f39 100644
--- a/src/actions.c
+++ b/src/actions.c
@@ -156,7 +156,7 @@ get_archive_filename_from_selector (DlgNewData *data)
 						GTK_DIALOG_DESTROY_WITH_PARENT,
 						NULL,
 						_("Could not create the archive"),
-						"%s", 
+						"%s",
 						_("You have to specify an archive name."));
 		gtk_dialog_run (GTK_DIALOG (dialog));
 		gtk_widget_destroy (GTK_WIDGET (dialog));
@@ -247,7 +247,7 @@ get_archive_filename_from_selector (DlgNewData *data)
 							GTK_DIALOG_DESTROY_WITH_PARENT,
 							NULL,
 							_("Could not delete the old archive."),
-							"%s", 
+							"%s",
 							err->message);
 			gtk_dialog_run (GTK_DIALOG (dialog));
 			gtk_widget_destroy (GTK_WIDGET (dialog));
diff --git a/src/fr-command-7z.c b/src/fr-command-7z.c
index 192c38f..b1cb445 100644
--- a/src/fr-command-7z.c
+++ b/src/fr-command-7z.c
@@ -464,6 +464,31 @@ static void
 fr_command_7z_handle_error (FrCommand   *comm,
 			    FrProcError *error)
 {
+	if (error->type == FR_PROC_ERROR_NONE) {
+		FileData *first;
+		char     *basename;
+		char     *testname;
+
+		/* This is a way to fix bug #582712. */
+
+		if (comm->files->len != 1)
+			return;
+		if (! g_str_has_suffix (comm->filename, ".001"))
+			return;
+
+		first = g_ptr_array_index (comm->files, 0);
+		basename = g_path_get_basename (comm->filename);
+		testname = g_strconcat (first->original_path, ".001", NULL);
+
+		if (strcmp (basename, testname) == 0)
+			error->type = FR_PROC_ERROR_ASK_PASSWORD;
+
+		g_free (testname);
+		g_free (basename);
+
+		return;
+	}
+
 	if (error->type != FR_PROC_ERROR_COMMAND_ERROR)
 		return;
 
diff --git a/src/fr-command.c b/src/fr-command.c
index 30cc59e..b006c5e 100644
--- a/src/fr-command.c
+++ b/src/fr-command.c
@@ -215,19 +215,18 @@ fr_command_done (FrProcess   *process,
 	FrCommand *comm = FR_COMMAND (data);
 
 	comm->process->restart = FALSE;
-	if (process->error.type != FR_PROC_ERROR_NONE)
-		fr_command_handle_error (comm, &process->error);
+	fr_command_handle_error (comm, &process->error);
 
 	if (comm->process->restart) {
 		fr_process_start (comm->process);
 		return;
 	}
-	
+
 	if (comm->action == FR_ACTION_LISTING_CONTENT) {
 		/* order the list by name to speed up search */
 		g_ptr_array_sort (comm->files, file_data_compare_by_path);
 	}
-	
+
 	g_signal_emit (G_OBJECT (comm),
 		       fr_command_signals[DONE],
 		       0,



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