aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2000-11-07 06:18:29 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2000-11-07 06:18:29 +0800
commit45cc7467dafdecd1b7f793c72ed8bbb3fe2ee5da (patch)
treef1989ba74348c7c372aca3a5c67c3096c34e1ce7
parentf2178aee93cf94dbc14c34628ca4671e348d7a2f (diff)
downloadgsoc2013-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
-rw-r--r--shell/ChangeLog7
-rw-r--r--shell/e-shell-view.c8
-rw-r--r--shell/e-shell.c66
-rw-r--r--shell/e-shell.h5
4 files changed, 81 insertions, 5 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index a04c095269..427567acf5 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,5 +1,12 @@
2000-11-06 Ettore Perazzoli <ettore@helixcode.com>
+ * e-shell.c: New member `crash_type_names' in `EShellPrivate'.
+ (init): Init to NULL.
+ (destroy): Free.
+ (e_shell_component_maybe_crashed): New.
+
+2000-11-06 Ettore Perazzoli <ettore@helixcode.com>
+
* evolution-shell-component.c (impl_ShellComponent_create_view):
`CORBA_Object_duplicate()' the return value.
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index f3ce68ad07..36e41beb6b 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -1163,10 +1163,10 @@ socket_destroy_cb (GtkWidget *socket_widget, gpointer data)
e_shell_view_display_uri (shell_view, NULL);
- e_notice (GTK_WINDOW (shell_view), GNOME_MESSAGE_BOX_ERROR,
- _("Ooops! The view for `%s' has died unexpectedly. :-(\n"
- "This probably means that the %s component has crashed."),
- uri, e_folder_get_type_string (folder));
+ e_shell_component_maybe_crashed (priv->shell,
+ uri,
+ e_folder_get_type_string (folder),
+ shell_view);
g_free (copy_of_uri);
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)
diff --git a/shell/e-shell.h b/shell/e-shell.h
index 98545b396d..17444967a1 100644
--- a/shell/e-shell.h
+++ b/shell/e-shell.h
@@ -85,6 +85,11 @@ gboolean e_shell_restore_from_settings (EShell *shell);
void e_shell_quit (EShell *shell);
+void e_shell_component_maybe_crashed (EShell *shell,
+ const char *uri,
+ const char *type_name,
+ EShellView *shell_view);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */