From 43c5226539d29571957c558e1e3d40510ef90996 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Tue, 31 Aug 2004 15:45:48 +0000 Subject: Set the store and full_name info on the dialog. 2004-08-30 Jeffrey Stedfast * em-folder-tree.c (emft_popup_delete_folder): Set the store and full_name info on the dialog. (emft_popup_delete_response): Use the requisite data stored on the dialog object rather than examining the selection again. Fixes bug #62665. svn path=/trunk/; revision=27095 --- mail/ChangeLog | 8 ++++++++ mail/em-folder-tree.c | 45 +++++++++++++++++++-------------------------- mail/mail-errors.xml | 4 ++-- mail/mail-errors.xml.h | 8 ++++---- 4 files changed, 33 insertions(+), 32 deletions(-) (limited to 'mail') diff --git a/mail/ChangeLog b/mail/ChangeLog index c17a8b3fa5..2a5b5f98a6 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,11 @@ +2004-08-30 Jeffrey Stedfast + + * em-folder-tree.c (emft_popup_delete_folder): Set the store and + full_name info on the dialog. + (emft_popup_delete_response): Use the requisite data stored on the + dialog object rather than examining the selection again. Fixes bug + #62665. + 2004-08-30 Not Zed ** See bug #64377. diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c index ae14a2b40c..5d8005ed40 100644 --- a/mail/em-folder-tree.c +++ b/mail/em-folder-tree.c @@ -2522,36 +2522,26 @@ emft_selection_get_selected (GtkTreeSelection *selection, GtkTreeModel **model, } static void -emft_popup_delete_response (GtkWidget *dialog, guint response, EMFolderTree *emft) +emft_popup_delete_response (GtkWidget *dialog, int response, EMFolderTree *emft) { - struct _EMFolderTreePrivate *priv = emft->priv; - GtkTreeSelection *selection; - GtkTreeModel *model; CamelStore *store; CamelException ex; - GtkTreeIter iter; char *full_name; - gtk_widget_destroy (dialog); - if (response != GTK_RESPONSE_OK) - return; - - selection = gtk_tree_view_get_selection (priv->treeview); - if (!emft_selection_get_selected (selection, &model, &iter)) - return; - - gtk_tree_model_get (model, &iter, COL_STRING_FULL_NAME, &full_name, - COL_POINTER_CAMEL_STORE, &store, -1); + full_name = g_object_get_data ((GObject *) dialog, "full_name"); + store = g_object_get_data ((GObject *) dialog, "store"); - camel_exception_init (&ex); - emft_popup_delete_folders (store, full_name, &ex); - if (camel_exception_is_set (&ex)) { - e_error_run((GtkWindow *)gtk_widget_get_toplevel((GtkWidget *)emft), - "mail:no-delete-folder", full_name, ex.desc, NULL); - camel_exception_clear (&ex); + if (response == GTK_RESPONSE_OK) { + camel_exception_init (&ex); + emft_popup_delete_folders (store, full_name, &ex); + if (camel_exception_is_set (&ex)) { + e_error_run((GtkWindow *)gtk_widget_get_toplevel((GtkWidget *)emft), + "mail:no-delete-folder", full_name, ex.desc, NULL); + camel_exception_clear (&ex); + } } - g_free (full_name); + gtk_widget_destroy (dialog); } static void @@ -2575,15 +2565,18 @@ emft_popup_delete_folder (GtkWidget *item, EMFolderTree *emft) local = mail_component_peek_local_store (NULL); if (store == local && is_special_local_folder (full_name)) { - e_error_run(NULL, "mail:no-delete-spethal-folder", full_name, NULL); + e_error_run(NULL, "mail:no-delete-special-folder", full_name, NULL); return; } - + + camel_object_ref (store); + dialog = e_error_new((GtkWindow *)gtk_widget_get_toplevel((GtkWidget *)emft), "mail:ask-delete-folder", full_name, NULL); + g_object_set_data_full ((GObject *) dialog, "full_name", full_name, g_free); + g_object_set_data_full ((GObject *) dialog, "store", store, camel_object_unref); g_signal_connect (dialog, "response", G_CALLBACK (emft_popup_delete_response), emft); gtk_widget_show (dialog); - g_free (full_name); } static void @@ -2613,7 +2606,7 @@ emft_popup_rename_folder (GtkWidget *item, EMFolderTree *emft) /* don't allow user to rename one of the special local folders */ if (store == local && is_special_local_folder (full_name)) { e_error_run((GtkWindow *)gtk_widget_get_toplevel((GtkWidget *)emft), - "mail:no-rename-spethal-folder", full_name, NULL); + "mail:no-rename-special-folder", full_name, NULL); g_free (full_name); g_free (name); g_free (uri); diff --git a/mail/mail-errors.xml b/mail/mail-errors.xml index 4fa5596498..9e32d5aba2 100644 --- a/mail/mail-errors.xml +++ b/mail/mail-errors.xml @@ -164,12 +164,12 @@ The message is stored in the Outbox folder. Check the message for errors and re Because "{1}". - + Cannot delete system folder "{0}". System folders are required for Ximian Evolution to function correctly and cannot be renamed, moved, or deleted. - + Cannot rename or move system folder "{0}". System folders are required for Ximian Evolution to function correctly and cannot be renamed, moved, or deleted. diff --git a/mail/mail-errors.xml.h b/mail/mail-errors.xml.h index e2eed775d3..74cdecfc92 100644 --- a/mail/mail-errors.xml.h +++ b/mail/mail-errors.xml.h @@ -110,13 +110,13 @@ char *s = N_("File exists but is not a regular file."); char *s = N_("Cannot delete folder \"{0}\"."); /* mail:no-delete-folder secondary */ char *s = N_("Because \"{1}\"."); -/* mail:no-delete-spethal-folder primary */ +/* mail:no-delete-special-folder primary */ char *s = N_("Cannot delete system folder \"{0}\"."); -/* mail:no-delete-spethal-folder secondary */ +/* mail:no-delete-special-folder secondary */ char *s = N_("System folders are required for Ximian Evolution to function correctly and cannot be renamed, moved, or deleted."); -/* mail:no-rename-spethal-folder primary */ +/* mail:no-rename-special-folder primary */ char *s = N_("Cannot rename or move system folder \"{0}\"."); -/* mail:no-rename-spethal-folder secondary */ +/* mail:no-rename-special-folder secondary */ char *s = N_("System folders are required for Ximian Evolution to function correctly and cannot be renamed, moved, or deleted."); /* mail:ask-delete-folder title */ char *s = N_("Delete \"{0}\"?"); -- cgit