summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZenWalker <[email protected]>2017-05-02 20:15:58 +0200
committerZenWalker <[email protected]>2017-05-02 20:15:58 +0200
commitdff9db3296b4d0e7711271f429a70c7340a68e85 (patch)
tree8ccb84b8e42ea63df61428f722f2adb2b3bac649
parentdfc3401d081a43fbbc97852bb60ecefd7759cd4c (diff)
downloadengrampa-dff9db3296b4d0e7711271f429a70c7340a68e85.tar.bz2
engrampa-dff9db3296b4d0e7711271f429a70c7340a68e85.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 5ca24f4..50af191 100644
--- a/src/fr-window.c
+++ b/src/fr-window.c
@@ -3525,6 +3525,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)
{
@@ -6658,6 +6676,7 @@ typedef struct {
FrWindow *window;
ExtractData *edata;
GList *current_file;
+ gboolean extract_all;
} OverwriteData;
@@ -6712,6 +6731,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;
@@ -6739,8 +6759,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;
@@ -6811,14 +6829,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);
}
@@ -6935,6 +6971,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);
}