aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-shell-folder-creation-dialog.c
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2001-12-20 14:05:51 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2001-12-20 14:05:51 +0800
commita33720dba790586bddfeb9fa7d7a04adf79878d2 (patch)
treed2f16139ad164e86365298d9e6993db8b50d79be /shell/e-shell-folder-creation-dialog.c
parent6cfbc6f4d946ea0976373b099284d5b5d5cfb4da (diff)
downloadgsoc2013-evolution-a33720dba790586bddfeb9fa7d7a04adf79878d2.tar
gsoc2013-evolution-a33720dba790586bddfeb9fa7d7a04adf79878d2.tar.gz
gsoc2013-evolution-a33720dba790586bddfeb9fa7d7a04adf79878d2.tar.bz2
gsoc2013-evolution-a33720dba790586bddfeb9fa7d7a04adf79878d2.tar.lz
gsoc2013-evolution-a33720dba790586bddfeb9fa7d7a04adf79878d2.tar.xz
gsoc2013-evolution-a33720dba790586bddfeb9fa7d7a04adf79878d2.tar.zst
gsoc2013-evolution-a33720dba790586bddfeb9fa7d7a04adf79878d2.zip
-- Merging patches from evolution-1-0-branch.
* e-shell-about-box.c: Add Michael MacDonald. [Fixes #17377, Evolution doesn't work on multi-depth displays.] * main.c (main): Push GdkRGB visual and colormap. [Fix #16693. What happens there is that the user closed the dialog before the async operation was completed, so when the notification was received the shell crashed.] * e-shell-folder-creation-dialog.c: New member `creation_in_progress' in `DialogData'. (e_shell_show_folder_creation_dialog): Init to %FALSE. (async_create_cb): Set to %FALSE. Also, if the dialog_data->dialog is %NULL, free the dialog_data before returning. (dialog_clicked_cb): Set to %TRUE. (dialog_destroy_cb): If a creation is in progress, just set the widget pointers in the DialogData struct to %NULL instead of freeing the whole struct. (async_create_cb): Make the OK and Cancel buttons sensitive. (dialog_clicked_cb): Make them insensitive here. svn path=/trunk/; revision=15192
Diffstat (limited to 'shell/e-shell-folder-creation-dialog.c')
-rw-r--r--shell/e-shell-folder-creation-dialog.c40
1 files changed, 39 insertions, 1 deletions
diff --git a/shell/e-shell-folder-creation-dialog.c b/shell/e-shell-folder-creation-dialog.c
index 9def913951..dbbdcdfd74 100644
--- a/shell/e-shell-folder-creation-dialog.c
+++ b/shell/e-shell-folder-creation-dialog.c
@@ -61,6 +61,8 @@ struct _DialogData {
EShellFolderCreationDialogCallback result_callback;
void *result_callback_data;
+
+ gboolean creation_in_progress;
};
typedef struct _DialogData DialogData;
@@ -85,6 +87,11 @@ async_create_cb (EStorageSet *storage_set,
dialog_data = (DialogData *) data;
+ dialog_data->creation_in_progress = FALSE;
+
+ gnome_dialog_set_sensitive (GNOME_DIALOG (dialog_data->dialog), 0, TRUE);
+ gnome_dialog_set_sensitive (GNOME_DIALOG (dialog_data->dialog), 1, TRUE);
+
if (result == E_STORAGE_OK) {
/* Success! Tell the callback of this, then return */
if (dialog_data->result_callback != NULL)
@@ -92,7 +99,14 @@ async_create_cb (EStorageSet *storage_set,
E_SHELL_FOLDER_CREATION_DIALOG_RESULT_SUCCESS,
dialog_data->folder_path,
dialog_data->result_callback_data);
- gtk_widget_destroy (dialog_data->dialog);
+ if (dialog_data->dialog != NULL) {
+ gtk_widget_destroy (dialog_data->dialog);
+ } else {
+ /* If dialog_data->dialog is NULL, it means that the
+ dialog has been destroyed before we were done, so we
+ have to free the dialog_data ourselves. */
+ dialog_data_destroy (dialog_data);
+ }
return;
} else if (result == E_STORAGE_EXISTS) {
e_storage_set_view_set_current_folder (E_STORAGE_SET_VIEW (dialog_data->storage_set_view),
@@ -110,6 +124,12 @@ async_create_cb (EStorageSet *storage_set,
e_notice (GTK_WINDOW (dialog_data->dialog), GNOME_MESSAGE_BOX_ERROR,
_("Cannot create the specified folder:\n%s"),
e_storage_result_to_string (result));
+
+ /* If dialog_data->dialog is NULL, it means that the dialog has been
+ destroyed before we were done, so we have to free the dialog_data
+ ourselves. */
+ if (dialog_data->dialog == NULL)
+ dialog_data_destroy (dialog_data);
}
@@ -177,6 +197,11 @@ dialog_clicked_cb (GnomeDialog *dialog,
g_free (dialog_data->folder_path);
dialog_data->folder_path = path;
+ gnome_dialog_set_sensitive (dialog, 0, FALSE);
+ gnome_dialog_set_sensitive (dialog, 1, FALSE);
+
+ dialog_data->creation_in_progress = TRUE;
+
e_storage_set_async_create_folder (storage_set,
path,
folder_type,
@@ -191,6 +216,18 @@ dialog_destroy_cb (GtkObject *object,
DialogData *dialog_data;
dialog_data = (DialogData *) data;
+
+ if (dialog_data->creation_in_progress) {
+ /* If the dialog has been closed before we are done creating
+ the folder, the dialog_data will be freed after the creation
+ is completed. */
+ dialog_data->dialog = NULL;
+ dialog_data->folder_name_entry = NULL;
+ dialog_data->storage_set_view = NULL;
+ dialog_data->folder_type_option_menu = NULL;
+ return;
+ }
+
dialog_data_destroy (dialog_data);
}
@@ -500,6 +537,7 @@ e_shell_show_folder_creation_dialog (EShell *shell,
dialog_data->folder_path = NULL;
dialog_data->result_callback = result_callback;
dialog_data->result_callback_data = result_callback_data;
+ dialog_data->creation_in_progress = FALSE;
gtk_signal_connect (GTK_OBJECT (dialog), "clicked",
GTK_SIGNAL_FUNC (dialog_clicked_cb), dialog_data);