diff options
author | Ondrej Holy <oholy@redhat.com> | 2021-04-21 09:41:01 +0200 |
---|---|---|
committer | António Fernandes <antoniojpfernandes@gmail.com> | 2021-04-22 11:39:25 +0000 |
commit | 17e1cd13d5f1ae6834fa87e57f5379d151553854 (patch) | |
tree | 1c35632dc6155c7108dda84561cef0f8f514c4ea | |
parent | baf799dac2bb3c146012cabb4f000f5b594f53c4 (diff) | |
download | nautilus-17e1cd13d5f1ae6834fa87e57f5379d151553854.tar.gz |
file-operations: Return NULL if password dialog was cancelled
Currently, an empty string is passed to gnome-autoar if the archive
extraction password dialog is cancelled. This is not problem currently
as immediately the `abort_job` function is called, however, it would
be nice to return `NULL` to make obvious that the prompt dialog was
cancelled.
https://gitlab.gnome.org/GNOME/nautilus/-/merge_requests/657#note_1084750
-rw-r--r-- | src/nautilus-file-operations.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/nautilus-file-operations.c b/src/nautilus-file-operations.c index 09424b139..59beecd7e 100644 --- a/src/nautilus-file-operations.c +++ b/src/nautilus-file-operations.c @@ -8372,6 +8372,7 @@ typedef struct GtkWidget *passphrase_entry; GMutex mutex; GCond cond; + gboolean completed; } PassphraseRequestData; static void @@ -8386,8 +8387,12 @@ on_request_passphrase_cb (GtkDialog *dialog, { abort_job ((CommonJob *) data->extract_job); } + else + { + data->passphrase = g_strdup (gtk_entry_get_text (GTK_ENTRY (data->passphrase_entry))); + } - data->passphrase = g_strdup (gtk_entry_get_text (GTK_ENTRY (data->passphrase_entry))); + data->completed = TRUE; gtk_widget_destroy (GTK_WIDGET (dialog)); @@ -8467,7 +8472,7 @@ extract_job_on_request_passphrase (AutoarExtractor *extractor, run_passphrase_dialog, data); - while (data->passphrase == NULL) + while (!data->completed) { g_cond_wait (&data->cond, &data->mutex); } |