Commit 7d872d04 authored by Darin Adler's avatar Darin Adler

Fix the longstanding problem where the Notes and History sidebar

	panels failed to load.

	* libnautilus-private/nautilus-directory-metafile.c:
	(die_on_failed_activation): Give better error messages.
	(get_factory): Check the ev result from oaf_activate_from_id
	rather than relying on getting NIL when it fails.
	(open_metafile): New helper function.
	(get_metafile): Don't complain if the open call fails the first
	time, and re-get the factory and retry before doing a g_error.
parent 3f17e76e
2001-10-02 Darin Adler <darin@bentspoon.com>
Fix the longstanding problem where the Notes and History sidebar
panels failed to load.
* libnautilus-private/nautilus-directory-metafile.c:
(die_on_failed_activation): Give better error messages.
(get_factory): Check the ev result from oaf_activate_from_id
rather than relying on getting NIL when it fails.
(open_metafile): New helper function.
(get_metafile): Don't complain if the open call fails the first
time, and re-get the factory and retry before doing a g_error.
2001-10-02 Darin Adler <darin@bentspoon.com>
* src/nautilus-window.c: (nautilus_window_destroy),
......
......@@ -53,40 +53,32 @@ free_factory (void)
static void
die_on_failed_activation (const char *server_name,
die_on_failed_activation (const char *server_name,
CORBA_Environment *ev)
{
/* This isn't supposed to happen. So do some core-dumping action,
* and don't bother translating the error message.
/* This isn't supposed to happen. So do some core-dumping
* action, and don't bother translating the error message.
*/
const char *extra;
extra = NULL;
const char *details;
OAF_GeneralError *general_error;
switch (ev->_major) {
case CORBA_NO_EXCEPTION:
details = "got NIL but no exception";
break;
case CORBA_SYSTEM_EXCEPTION:
extra = CORBA_exception_id (ev);
break;
case CORBA_USER_EXCEPTION:
{
const gchar* id = CORBA_exception_id (ev);
if (strcmp (id, "IDL:OAF/GeneralError:1.0") == 0) {
OAF_GeneralError* ge = CORBA_exception_value (ev);
extra = ge->description;
} else {
extra = id;
}
details = CORBA_exception_id (ev);
if (strcmp (details, "IDL:OAF/GeneralError:1.0") == 0) {
general_error = CORBA_exception_value (ev);
details = general_error->description;
}
break;
default:
g_assert_not_reached ();
details = "got bad exception";
break;
}
......@@ -94,26 +86,23 @@ die_on_failed_activation (const char *server_name,
"Nautilus or OAF installation, or may reflect a bug in something,\n"
"or may mean that your PATH or LD_LIBRARY_PATH or the like is\n"
"incorrect. Nautilus will dump core and exit.\n"
"Details: '%s'", server_name, extra);
"Details: '%s'", server_name, details);
}
static Nautilus_MetafileFactory
get_factory (void)
{
NautilusMetafileFactory *instance;
CORBA_Environment ev;
if (factory == CORBA_OBJECT_NIL) {
if (get_factory_from_oaf) {
CORBA_Environment ev;
CORBA_exception_init (&ev);
factory = oaf_activate_from_id (METAFILE_FACTORY_IID, 0,
NULL, &ev);
if (factory == CORBA_OBJECT_NIL) {
die_on_failed_activation ("Nautilus_MetafileFactory",
&ev);
if (ev._major != CORBA_NO_EXCEPTION || factory == CORBA_OBJECT_NIL) {
die_on_failed_activation ("Nautilus_MetafileFactory", &ev);
}
CORBA_exception_free (&ev);
......@@ -129,26 +118,44 @@ get_factory (void)
}
static Nautilus_Metafile
get_metafile (NautilusDirectory *directory)
open_metafile (const char *uri, gboolean make_errors_fatal)
{
char *uri;
Nautilus_Metafile metafile;
CORBA_Environment ev;
if (directory->details->metafile_corba_object == CORBA_OBJECT_NIL) {
uri = nautilus_directory_get_uri (directory);
CORBA_exception_init (&ev);
CORBA_exception_init (&ev);
directory->details->metafile_corba_object = Nautilus_MetafileFactory_open (get_factory (), uri, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
g_error ("%s: CORBA error opening MetafileFactory: %s\n",
metafile = Nautilus_MetafileFactory_open (get_factory (), (char *) uri, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
metafile = CORBA_OBJECT_NIL;
if (make_errors_fatal) {
g_error ("%s: CORBA error opening MetafileFactory: %s",
g_get_prgname (),
CORBA_exception_id (&ev));
}
CORBA_exception_free (&ev);
}
CORBA_exception_free (&ev);
return metafile;
}
static Nautilus_Metafile
get_metafile (NautilusDirectory *directory)
{
char *uri;
if (directory->details->metafile_corba_object == CORBA_OBJECT_NIL) {
uri = nautilus_directory_get_uri (directory);
directory->details->metafile_corba_object = open_metafile (uri, !get_factory_from_oaf);
if (directory->details->metafile_corba_object == NULL) {
g_assert (get_factory_from_oaf);
factory = CORBA_OBJECT_NIL;
directory->details->metafile_corba_object = open_metafile (uri, TRUE);
}
g_free (uri);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment