diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2000-11-07 06:18:29 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2000-11-07 06:18:29 +0800 |
commit | 45cc7467dafdecd1b7f793c72ed8bbb3fe2ee5da (patch) | |
tree | f1989ba74348c7c372aca3a5c67c3096c34e1ce7 /shell/e-shell.c | |
parent | f2178aee93cf94dbc14c34628ca4671e348d7a2f (diff) | |
download | gsoc2013-evolution-45cc7467dafdecd1b7f793c72ed8bbb3fe2ee5da.tar.gz gsoc2013-evolution-45cc7467dafdecd1b7f793c72ed8bbb3fe2ee5da.tar.zst gsoc2013-evolution-45cc7467dafdecd1b7f793c72ed8bbb3fe2ee5da.zip |
Make the shell pop-up a warning dialog per component when a component
crashes, instead of a warning dialog for each of the crashed views.
svn path=/trunk/; revision=6458
Diffstat (limited to 'shell/e-shell.c')
-rw-r--r-- | shell/e-shell.c | 66 |
1 files changed, 65 insertions, 1 deletions
diff --git a/shell/e-shell.c b/shell/e-shell.c index ee49fc997a..ad6e2c1336 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -30,7 +30,7 @@ #include "Evolution.h" -#include "e-util/e-gui-utils.h" +#include <gal/widgets/e-gui-utils.h> #include <gal/util/e-util.h> #include "e-component-registry.h" @@ -68,6 +68,9 @@ struct _EShellPrivate { EComponentRegistry *component_registry; ECorbaStorageRegistry *corba_storage_registry; + + /* Names for the types of the folders that have maybe crashed. */ + GList *crash_type_names; /* char * */ }; @@ -554,6 +557,8 @@ destroy (GtkObject *object) if (priv->corba_storage_registry != NULL) bonobo_object_unref (BONOBO_OBJECT (priv->corba_storage_registry)); + e_free_string_list (priv->crash_type_names); + g_free (priv); (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); @@ -624,6 +629,7 @@ init (EShell *shell) priv->component_registry = NULL; priv->folder_type_registry = NULL; priv->corba_storage_registry = NULL; + priv->crash_type_names = NULL; shell->priv = priv; } @@ -1096,4 +1102,62 @@ e_shell_quit (EShell *shell) } +/** + * e_shell_component_maybe_crashed: + * @shell: A pointer to an EShell object + * @uri: URI that caused the crash + * @type_name: The type of the folder that caused the crash + * @shell_view: Pointer to the EShellView over which we want the modal dialog + * to appear. + * + * Report that a maybe crash happened when trying to display a folder of type + * @type_name. The shell will pop up a crash dialog whose parent will be the + * @shell_view. + **/ +void +e_shell_component_maybe_crashed (EShell *shell, + const char *uri, + const char *type_name, + EShellView *shell_view) +{ + EShellPrivate *priv; + GtkWindow *parent_window; + GList *p; + + g_return_if_fail (shell != NULL); + g_return_if_fail (E_IS_SHELL (shell)); + g_return_if_fail (type_name != NULL); + g_return_if_fail (shell_view != NULL); + g_return_if_fail (E_IS_SHELL_VIEW (shell_view)); + + priv = shell->priv; + + /* See if that type has caused a crash already. */ + + for (p = priv->crash_type_names; p != NULL; p = p->next) { + const char *crash_type_name; + + crash_type_name = (const char *) p->data; + if (strcmp (type_name, crash_type_name) == 0) { + /* This type caused a crash already. */ + return; + } + } + + /* New crash. */ + + priv->crash_type_names = g_list_prepend (priv->crash_type_names, g_strdup (type_name)); + + if (shell_view == NULL) + parent_window = NULL; + else + parent_window = GTK_WINDOW (shell_view); + + e_notice (parent_window, GNOME_MESSAGE_BOX_ERROR, + _("Ooops! The view for `%s' have died unexpectedly. :-(\n" + "This probably means that the %s component has crashed."), + uri, type_name); +} + + E_MAKE_TYPE (e_shell, "EShell", EShell, class_init, init, PARENT_TYPE) |