[gthumb] cancel the file list operation before closing the dialog.
- From: Paolo Bacchilega <paobac src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gthumb] cancel the file list operation before closing the dialog.
- Date: Sat, 1 May 2010 13:49:46 +0000 (UTC)
commit 64618315ada675b4e98beac5565bc30abb90a9ea
Author: Paolo Bacchilega <paobac src gnome org>
Date: Sat May 1 15:42:01 2010 +0200
cancel the file list operation before closing the dialog.
extensions/facebook/dlg-export-to-facebook.c | 45 ++++++++++++-----------
extensions/facebook/facebook-authentication.c | 8 ++--
extensions/flicker/dlg-export-to-flickr.c | 49 +++++++++++++------------
extensions/flicker/flickr-authentication.c | 8 ++--
4 files changed, 56 insertions(+), 54 deletions(-)
---
diff --git a/extensions/facebook/dlg-export-to-facebook.c b/extensions/facebook/dlg-export-to-facebook.c
index e736da3..b173d4f 100644
--- a/extensions/facebook/dlg-export-to-facebook.c
+++ b/extensions/facebook/dlg-export-to-facebook.c
@@ -55,6 +55,7 @@ typedef struct {
GList *file_list;
GtkBuilder *builder;
GtkWidget *dialog;
+ GtkWidget *list_view;
GtkWidget *progress_dialog;
FacebookConnection *conn;
FacebookAuthentication *auth;
@@ -68,9 +69,10 @@ typedef struct {
static void
-export_dialog_destroy_cb (GtkWidget *widget,
- DialogData *data)
+destroy_dialog (DialogData *data)
{
+ if (data->dialog != NULL)
+ gtk_widget_destroy (data->dialog);
if (data->conn != NULL)
gth_task_completed (GTH_TASK (data->conn), NULL);
_g_object_unref (data->cancellable);
@@ -99,7 +101,7 @@ completed_messagedialog_response_cb (GtkDialog *dialog,
case GTK_RESPONSE_DELETE_EVENT:
case GTK_RESPONSE_CLOSE:
gtk_widget_destroy (GTK_WIDGET (dialog));
- gtk_widget_destroy (data->dialog);
+ gtk_dialog_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_DELETE_EVENT);
break;
case _OPEN_IN_BROWSER_RESPONSE:
@@ -118,7 +120,7 @@ completed_messagedialog_response_cb (GtkDialog *dialog,
_gtk_error_dialog_from_gerror_run (GTK_WINDOW (data->browser), _("Could not connect to the server"), &error);
}
- gtk_widget_destroy (data->dialog);
+ gtk_dialog_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_DELETE_EVENT);
g_free (url);
}
@@ -163,7 +165,7 @@ upload_photos_ready_cb (GObject *source_object,
data->photos_ids = facebook_service_upload_photos_finish (FACEBOOK_SERVICE (source_object), result, &error);
if (error != NULL) {
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->browser), _("Could not upload the files"), &error);
- gtk_widget_destroy (data->dialog);
+ gtk_dialog_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_DELETE_EVENT);
return;
}
@@ -185,7 +187,7 @@ export_dialog_response_cb (GtkDialog *dialog,
case GTK_RESPONSE_DELETE_EVENT:
case GTK_RESPONSE_CANCEL:
- gtk_widget_destroy (data->dialog);
+ gth_file_list_cancel (GTH_FILE_LIST (data->list_view), (DataFunc) destroy_dialog, data);
break;
case GTK_RESPONSE_OK:
@@ -299,7 +301,7 @@ get_albums_ready_cb (GObject *source_object,
if (data->conn != NULL)
gth_task_dialog (GTH_TASK (data->conn), TRUE);
_gtk_error_dialog_from_gerror_run (GTK_WINDOW (data->browser), _("Could not connect to the server"), &error);
- gtk_widget_destroy (data->dialog);
+ gtk_dialog_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_DELETE_EVENT);
return;
}
@@ -455,7 +457,6 @@ dlg_export_to_facebook (GthBrowser *browser,
goffset total_size;
char *total_size_formatted;
char *text;
- GtkWidget *list_view;
char *title;
data = g_new0 (DialogData, 1);
@@ -520,7 +521,7 @@ dlg_export_to_facebook (GthBrowser *browser,
error = g_error_new_literal (GTH_ERROR, GTH_ERROR_GENERIC, _("No valid file selected."));
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (browser), _("Could not export the files"), &error);
- gtk_widget_destroy (data->dialog);
+ gtk_dialog_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_DELETE_EVENT);
return;
}
@@ -533,15 +534,15 @@ dlg_export_to_facebook (GthBrowser *browser,
/* Set the widget data */
- list_view = gth_file_list_new (GTH_FILE_LIST_TYPE_NO_SELECTION, FALSE);
- gth_file_list_set_thumb_size (GTH_FILE_LIST (list_view), 112);
- gth_file_view_set_spacing (GTH_FILE_VIEW (gth_file_list_get_view (GTH_FILE_LIST (list_view))), 0);
- gth_file_list_enable_thumbs (GTH_FILE_LIST (list_view), TRUE);
- gth_file_list_set_caption (GTH_FILE_LIST (list_view), "none");
- gth_file_list_set_sort_func (GTH_FILE_LIST (list_view), gth_main_get_sort_type ("file::name")->cmp_func, FALSE);
- gtk_widget_show (list_view);
- gtk_box_pack_start (GTK_BOX (GET_WIDGET ("images_box")), list_view, TRUE, TRUE, 0);
- gth_file_list_set_files (GTH_FILE_LIST (list_view), data->file_list);
+ data->list_view = gth_file_list_new (GTH_FILE_LIST_TYPE_NO_SELECTION, FALSE);
+ gth_file_list_set_thumb_size (GTH_FILE_LIST (data->list_view), 112);
+ gth_file_view_set_spacing (GTH_FILE_VIEW (gth_file_list_get_view (GTH_FILE_LIST (data->list_view))), 0);
+ gth_file_list_enable_thumbs (GTH_FILE_LIST (data->list_view), TRUE);
+ gth_file_list_set_caption (GTH_FILE_LIST (data->list_view), "none");
+ gth_file_list_set_sort_func (GTH_FILE_LIST (data->list_view), gth_main_get_sort_type ("file::name")->cmp_func, FALSE);
+ gtk_widget_show (data->list_view);
+ gtk_box_pack_start (GTK_BOX (GET_WIDGET ("images_box")), data->list_view, TRUE, TRUE, 0);
+ gth_file_list_set_files (GTH_FILE_LIST (data->list_view), data->file_list);
gtk_widget_set_sensitive (GET_WIDGET ("upload_button"), FALSE);
@@ -551,10 +552,10 @@ dlg_export_to_facebook (GthBrowser *browser,
/* Set the signals handlers. */
- g_signal_connect (G_OBJECT (data->dialog),
- "destroy",
- G_CALLBACK (export_dialog_destroy_cb),
- data);
+ g_signal_connect (data->dialog,
+ "delete-event",
+ G_CALLBACK (gtk_widget_hide_on_delete),
+ NULL);
g_signal_connect (data->dialog,
"response",
G_CALLBACK (export_dialog_response_cb),
diff --git a/extensions/facebook/facebook-authentication.c b/extensions/facebook/facebook-authentication.c
index 3ab1541..380cc2f 100644
--- a/extensions/facebook/facebook-authentication.c
+++ b/extensions/facebook/facebook-authentication.c
@@ -186,7 +186,7 @@ authentication_error_dialog_response_cb (GtkDialog *dialog,
case GTK_RESPONSE_DELETE_EVENT:
case GTK_RESPONSE_CANCEL:
gtk_widget_destroy (GTK_WIDGET (dialog));
- gtk_widget_destroy (self->priv->dialog);
+ gtk_dialog_response (GTK_DIALOG (self->priv->dialog), GTK_RESPONSE_DELETE_EVENT);
break;
case FACEBOOK_AUTHENTICATION_RESPONSE_CHOOSE_ACCOUNT:
@@ -462,7 +462,7 @@ complete_authorization_messagedialog_response_cb (GtkDialog *dialog,
case GTK_RESPONSE_DELETE_EVENT:
case GTK_RESPONSE_CANCEL:
gtk_widget_destroy (GTK_WIDGET (dialog));
- gtk_widget_destroy (self->priv->dialog);
+ gtk_dialog_response (GTK_DIALOG (self->priv->dialog), GTK_RESPONSE_DELETE_EVENT);
break;
case GTK_RESPONSE_OK:
@@ -528,7 +528,7 @@ ask_authorization_messagedialog_response_cb (GtkDialog *dialog,
case GTK_RESPONSE_DELETE_EVENT:
case GTK_RESPONSE_CANCEL:
gtk_widget_destroy (GTK_WIDGET (dialog));
- gtk_widget_destroy (self->priv->dialog);
+ gtk_dialog_response (GTK_DIALOG (self->priv->dialog), GTK_RESPONSE_DELETE_EVENT);
break;
case GTK_RESPONSE_OK:
@@ -624,7 +624,7 @@ account_chooser_dialog_response_cb (GtkDialog *dialog,
case GTK_RESPONSE_DELETE_EVENT:
case GTK_RESPONSE_CANCEL:
gtk_widget_destroy (GTK_WIDGET (dialog));
- gtk_widget_destroy (self->priv->dialog);
+ gtk_dialog_response (GTK_DIALOG (self->priv->dialog), GTK_RESPONSE_DELETE_EVENT);
break;
case GTK_RESPONSE_OK:
diff --git a/extensions/flicker/dlg-export-to-flickr.c b/extensions/flicker/dlg-export-to-flickr.c
index 9f7bf92..e3d6b13 100644
--- a/extensions/flicker/dlg-export-to-flickr.c
+++ b/extensions/flicker/dlg-export-to-flickr.c
@@ -55,6 +55,7 @@ typedef struct {
GList *file_list;
GtkBuilder *builder;
GtkWidget *dialog;
+ GtkWidget *list_view;
GtkWidget *progress_dialog;
FlickrConnection *conn;
FlickrAuthentication *auth;
@@ -68,9 +69,10 @@ typedef struct {
static void
-export_dialog_destroy_cb (GtkWidget *widget,
- DialogData *data)
+destroy_dialog (DialogData *data)
{
+ if (data->dialog != NULL)
+ gtk_widget_destroy (data->dialog);
if (data->conn != NULL)
gth_task_completed (GTH_TASK (data->conn), NULL);
_g_object_unref (data->cancellable);
@@ -99,7 +101,7 @@ completed_messagedialog_response_cb (GtkDialog *dialog,
case GTK_RESPONSE_DELETE_EVENT:
case GTK_RESPONSE_CLOSE:
gtk_widget_destroy (GTK_WIDGET (dialog));
- gtk_widget_destroy (data->dialog);
+ gtk_dialog_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_DELETE_EVENT);
break;
case _OPEN_IN_BROWSER_RESPONSE:
@@ -133,7 +135,7 @@ completed_messagedialog_response_cb (GtkDialog *dialog,
gth_task_dialog (GTH_TASK (data->conn), TRUE);
_gtk_error_dialog_from_gerror_run (GTK_WINDOW (data->browser), _("Could not connect to the server"), &error);
}
- gtk_widget_destroy (data->dialog);
+ gtk_dialog_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_DELETE_EVENT);
g_free (url);
}
@@ -177,7 +179,7 @@ add_photos_to_photoset_ready_cb (GObject *source_object,
if (! flickr_service_add_photos_to_set_finish (FLICKR_SERVICE (source_object), result, &error)) {
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->browser), _("Could not create the album"), &error);
- gtk_widget_destroy (data->dialog);
+ gtk_dialog_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_DELETE_EVENT);
return;
}
@@ -211,7 +213,7 @@ create_photoset_ready_cb (GObject *source_object,
data->photoset = flickr_service_create_photoset_finish (FLICKR_SERVICE (source_object), result, &error);
if (error != NULL) {
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->browser), _("Could not create the album"), &error);
- gtk_widget_destroy (data->dialog);
+ gtk_dialog_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_DELETE_EVENT);
}
else {
flickr_photoset_set_primary (data->photoset, primary);
@@ -233,7 +235,7 @@ post_photos_ready_cb (GObject *source_object,
data->photos_ids = flickr_service_post_photos_finish (FLICKR_SERVICE (source_object), result, &error);
if (error != NULL) {
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (data->browser), _("Could not upload the files"), &error);
- gtk_widget_destroy (data->dialog);
+ gtk_dialog_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_DELETE_EVENT);
return;
}
@@ -282,7 +284,7 @@ export_dialog_response_cb (GtkDialog *dialog,
case GTK_RESPONSE_DELETE_EVENT:
case GTK_RESPONSE_CANCEL:
- gtk_widget_destroy (data->dialog);
+ gth_file_list_cancel (GTH_FILE_LIST (data->list_view), (DataFunc) destroy_dialog, data);
break;
case GTK_RESPONSE_OK:
@@ -386,7 +388,7 @@ photoset_list_ready_cb (GObject *source_object,
if (data->conn != NULL)
gth_task_dialog (GTH_TASK (data->conn), TRUE);
_gtk_error_dialog_from_gerror_run (GTK_WINDOW (data->browser), _("Could not connect to the server"), &error);
- gtk_widget_destroy (data->dialog);
+ gtk_dialog_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_DELETE_EVENT);
return;
}
@@ -478,7 +480,6 @@ dlg_export_to_flickr (FlickrServer *server,
goffset total_size;
char *total_size_formatted;
char *text;
- GtkWidget *list_view;
char *title;
data = g_new0 (DialogData, 1);
@@ -514,7 +515,7 @@ dlg_export_to_flickr (FlickrServer *server,
error = g_error_new_literal (GTH_ERROR, GTH_ERROR_GENERIC, _("No valid file selected."));
_gtk_error_dialog_from_gerror_show (GTK_WINDOW (browser), _("Could not export the files"), &error);
- gtk_widget_destroy (data->dialog);
+ gtk_dialog_response (GTK_DIALOG (data->dialog), GTK_RESPONSE_DELETE_EVENT);
return;
}
@@ -527,15 +528,15 @@ dlg_export_to_flickr (FlickrServer *server,
/* Set the widget data */
- list_view = gth_file_list_new (GTH_FILE_LIST_TYPE_NO_SELECTION, FALSE);
- gth_file_list_set_thumb_size (GTH_FILE_LIST (list_view), 112);
- gth_file_view_set_spacing (GTH_FILE_VIEW (gth_file_list_get_view (GTH_FILE_LIST (list_view))), 0);
- gth_file_list_enable_thumbs (GTH_FILE_LIST (list_view), TRUE);
- gth_file_list_set_caption (GTH_FILE_LIST (list_view), "none");
- gth_file_list_set_sort_func (GTH_FILE_LIST (list_view), gth_main_get_sort_type ("file::name")->cmp_func, FALSE);
- gtk_widget_show (list_view);
- gtk_box_pack_start (GTK_BOX (GET_WIDGET ("images_box")), list_view, TRUE, TRUE, 0);
- gth_file_list_set_files (GTH_FILE_LIST (list_view), data->file_list);
+ data->list_view = gth_file_list_new (GTH_FILE_LIST_TYPE_NO_SELECTION, FALSE);
+ gth_file_list_set_thumb_size (GTH_FILE_LIST (data->list_view), 112);
+ gth_file_view_set_spacing (GTH_FILE_VIEW (gth_file_list_get_view (GTH_FILE_LIST (data->list_view))), 0);
+ gth_file_list_enable_thumbs (GTH_FILE_LIST (data->list_view), TRUE);
+ gth_file_list_set_caption (GTH_FILE_LIST (data->list_view), "none");
+ gth_file_list_set_sort_func (GTH_FILE_LIST (data->list_view), gth_main_get_sort_type ("file::name")->cmp_func, FALSE);
+ gtk_widget_show (data->list_view);
+ gtk_box_pack_start (GTK_BOX (GET_WIDGET ("images_box")), data->list_view, TRUE, TRUE, 0);
+ gth_file_list_set_files (GTH_FILE_LIST (data->list_view), data->file_list);
gtk_entry_set_text (GTK_ENTRY (gtk_bin_get_child (GTK_BIN (GET_WIDGET ("photoset_comboboxentry")))), g_file_info_get_edit_name (data->location->info));
gtk_widget_set_sensitive (GET_WIDGET ("upload_button"), FALSE);
@@ -546,10 +547,10 @@ dlg_export_to_flickr (FlickrServer *server,
/* Set the signals handlers. */
- g_signal_connect (G_OBJECT (data->dialog),
- "destroy",
- G_CALLBACK (export_dialog_destroy_cb),
- data);
+ g_signal_connect (data->dialog,
+ "delete-event",
+ G_CALLBACK (gtk_widget_hide_on_delete),
+ NULL);
g_signal_connect (data->dialog,
"response",
G_CALLBACK (export_dialog_response_cb),
diff --git a/extensions/flicker/flickr-authentication.c b/extensions/flicker/flickr-authentication.c
index f5cf03f..fb46ca4 100644
--- a/extensions/flicker/flickr-authentication.c
+++ b/extensions/flicker/flickr-authentication.c
@@ -185,7 +185,7 @@ authentication_error_dialog_response_cb (GtkDialog *dialog,
case GTK_RESPONSE_DELETE_EVENT:
case GTK_RESPONSE_CANCEL:
gtk_widget_destroy (GTK_WIDGET (dialog));
- gtk_widget_destroy (self->priv->dialog);
+ gtk_dialog_response (GTK_DIALOG (self->priv->dialog), GTK_RESPONSE_DELETE_EVENT);
break;
case FLICKR_AUTHENTICATION_RESPONSE_CHOOSE_ACCOUNT:
@@ -401,7 +401,7 @@ complete_authorization_messagedialog_response_cb (GtkDialog *dialog,
case GTK_RESPONSE_DELETE_EVENT:
case GTK_RESPONSE_CANCEL:
gtk_widget_destroy (GTK_WIDGET (dialog));
- gtk_widget_destroy (self->priv->dialog);
+ gtk_dialog_response (GTK_DIALOG (self->priv->dialog), GTK_RESPONSE_DELETE_EVENT);
break;
case GTK_RESPONSE_OK:
@@ -467,7 +467,7 @@ ask_authorization_messagedialog_response_cb (GtkDialog *dialog,
case GTK_RESPONSE_DELETE_EVENT:
case GTK_RESPONSE_CANCEL:
gtk_widget_destroy (GTK_WIDGET (dialog));
- gtk_widget_destroy (self->priv->dialog);
+ gtk_dialog_response (GTK_DIALOG (self->priv->dialog), GTK_RESPONSE_DELETE_EVENT);
break;
case GTK_RESPONSE_OK:
@@ -562,7 +562,7 @@ account_chooser_dialog_response_cb (GtkDialog *dialog,
case GTK_RESPONSE_DELETE_EVENT:
case GTK_RESPONSE_CANCEL:
gtk_widget_destroy (GTK_WIDGET (dialog));
- gtk_widget_destroy (self->priv->dialog);
+ gtk_dialog_response (GTK_DIALOG (self->priv->dialog), GTK_RESPONSE_DELETE_EVENT);
break;
case GTK_RESPONSE_OK:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]