add GError return for error details & return errors.
2004-05-11 Not Zed <NotZed@Ximian.com> * gui/migration.c (migrate_calendars, migrate_tasks): add GError return for error details & return errors. * gui/calendar-component.c (impl_upgradeFromVersion): fix for api change, and erturn exception if we need to. svn path=/trunk/; revision=25865
This commit is contained in:
@ -1,3 +1,11 @@
|
||||
2004-05-11 Not Zed <NotZed@Ximian.com>
|
||||
|
||||
* gui/migration.c (migrate_calendars, migrate_tasks): add GError
|
||||
return for error details & return errors.
|
||||
|
||||
* gui/calendar-component.c (impl_upgradeFromVersion): fix for api
|
||||
change, and erturn exception if we need to.
|
||||
|
||||
2004-05-11 Rodrigo Moya <rodrigo@ximian.com>
|
||||
|
||||
* gui/e-itip-control.c (update_item): get error information from
|
||||
|
||||
@ -606,18 +606,27 @@ conf_changed_callback (GConfClient *client,
|
||||
|
||||
/* Evolution::Component CORBA methods. */
|
||||
|
||||
static CORBA_boolean
|
||||
static void
|
||||
impl_upgradeFromVersion (PortableServer_Servant servant,
|
||||
CORBA_short major,
|
||||
CORBA_short minor,
|
||||
CORBA_short revision,
|
||||
CORBA_Environment *ev)
|
||||
{
|
||||
GError *err = NULL;
|
||||
CalendarComponent *calendar_component = CALENDAR_COMPONENT (bonobo_object_from_servant (servant));
|
||||
|
||||
migrate_calendars (calendar_component, major, minor, revision);
|
||||
if (!migrate_calendars (calendar_component, major, minor, revision, &err)) {
|
||||
GNOME_Evolution_Component_UpgradeFailed *failedex;
|
||||
|
||||
return CORBA_TRUE;
|
||||
failedex = GNOME_Evolution_Component_UpgradeFailed__alloc();
|
||||
failedex->what = CORBA_string_dup(_("Failed upgrading calendars."));
|
||||
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 gboolean
|
||||
|
||||
@ -669,11 +669,11 @@ migrate_pilot_data (const char *component, const char *conduit, const char *old_
|
||||
}
|
||||
|
||||
gboolean
|
||||
migrate_calendars (CalendarComponent *component, int major, int minor, int revision)
|
||||
migrate_calendars (CalendarComponent *component, int major, int minor, int revision, GError **err)
|
||||
{
|
||||
ESourceGroup *on_this_computer = NULL, *on_the_web = NULL, *contacts = NULL;
|
||||
ESource *personal_source = NULL;
|
||||
gboolean retval = TRUE;
|
||||
gboolean retval = FALSE;
|
||||
|
||||
/* we call this unconditionally now - create_groups either
|
||||
creates the groups/sources or it finds the necessary
|
||||
@ -704,8 +704,9 @@ migrate_calendars (CalendarComponent *component, int major, int minor, int revis
|
||||
xmlFreeDoc(config_doc);
|
||||
|
||||
if (res != 0) {
|
||||
g_warning("Could not move config from bonobo-conf to gconf");
|
||||
return FALSE;
|
||||
/* FIXME: set proper domain/code */
|
||||
g_set_error(err, 0, 0, _("Unable to migrate old settings from evolution/config.xmldb"));
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
@ -731,8 +732,12 @@ migrate_calendars (CalendarComponent *component, int major, int minor, int revis
|
||||
|
||||
source_name = get_source_name (on_this_computer, (char*)l->data);
|
||||
|
||||
if (!migrate_ical_folder (l->data, on_this_computer, source_name, E_CAL_SOURCE_TYPE_EVENT))
|
||||
retval = FALSE;
|
||||
if (!migrate_ical_folder (l->data, on_this_computer, source_name, E_CAL_SOURCE_TYPE_EVENT)) {
|
||||
/* FIXME: domain/code */
|
||||
g_set_error(err, 0, 0, _("Unable to migrate calendar `%s'"), source_name);
|
||||
g_free(source_name);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
g_free (source_name);
|
||||
}
|
||||
@ -781,7 +786,8 @@ migrate_calendars (CalendarComponent *component, int major, int minor, int revis
|
||||
}
|
||||
|
||||
e_source_list_sync (calendar_component_peek_source_list (component), NULL);
|
||||
|
||||
retval = TRUE;
|
||||
fail:
|
||||
if (on_this_computer)
|
||||
g_object_unref (on_this_computer);
|
||||
if (on_the_web)
|
||||
@ -795,12 +801,12 @@ migrate_calendars (CalendarComponent *component, int major, int minor, int revis
|
||||
}
|
||||
|
||||
gboolean
|
||||
migrate_tasks (TasksComponent *component, int major, int minor, int revision)
|
||||
migrate_tasks (TasksComponent *component, int major, int minor, int revision, GError **err)
|
||||
{
|
||||
ESourceGroup *on_this_computer = NULL;
|
||||
ESourceGroup *on_the_web = NULL;
|
||||
ESource *personal_source = NULL;
|
||||
gboolean retval = TRUE;
|
||||
gboolean retval = FALSE;
|
||||
|
||||
/* we call this unconditionally now - create_groups either
|
||||
creates the groups/sources or it finds the necessary
|
||||
@ -831,8 +837,8 @@ migrate_tasks (TasksComponent *component, int major, int minor, int revision)
|
||||
xmlFreeDoc(config_doc);
|
||||
|
||||
if (res != 0) {
|
||||
g_warning("Could not move config from bonobo-conf to gconf");
|
||||
return FALSE;
|
||||
g_set_error(err, 0, 0, _("Unable to migrate old settings from evolution/config.xmldb"));
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
@ -858,8 +864,12 @@ migrate_tasks (TasksComponent *component, int major, int minor, int revision)
|
||||
|
||||
source_name = get_source_name (on_this_computer, (char*)l->data);
|
||||
|
||||
if (!migrate_ical_folder (l->data, on_this_computer, source_name, E_CAL_SOURCE_TYPE_TODO))
|
||||
retval = FALSE;
|
||||
if (!migrate_ical_folder (l->data, on_this_computer, source_name, E_CAL_SOURCE_TYPE_TODO)) {
|
||||
/* FIXME: domain/code */
|
||||
g_set_error(err, 0, 0, _("Unable to migrate tasks `%s'"), source_name);
|
||||
g_free(source_name);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
g_free (source_name);
|
||||
}
|
||||
@ -882,7 +892,8 @@ migrate_tasks (TasksComponent *component, int major, int minor, int revision)
|
||||
}
|
||||
|
||||
e_source_list_sync (tasks_component_peek_source_list (component), NULL);
|
||||
|
||||
retval = TRUE;
|
||||
fail:
|
||||
if (on_this_computer)
|
||||
g_object_unref (on_this_computer);
|
||||
if (on_the_web)
|
||||
|
||||
@ -27,7 +27,9 @@
|
||||
#include "calendar-component.h"
|
||||
#include "tasks-component.h"
|
||||
|
||||
gboolean migrate_calendars (CalendarComponent *component, int major, int minor, int revision);
|
||||
gboolean migrate_tasks (TasksComponent *component, int major, int minor, int revision);
|
||||
struct _GError;
|
||||
|
||||
gboolean migrate_calendars (CalendarComponent *component, int major, int minor, int revision, struct _GError **err);
|
||||
gboolean migrate_tasks (TasksComponent *component, int major, int minor, int revision, struct _GError **err);
|
||||
|
||||
#endif
|
||||
|
||||
@ -430,16 +430,27 @@ model_rows_deleted_cb (ETableModel *etm, int row, int count, TasksComponentView
|
||||
|
||||
/* Evolution::Component CORBA methods */
|
||||
|
||||
static CORBA_boolean
|
||||
static void
|
||||
impl_upgradeFromVersion (PortableServer_Servant servant,
|
||||
CORBA_short major,
|
||||
CORBA_short minor,
|
||||
CORBA_short revision,
|
||||
CORBA_Environment *ev)
|
||||
{
|
||||
GError *err = NULL;
|
||||
TasksComponent *component = TASKS_COMPONENT (bonobo_object_from_servant (servant));
|
||||
|
||||
return migrate_tasks (component, major, minor, revision);
|
||||
if (!migrate_tasks(component, major, minor, revision, &err)) {
|
||||
GNOME_Evolution_Component_UpgradeFailed *failedex;
|
||||
|
||||
failedex = GNOME_Evolution_Component_UpgradeFailed__alloc();
|
||||
failedex->what = CORBA_string_dup(_("Failed upgrading tasks."));
|
||||
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 void
|
||||
|
||||
Reference in New Issue
Block a user