aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2004-05-12 11:32:19 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-05-12 11:32:19 +0800
commit63ca6c19ab323142c1362afe95f6acf1259d2ecf (patch)
tree7fc3bc513a980f35e126543154dd908ae1b1a448 /calendar
parent97a9bd320d00f4a194d6948cf9d54435b04a331e (diff)
downloadgsoc2013-evolution-63ca6c19ab323142c1362afe95f6acf1259d2ecf.tar
gsoc2013-evolution-63ca6c19ab323142c1362afe95f6acf1259d2ecf.tar.gz
gsoc2013-evolution-63ca6c19ab323142c1362afe95f6acf1259d2ecf.tar.bz2
gsoc2013-evolution-63ca6c19ab323142c1362afe95f6acf1259d2ecf.tar.lz
gsoc2013-evolution-63ca6c19ab323142c1362afe95f6acf1259d2ecf.tar.xz
gsoc2013-evolution-63ca6c19ab323142c1362afe95f6acf1259d2ecf.tar.zst
gsoc2013-evolution-63ca6c19ab323142c1362afe95f6acf1259d2ecf.zip
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
Diffstat (limited to 'calendar')
-rw-r--r--calendar/ChangeLog8
-rw-r--r--calendar/gui/calendar-component.c15
-rw-r--r--calendar/gui/migration.c39
-rw-r--r--calendar/gui/migration.h6
-rw-r--r--calendar/gui/tasks-component.c15
5 files changed, 62 insertions, 21 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index ece744dd01..96b56aac6c 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -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
diff --git a/calendar/gui/calendar-component.c b/calendar/gui/calendar-component.c
index 28500e7001..74cd196560 100644
--- a/calendar/gui/calendar-component.c
+++ b/calendar/gui/calendar-component.c
@@ -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;
+
+ 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);
+ }
- return CORBA_TRUE;
+ if (err)
+ g_error_free(err);
}
static gboolean
diff --git a/calendar/gui/migration.c b/calendar/gui/migration.c
index e1d6731ba4..fa449d5f17 100644
--- a/calendar/gui/migration.c
+++ b/calendar/gui/migration.c
@@ -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)
diff --git a/calendar/gui/migration.h b/calendar/gui/migration.h
index b7047d0898..1092e30c14 100644
--- a/calendar/gui/migration.h
+++ b/calendar/gui/migration.h
@@ -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
diff --git a/calendar/gui/tasks-component.c b/calendar/gui/tasks-component.c
index d0b556095c..60559f825a 100644
--- a/calendar/gui/tasks-component.c
+++ b/calendar/gui/tasks-component.c
@@ -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