diff options
author | Dan Winship <danw@src.gnome.org> | 2001-10-14 01:28:42 +0800 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2001-10-14 01:28:42 +0800 |
commit | e3ab855984902fdc48f3e8703e2f30c005a214b2 (patch) | |
tree | 132f9912a63b584f1dec19e61b31997fe8bb5c1f | |
parent | b59df6df3099258b0cbbd06f1d030a61b655dc0c (diff) | |
download | gsoc2013-evolution-e3ab855984902fdc48f3e8703e2f30c005a214b2.tar gsoc2013-evolution-e3ab855984902fdc48f3e8703e2f30c005a214b2.tar.gz gsoc2013-evolution-e3ab855984902fdc48f3e8703e2f30c005a214b2.tar.bz2 gsoc2013-evolution-e3ab855984902fdc48f3e8703e2f30c005a214b2.tar.lz gsoc2013-evolution-e3ab855984902fdc48f3e8703e2f30c005a214b2.tar.xz gsoc2013-evolution-e3ab855984902fdc48f3e8703e2f30c005a214b2.tar.zst gsoc2013-evolution-e3ab855984902fdc48f3e8703e2f30c005a214b2.zip |
New function to try to activate a component when you know it's going to
* evolution-shell-component-utils.c (e_activation_failure_dialog):
New function to try to activate a component when you know it's
going to fail, and then pop up a dialog explaining why it failed.
svn path=/trunk/; revision=13657
-rw-r--r-- | shell/ChangeLog | 6 | ||||
-rw-r--r-- | shell/evolution-shell-component-utils.c | 51 | ||||
-rw-r--r-- | shell/evolution-shell-component-utils.h | 4 |
3 files changed, 61 insertions, 0 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index fa7f5702b6..3446cf5192 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,9 @@ +2001-10-13 Dan Winship <danw@ximian.com> + + * evolution-shell-component-utils.c (e_activation_failure_dialog): + New function to try to activate a component when you know it's + going to fail, and then pop up a dialog explaining why it failed. + 2001-10-12 Iain Holmes <iain@ximian.com> * e-shell-importer.c (prepare_intelligent_page): Flush the gdk diff --git a/shell/evolution-shell-component-utils.c b/shell/evolution-shell-component-utils.c index e056fc54b3..38b307a4e5 100644 --- a/shell/evolution-shell-component-utils.c +++ b/shell/evolution-shell-component-utils.c @@ -27,8 +27,13 @@ #include "evolution-shell-component-utils.h" #include <libgnome/gnome-defs.h> +#include <libgnome/gnome-i18n.h> #include <libgnome/gnome-util.h> #include <bonobo/bonobo-ui-util.h> +#include <bonobo/bonobo-moniker-util.h> +#include <bonobo/bonobo-exception.h> +#include <liboaf/oaf.h> +#include <gal/widgets/e-gui-utils.h> static void free_pixmaps (void); static GSList *inited_arrays = NULL; @@ -90,3 +95,49 @@ free_pixmaps (void) g_slist_free (inited_arrays); } + +/** + * e_activation_failure_dialog: + * @parent: parent window of the dialog, or %NULL + * @msg: the context-specific part of the error message + * @oafiid: the OAFIID of the component that failed to start + * @repo_id: the repo_id of the component that failed to start + * + * This puts up an error dialog about a failed component activation + * containing as much information as we can manage to gather about + * why it failed. + **/ +void +e_activation_failure_dialog (GtkWindow *parent, const char *msg, + const char *oafiid, const char *repo_id) +{ + Bonobo_Unknown object; + CORBA_Environment ev; + char *errmsg; + + CORBA_exception_init (&ev); + object = bonobo_get_object (oafiid, repo_id, &ev); + if (ev._major == CORBA_NO_EXCEPTION) { + if (object) { + Bonobo_Unknown_unref (object, &ev); + CORBA_Object_release (object, &ev); + } + errmsg = g_strdup_printf (_("%s\n\nUnknown error."), msg); + } else if (strcmp (CORBA_exception_id (&ev), ex_OAF_GeneralError) != 0) { + char *bonobo_err = bonobo_exception_get_text (&ev); + errmsg = g_strdup_printf (_("%s\n\nThe error from the " + "component system is:\n%s"), + msg, bonobo_err); + g_free (bonobo_err); + } else { + OAF_GeneralError *errval = CORBA_exception_value (&ev); + + errmsg = g_strdup_printf (_("%s\n\nThe error from the " + "activation system is:\n%s"), + msg, errval->description); + } + CORBA_exception_free (&ev); + + e_notice (parent, GNOME_MESSAGE_BOX_ERROR, errmsg); + g_free (errmsg); +} diff --git a/shell/evolution-shell-component-utils.h b/shell/evolution-shell-component-utils.h index 4cf021ca64..c656927751 100644 --- a/shell/evolution-shell-component-utils.h +++ b/shell/evolution-shell-component-utils.h @@ -23,6 +23,7 @@ #define __EVOLUTION_SHELL_COMPONENT_UTILS_H__ #include <bonobo/bonobo-ui-component.h> +#include <gtk/gtkwindow.h> #ifdef __cplusplus extern "C" { @@ -41,6 +42,9 @@ typedef struct _EPixmap { /* Takes an array of pixmaps, terminated by E_PIXMAP_END, and loads into uic */ void e_pixmaps_update (BonoboUIComponent *uic, EPixmap *pixcache); +void e_activation_failure_dialog (GtkWindow *parent, const char *msg, + const char *oafiid, const char *repo_id); + #ifdef __cplusplus } #endif /* __cplusplus */ |