summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZenWalker <[email protected]>2017-05-02 20:15:58 +0200
committerraveit65 <[email protected]>2017-05-06 12:14:16 +0200
commit2746378c0b49c76080bc2f9aa446ceab3b5d2e15 (patch)
tree79184db5c8ae30ac85552e06c459f80d818dd9c6
parent1bc0be80c2a8ec2cb3ffbe1b940db1314eeb3db2 (diff)
downloadengrampa-2746378c0b49c76080bc2f9aa446ceab3b5d2e15.tar.bz2
engrampa-2746378c0b49c76080bc2f9aa446ceab3b5d2e15.tar.xz
Fix: Wrong behavior of Skip button in Replace file dialog
based in file-roller commit: https://git.gnome.org/browse/file-roller/commit/?id=fe71357aa128d029b6ca4a9493b8a408c8aaf017 Fixes #161
-rw-r--r--src/fr-window.c55
1 files changed, 47 insertions, 8 deletions
diff --git a/src/fr-window.c b/src/fr-window.c
index 48d748f..d189547 100644
--- a/src/fr-window.c
+++ b/src/fr-window.c
@@ -3523,6 +3523,24 @@ fr_window_get_file_list_pattern (FrWindow *window,
}
+static GList *
+fr_window_get_file_list (FrWindow *window)
+{
+ GList *list;
+ int i;
+
+ g_return_val_if_fail (window != NULL, NULL);
+
+ list = NULL;
+ for (i = 0; i < window->archive->command->files->len; i++) {
+ FileData *fd = g_ptr_array_index (window->archive->command->files, i);
+ list = g_list_prepend (list, g_strdup (fd->original_path));
+ }
+
+ return g_list_reverse (list);
+}
+
+
int
fr_window_get_n_selected_files (FrWindow *window)
{
@@ -6654,6 +6672,7 @@ typedef struct {
FrWindow *window;
ExtractData *edata;
GList *current_file;
+ gboolean extract_all;
} OverwriteData;
@@ -6708,6 +6727,7 @@ overwrite_dialog_response_cb (GtkDialog *dialog,
odata->edata->file_list = g_list_remove_link (odata->edata->file_list, odata->current_file);
path_list_free (odata->current_file);
odata->current_file = next;
+ odata->extract_all = FALSE;
}
break;
@@ -6735,8 +6755,6 @@ overwrite_dialog_response_cb (GtkDialog *dialog,
static void
_fr_window_ask_overwrite_dialog (OverwriteData *odata)
{
- gboolean do_not_extract = FALSE;
-
while ((odata->edata->overwrite == FR_OVERWRITE_ASK) && (odata->current_file != NULL)) {
const char *base_name;
char *e_base_name;
@@ -6807,14 +6825,32 @@ _fr_window_ask_overwrite_dialog (OverwriteData *odata)
g_object_unref (file);
}
- if (do_not_extract) {
- fr_window_stop_batch (odata->window);
- g_free (odata);
- return;
+ if (odata->edata->file_list != NULL) {
+ /* speed optimization: passing NULL when extracting all the
+ * files is faster if the command supports the
+ * propCanExtractAll property. */
+ if (odata->extract_all) {
+ path_list_free (odata->edata->file_list);
+ odata->edata->file_list = NULL;
+ }
+ odata->edata->overwrite = FR_OVERWRITE_YES;
+ _fr_window_archive_extract_from_edata (odata->window, odata->edata);
}
+ else {
+ GtkWidget *d;
- odata->edata->overwrite = FR_OVERWRITE_YES;
- _fr_window_archive_extract_from_edata (odata->window, odata->edata);
+ d = _gtk_message_dialog_new (GTK_WINDOW (odata->window),
+ 0,
+ GTK_STOCK_DIALOG_WARNING,
+ _("Extraction not performed"),
+ NULL,
+ GTK_STOCK_OK, GTK_RESPONSE_OK,
+ NULL);
+ gtk_dialog_set_default_response (GTK_DIALOG (d), GTK_RESPONSE_OK);
+ fr_window_show_error_dialog (odata->window, d, GTK_WINDOW (odata->window), _("Extraction not performed"));
+
+ fr_window_stop_batch (odata->window);
+ }
g_free (odata);
}
@@ -6931,6 +6967,9 @@ fr_window_archive_extract (FrWindow *window,
odata = g_new0 (OverwriteData, 1);
odata->window = window;
odata->edata = edata;
+ odata->extract_all = (edata->file_list == NULL) || (g_list_length (edata->file_list) == window->archive->command->files->len);
+ if (edata->file_list == NULL)
+ edata->file_list = fr_window_get_file_list (window);
odata->current_file = odata->edata->file_list;
_fr_window_ask_overwrite_dialog (odata);
}