aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--shell/ChangeLog16
-rw-r--r--shell/e-corba-storage.c62
-rw-r--r--shell/e-corba-storage.h1
-rw-r--r--shell/e-shell-shared-folder-picker-dialog.c41
4 files changed, 76 insertions, 44 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index a8987479c9..85ad32f89e 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,19 @@
+2002-08-09 Dan Winship <danw@ximian.com>
+
+ * e-shell-shared-folder-picker-dialog.c (create_progress_dialog):
+ Remove both timeouts when the dialog is destroyed, not just one of
+ them.
+ (shared_folder_discovery_listener_callback): Don't try to access
+ fields of discovery_data after destroying it. Interpret the result
+ argument correctly, and put up an error dialog (using
+ e_corba_storage_corba_result_to_storage_result and
+ e_storage_result_to_string) if something went wrong.
+
+ * e-corba-storage.c
+ (e_corba_storage_corba_result_to_storage_result): convert a
+ GNOME_Evolution_Storage_Result to an EStorageResult.
+ (async_folder_cb): Use that.
+
2002-08-06 Dan Winship <danw@ximian.com>
* e-storage-set-view.c (folder_property_item_verb_callback): Don't
diff --git a/shell/e-corba-storage.c b/shell/e-corba-storage.c
index 95da96ed24..12a43eb2cc 100644
--- a/shell/e-corba-storage.c
+++ b/shell/e-corba-storage.c
@@ -294,39 +294,7 @@ async_folder_cb (BonoboListener *listener, char *event_name,
EStorageResult result;
corba_result = any->_value;
- switch (*corba_result) {
- case GNOME_Evolution_Storage_OK:
- result = E_STORAGE_OK;
- break;
- case GNOME_Evolution_Storage_UNSUPPORTED_OPERATION:
- result = E_STORAGE_UNSUPPORTEDOPERATION;
- break;
- case GNOME_Evolution_Storage_UNSUPPORTED_TYPE:
- result = E_STORAGE_UNSUPPORTEDTYPE;
- break;
- case GNOME_Evolution_Storage_INVALID_URI:
- result = E_STORAGE_INVALIDNAME;
- break;
- case GNOME_Evolution_Storage_ALREADY_EXISTS:
- result = E_STORAGE_EXISTS;
- break;
- case GNOME_Evolution_Storage_DOES_NOT_EXIST:
- result = E_STORAGE_NOTFOUND;
- break;
- case GNOME_Evolution_Storage_PERMISSION_DENIED:
- result = E_STORAGE_PERMISSIONDENIED;
- break;
- case GNOME_Evolution_Storage_NO_SPACE:
- result = E_STORAGE_NOSPACE;
- break;
- case GNOME_Evolution_Storage_NOT_EMPTY:
- result = E_STORAGE_NOTEMPTY;
- break;
- case GNOME_Evolution_Storage_GENERIC_ERROR:
- default:
- result = E_STORAGE_GENERICERROR;
- break;
- }
+ result = e_corba_storage_corba_result_to_storage_result (*corba_result);
(* closure->callback) (closure->storage, result, closure->data);
bonobo_object_unref (BONOBO_OBJECT (listener));
@@ -714,5 +682,33 @@ e_corba_storage_show_folder_properties (ECorbaStorage *corba_storage,
CORBA_exception_free (&ev);
}
+EStorageResult
+e_corba_storage_corba_result_to_storage_result (GNOME_Evolution_Storage_Result corba_result)
+{
+ switch (corba_result) {
+ case GNOME_Evolution_Storage_OK:
+ return E_STORAGE_OK;
+ case GNOME_Evolution_Storage_UNSUPPORTED_OPERATION:
+ return E_STORAGE_UNSUPPORTEDOPERATION;
+ case GNOME_Evolution_Storage_UNSUPPORTED_TYPE:
+ return E_STORAGE_UNSUPPORTEDTYPE;
+ case GNOME_Evolution_Storage_INVALID_URI:
+ return E_STORAGE_INVALIDNAME;
+ case GNOME_Evolution_Storage_ALREADY_EXISTS:
+ return E_STORAGE_EXISTS;
+ case GNOME_Evolution_Storage_DOES_NOT_EXIST:
+ return E_STORAGE_NOTFOUND;
+ case GNOME_Evolution_Storage_PERMISSION_DENIED:
+ return E_STORAGE_PERMISSIONDENIED;
+ case GNOME_Evolution_Storage_NO_SPACE:
+ return E_STORAGE_NOSPACE;
+ case GNOME_Evolution_Storage_NOT_EMPTY:
+ return E_STORAGE_NOTEMPTY;
+ case GNOME_Evolution_Storage_GENERIC_ERROR:
+ default:
+ return E_STORAGE_GENERICERROR;
+ }
+}
+
E_MAKE_TYPE (e_corba_storage, "ECorbaStorage", ECorbaStorage, class_init, init, PARENT_TYPE)
diff --git a/shell/e-corba-storage.h b/shell/e-corba-storage.h
index b144656cfb..da62ab628b 100644
--- a/shell/e-corba-storage.h
+++ b/shell/e-corba-storage.h
@@ -80,6 +80,7 @@ void e_corba_storage_show_folder_properties (ECorbaStorage *corba_storage,
const char *path,
int property_item_id,
GdkWindow *parent_window);
+EStorageResult e_corba_storage_corba_result_to_storage_result (GNOME_Evolution_Storage_Result corba_result);
#ifdef __cplusplus
}
diff --git a/shell/e-shell-shared-folder-picker-dialog.c b/shell/e-shell-shared-folder-picker-dialog.c
index c2a5c02160..9141348aca 100644
--- a/shell/e-shell-shared-folder-picker-dialog.c
+++ b/shell/e-shell-shared-folder-picker-dialog.c
@@ -346,7 +346,7 @@ create_progress_dialog (EShell *shell,
GtkWidget *dialog;
GtkWidget *label;
GtkWidget *progress_bar;
- int progress_bar_timeout_id;
+ int timeout_id;
char *text;
dialog = gnome_dialog_new (_("Opening Folder"), GNOME_STOCK_BUTTON_CANCEL, NULL);
@@ -370,12 +370,16 @@ create_progress_dialog (EShell *shell,
gtk_progress_set_activity_mode (GTK_PROGRESS (progress_bar), TRUE);
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), progress_bar, FALSE, TRUE, 0);
- progress_bar_timeout_id = g_timeout_add (50, progress_bar_timeout_callback, progress_bar);
+ timeout_id = g_timeout_add (50, progress_bar_timeout_callback, progress_bar);
gtk_signal_connect (GTK_OBJECT (progress_bar), "destroy",
GTK_SIGNAL_FUNC (progress_bar_destroy_callback),
- GINT_TO_POINTER (progress_bar_timeout_id));
+ GINT_TO_POINTER (timeout_id));
+
+ timeout_id = g_timeout_add (PROGRESS_DIALOG_DELAY, progress_dialog_show_timeout_callback, dialog);
+ gtk_signal_connect (GTK_OBJECT (progress_bar), "destroy",
+ GTK_SIGNAL_FUNC (progress_bar_destroy_callback),
+ GINT_TO_POINTER (timeout_id));
- g_timeout_add (PROGRESS_DIALOG_DELAY, progress_dialog_show_timeout_callback, dialog);
return dialog;
}
@@ -432,24 +436,39 @@ shared_folder_discovery_listener_callback (BonoboListener *listener,
{
GNOME_Evolution_Storage_FolderResult *result;
DiscoveryData *discovery_data;
+ EShell *shell;
+ EShellView *parent;
+ EStorage *storage;
discovery_data = (DiscoveryData *) data;
- result = (GNOME_Evolution_Storage_FolderResult *) value->_value;
+ shell = discovery_data->shell;
+ parent = discovery_data->parent;
+ storage = discovery_data->storage;
+ /* Make sure the progress dialog doesn't show up now. */
cleanup_discovery (discovery_data);
- if (result == GNOME_Evolution_Storage_OK) {
+ result = (GNOME_Evolution_Storage_FolderResult *) value->_value;
+ if (result->result == GNOME_Evolution_Storage_OK) {
char *uri;
uri = g_strconcat (E_SHELL_URI_PREFIX, "/",
- e_storage_get_name (discovery_data->storage),
+ e_storage_get_name (storage),
result->path,
NULL);
if (discovery_data->parent != NULL)
- e_shell_view_display_uri (discovery_data->parent, uri);
+ e_shell_view_display_uri (parent, uri);
else
- e_shell_create_view (discovery_data->shell, uri, NULL);
+ e_shell_create_view (shell, uri, NULL);
+ } else {
+ EStorageResult storage_result;
+
+ storage_result = e_corba_storage_corba_result_to_storage_result (result->result);
+ e_notice (parent ? GTK_WINDOW (parent) : NULL,
+ GNOME_MESSAGE_BOX_ERROR,
+ _("Could not open shared folder: %s."),
+ e_storage_result_to_string (storage_result));
}
}
@@ -519,8 +538,8 @@ discover_folder (EShell *shell,
cleanup_discovery (discovery_data);
/* FIXME: Be more verbose? */
- e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
- _("Cannot find open the specified shared folder."));
+ e_notice (GTK_WINDOW (parent), GNOME_MESSAGE_BOX_ERROR,
+ _("Cannot find the specified shared folder."));
CORBA_exception_free (&ev);
}