From 97a9bd320d00f4a194d6948cf9d54435b04a331e Mon Sep 17 00:00:00 2001 From: Not Zed Date: Wed, 12 May 2004 03:31:55 +0000 Subject: set exception properly on failure. 2004-05-11 Not Zed * gui/component/addressbook-component.c (impl_upgradeFromVersion): set exception properly on failure. * gui/component/addressbook-migrate.c (addressbook_migrate): take a GError error return. Doesn't do anything with it ... but ... svn path=/trunk/; revision=25864 --- addressbook/ChangeLog | 8 ++++++++ addressbook/gui/component/addressbook-component.c | 16 ++++++++++++++-- addressbook/gui/component/addressbook-migrate.c | 2 +- addressbook/gui/component/addressbook-migrate.h | 4 +++- 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 69bd24572a..efa83d0e7f 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,11 @@ +2004-05-11 Not Zed + + * gui/component/addressbook-component.c (impl_upgradeFromVersion): + set exception properly on failure. + + * gui/component/addressbook-migrate.c (addressbook_migrate): take + a GError error return. Doesn't do anything with it ... but ... + 2004-05-11 Dan Winship * gui/component/GNOME_Evolution_Addressbook.server.in.in: Remove diff --git a/addressbook/gui/component/addressbook-component.c b/addressbook/gui/component/addressbook-component.c index ad43ba8f27..e74b0d7dda 100644 --- a/addressbook/gui/component/addressbook-component.c +++ b/addressbook/gui/component/addressbook-component.c @@ -170,10 +170,22 @@ impl_requestCreateItem (PortableServer_Servant servant, e_book_async_get_default_addressbook (book_loaded_cb, g_strdup (item_type_name)); } -static CORBA_boolean +static void impl_upgradeFromVersion (PortableServer_Servant servant, short major, short minor, short revision, CORBA_Environment *ev) { - return addressbook_migrate (addressbook_component_peek (), major, minor, revision); + GError *err = NULL; + + if (!addressbook_migrate (addressbook_component_peek (), major, minor, revision, &err)) { + GNOME_Evolution_Component_UpgradeFailed *failedex; + + failedex = GNOME_Evolution_Component_UpgradeFailed__alloc(); + failedex->what = CORBA_string_dup(_("Failed upgrading Addressbook settings or folders.")); + failedex->why = CORBA_string_dup(err->message); + CORBA_exception_set(ev, CORBA_USER_EXCEPTION, ex_GNOME_Evolution_Component_UpgradeFailed, failedex); + } + + if (err) + g_error_free(err); } static CORBA_boolean diff --git a/addressbook/gui/component/addressbook-migrate.c b/addressbook/gui/component/addressbook-migrate.c index 5474ba9c00..32fbf1ca3e 100644 --- a/addressbook/gui/component/addressbook-migrate.c +++ b/addressbook/gui/component/addressbook-migrate.c @@ -1043,7 +1043,7 @@ migration_context_free (MigrationContext *context) } int -addressbook_migrate (AddressbookComponent *component, int major, int minor, int revision) +addressbook_migrate (AddressbookComponent *component, int major, int minor, int revision, GError **err) { ESourceGroup *on_this_computer; ESourceGroup *on_ldap_servers; diff --git a/addressbook/gui/component/addressbook-migrate.h b/addressbook/gui/component/addressbook-migrate.h index 89dce7a91b..dc7c473e12 100644 --- a/addressbook/gui/component/addressbook-migrate.h +++ b/addressbook/gui/component/addressbook-migrate.h @@ -24,6 +24,8 @@ #include "addressbook-component.h" -int addressbook_migrate (AddressbookComponent *component, int major, int minor, int revision); +struct _GError; + +int addressbook_migrate (AddressbookComponent *component, int major, int minor, int revision, struct _GError **err); #endif /* _ADDRESSBOOK_MIGRATE_H_ */ -- cgit v1.2.3