[file-roller] ask for the password as soon as possible



commit 96e68a82c20743baef464fcb849d6853126373ec
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Sun Jul 26 09:34:31 2009 +0200

    ask for the password as soon as possible
    
    if the archive is encrypted, ask the password before trying to
    extract the files.
    
    [fixed bug #392994]

 src/fr-window.c |   26 ++++++++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/src/fr-window.c b/src/fr-window.c
index cd5270a..08cc221 100644
--- a/src/fr-window.c
+++ b/src/fr-window.c
@@ -6437,6 +6437,22 @@ extract_data_free (ExtractData *edata)
 }
 
 
+static gboolean
+archive_is_encrypted (FrWindow *window)
+{
+	int i;
+
+	for (i = 0; i < window->archive->command->files->len; i++) {
+		FileData *fdata = g_ptr_array_index (window->archive->command->files, i);
+
+		if (fdata->encrypted)
+			return TRUE;
+	}
+
+	return FALSE;
+}
+
+
 void
 fr_window_archive_extract_here (FrWindow   *window,
 				gboolean    skip_older,
@@ -6457,6 +6473,11 @@ fr_window_archive_extract_here (FrWindow   *window,
 					    edata,
 					    (GFreeFunc) extract_data_free);
 
+	if (archive_is_encrypted (window) && (window->priv->password == NULL)) {
+		dlg_ask_password (window);
+		return;
+	}
+
 	window->priv->ask_to_open_destination_after_extraction = FALSE;
 
 	fr_process_clear (window->archive->process);
@@ -6498,6 +6519,11 @@ fr_window_archive_extract (FrWindow   *window,
 					    edata,
 					    (GFreeFunc) extract_data_free);
 
+	if (archive_is_encrypted (window) && (window->priv->password == NULL)) {
+		dlg_ask_password (window);
+		return;
+	}
+
 	if (! uri_is_dir (edata->extract_to_dir)) {
 		if (! ForceDirectoryCreation) {
 			GtkWidget *d;



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