summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/fr-command-7z.c17
-rw-r--r--src/fr-window.c28
-rw-r--r--src/fr-window.h1
3 files changed, 45 insertions, 1 deletions
diff --git a/src/fr-command-7z.c b/src/fr-command-7z.c
index c3c66ab..4c5b03a 100644
--- a/src/fr-command-7z.c
+++ b/src/fr-command-7z.c
@@ -394,12 +394,29 @@ fr_command_7z_add (FrCommand *comm,
}
static void
+process_line__delete (char *line,
+ gpointer data)
+{
+ FrCommand *comm = FR_COMMAND (data);
+
+ if ((strstr (line, "Wrong password?") != NULL)
+ || (strstr (line, "Enter password") != NULL))
+ {
+ password_required = TRUE;
+ }
+}
+
+static void
fr_command_7z_delete (FrCommand *comm,
const char *from_file,
GList *file_list)
{
GList *scan;
+ fr_process_set_out_line_func (comm->process,
+ process_line__delete,
+ comm);
+
fr_command_7z_begin_command (comm);
fr_process_add_arg (comm->process, "d");
if (spd_support) fr_process_add_arg (comm->process, "-spd");
diff --git a/src/fr-window.c b/src/fr-window.c
index 3c71431..8061a39 100644
--- a/src/fr-window.c
+++ b/src/fr-window.c
@@ -6317,14 +6317,34 @@ fr_window_archive_add_dropped_items (FrWindow *window,
window->priv->volume_size);
}
+static void
+remove_data_free (GList *rdata)
+{
+ g_list_free_full(rdata, g_free);
+}
+
void
fr_window_archive_remove (FrWindow *window,
GList *file_list)
{
+ char *password;
+ GList *remove_list;
+
fr_window_clipboard_remove_file_list (window, file_list);
fr_process_clear (window->archive->process);
- fr_archive_remove (window->archive, file_list, window->priv->compression);
+
+ remove_list = g_list_copy_deep (file_list, (GCopyFunc) g_strdup, NULL);
+ fr_window_set_current_batch_action (window,
+ FR_BATCH_ACTION_DELETE,
+ remove_list,
+ (GFreeFunc) remove_data_free);
+
+ password = window->priv->password;
+ if (password != NULL && password[0] != '\0')
+ g_object_set (window->archive->command, "password", password, NULL);
+
+ fr_archive_remove (window->archive, remove_list, window->priv->compression);
fr_process_start (window->archive->process);
}
@@ -8529,6 +8549,12 @@ fr_window_exec_batch_action (FrWindow *window,
fr_window_archive_add_dropped_items (window, (GList*) action->data, FALSE);
break;
+ case FR_BATCH_ACTION_DELETE:
+ debug (DEBUG_INFO, "[BATCH] DELETE\n");
+
+ fr_window_archive_remove (window, (GList*) action->data);
+ break;
+
case FR_BATCH_ACTION_OPEN:
debug (DEBUG_INFO, "[BATCH] OPEN\n");
diff --git a/src/fr-window.h b/src/fr-window.h
index 23ecaa0..5606dfe 100644
--- a/src/fr-window.h
+++ b/src/fr-window.h
@@ -53,6 +53,7 @@ typedef enum {
FR_BATCH_ACTION_LOAD,
FR_BATCH_ACTION_OPEN,
FR_BATCH_ACTION_ADD,
+ FR_BATCH_ACTION_DELETE,
FR_BATCH_ACTION_EXTRACT,
FR_BATCH_ACTION_EXTRACT_HERE,
FR_BATCH_ACTION_EXTRACT_INTERACT,