[gthumb: 32/57] allow to cancel the whole copy from the overwrite dialog
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb: 32/57] allow to cancel the whole copy from the overwrite dialog
- Date: Sun, 20 Jun 2010 16:24:26 +0000 (UTC)
commit 30c5e99e8d10670c75c2c1aa75e16b90d12c721e
Author: Paolo Bacchilega <paobac src gnome org>
Date: Tue Jun 15 13:24:53 2010 +0200
allow to cancel the whole copy from the overwrite dialog
clicking on the cancel button in the overwrite dialog the whole copy operation is cancelled not just the overwrite operation.
extensions/rename_series/gth-rename-task.c | 11 ++++++++++-
extensions/webalbums/gth-web-exporter.c | 2 +-
gthumb/gio-utils.c | 15 +++++++++++----
gthumb/gth-browser.c | 2 +-
gthumb/gth-overwrite-dialog.h | 3 ++-
gthumb/gth-pixbuf-list-task.c | 11 ++++++++++-
6 files changed, 35 insertions(+), 9 deletions(-)
---
diff --git a/extensions/rename_series/gth-rename-task.c b/extensions/rename_series/gth-rename-task.c
index 1ecd104..f5919c0 100644
--- a/extensions/rename_series/gth-rename-task.c
+++ b/extensions/rename_series/gth-rename-task.c
@@ -87,7 +87,7 @@ overwrite_dialog_response_cb (GtkDialog *dialog,
GthRenameTask *self = user_data;
if (response_id != GTK_RESPONSE_OK)
- self->priv->default_response = GTH_OVERWRITE_RESPONSE_UNSPECIFIED;
+ self->priv->default_response = GTH_OVERWRITE_RESPONSE_CANCEL;
else
self->priv->default_response = gth_overwrite_dialog_get_response (GTH_OVERWRITE_DIALOG (dialog));
@@ -121,6 +121,15 @@ overwrite_dialog_response_cb (GtkDialog *dialog,
g_object_unref (parent);
}
break;
+
+ case GTH_OVERWRITE_RESPONSE_CANCEL:
+ {
+ GError *error;
+
+ error = g_error_new_literal (GTH_TASK_ERROR, GTH_TASK_ERROR_CANCELLED, "");
+ gth_task_completed (GTH_TASK (self), error);
+ }
+ break;
}
gtk_widget_destroy (GTK_WIDGET (dialog));
diff --git a/extensions/webalbums/gth-web-exporter.c b/extensions/webalbums/gth-web-exporter.c
index 9daf2c4..02c2f58 100644
--- a/extensions/webalbums/gth-web-exporter.c
+++ b/extensions/webalbums/gth-web-exporter.c
@@ -2106,7 +2106,7 @@ load_next_file (GthWebExporter *self)
if (self->priv->interrupted) {
GError *error;
- error = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_CANCELLED, "");
+ error = g_error_new_literal (GTH_TASK_ERROR, GTH_TASK_ERROR_CANCELLED, "");
cleanup_and_terminate (self, error);
g_error_free (error);
diff --git a/gthumb/gio-utils.c b/gthumb/gio-utils.c
index 73a82af..1d40e61 100644
--- a/gthumb/gio-utils.c
+++ b/gthumb/gio-utils.c
@@ -1221,7 +1221,7 @@ copy_file__overwrite_dialog_response_cb (GtkDialog *dialog,
CopyFileData *copy_file_data = user_data;
if (response_id != GTK_RESPONSE_OK)
- copy_file_data->default_response = GTH_OVERWRITE_RESPONSE_UNSPECIFIED;
+ copy_file_data->default_response = GTH_OVERWRITE_RESPONSE_CANCEL;
else
copy_file_data->default_response = gth_overwrite_dialog_get_response (GTH_OVERWRITE_DIALOG (dialog));
@@ -1234,9 +1234,16 @@ copy_file__overwrite_dialog_response_cb (GtkDialog *dialog,
case GTH_OVERWRITE_RESPONSE_NO:
case GTH_OVERWRITE_RESPONSE_ALWAYS_NO:
case GTH_OVERWRITE_RESPONSE_UNSPECIFIED:
- copy_file_data->ready_callback (copy_file_data->default_response, NULL, copy_file_data->user_data);
- copy_file_data_free (copy_file_data);
- return;
+ case GTH_OVERWRITE_RESPONSE_CANCEL:
+ {
+ GError *error = NULL;
+
+ if (copy_file_data->default_response == GTH_OVERWRITE_RESPONSE_CANCEL)
+ error = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_CANCELLED, "");
+ copy_file_data->ready_callback (copy_file_data->default_response, error, copy_file_data->user_data);
+ copy_file_data_free (copy_file_data);
+ return;
+ }
case GTH_OVERWRITE_RESPONSE_YES:
case GTH_OVERWRITE_RESPONSE_ALWAYS_YES:
diff --git a/gthumb/gth-browser.c b/gthumb/gth-browser.c
index 2f021c0..f610fb0 100644
--- a/gthumb/gth-browser.c
+++ b/gthumb/gth-browser.c
@@ -4363,7 +4363,7 @@ background_task_completed_cb (GthTask *task,
if (error == NULL)
return;
- if (! g_error_matches (error, GTH_TASK_ERROR, GTH_TASK_ERROR_CANCELLED))
+ if (! g_error_matches (error, GTH_TASK_ERROR, GTH_TASK_ERROR_CANCELLED) && ! g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED))
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (browser), _("Could not perform the operation"), &error);
else
g_error_free (error);
diff --git a/gthumb/gth-overwrite-dialog.h b/gthumb/gth-overwrite-dialog.h
index ff6c965..6260480 100644
--- a/gthumb/gth-overwrite-dialog.h
+++ b/gthumb/gth-overwrite-dialog.h
@@ -33,7 +33,8 @@ typedef enum {
GTH_OVERWRITE_RESPONSE_NO,
GTH_OVERWRITE_RESPONSE_ALWAYS_YES,
GTH_OVERWRITE_RESPONSE_ALWAYS_NO,
- GTH_OVERWRITE_RESPONSE_RENAME
+ GTH_OVERWRITE_RESPONSE_RENAME,
+ GTH_OVERWRITE_RESPONSE_CANCEL
} GthOverwriteResponse;
#define GTH_TYPE_OVERWRITE_DIALOG (gth_overwrite_dialog_get_type ())
diff --git a/gthumb/gth-pixbuf-list-task.c b/gthumb/gth-pixbuf-list-task.c
index 47aa5b1..21101fb 100644
--- a/gthumb/gth-pixbuf-list-task.c
+++ b/gthumb/gth-pixbuf-list-task.c
@@ -96,7 +96,7 @@ overwrite_dialog_response_cb (GtkDialog *dialog,
GthPixbufListTask *self = user_data;
if (response_id != GTK_RESPONSE_OK)
- self->priv->overwrite_response = GTH_OVERWRITE_RESPONSE_UNSPECIFIED;
+ self->priv->overwrite_response = GTH_OVERWRITE_RESPONSE_CANCEL;
else
self->priv->overwrite_response = gth_overwrite_dialog_get_response (GTH_OVERWRITE_DIALOG (dialog));
@@ -140,6 +140,15 @@ overwrite_dialog_response_cb (GtkDialog *dialog,
g_object_unref (parent);
}
break;
+
+ case GTH_OVERWRITE_RESPONSE_CANCEL:
+ {
+ GError *error;
+
+ error = g_error_new_literal (GTH_TASK_ERROR, GTH_TASK_ERROR_CANCELLED, "");
+ gth_task_completed (GTH_TASK (self), error);
+ }
+ break;
}
gtk_widget_destroy (GTK_WIDGET (dialog));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]