aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2013-07-02 21:22:18 +0800
committerMatthew Barnes <mbarnes@redhat.com>2013-07-02 22:34:12 +0800
commitf267827d67d3fd11478fbf94da9cd6095400a49c (patch)
tree29bf07f39ab001ea53bdb1bd67c32242e53c0944 /calendar
parentdfc653bb43a6311c04d7881c2d1b1642c081f839 (diff)
downloadgsoc2013-evolution-f267827d67d3fd11478fbf94da9cd6095400a49c.tar
gsoc2013-evolution-f267827d67d3fd11478fbf94da9cd6095400a49c.tar.gz
gsoc2013-evolution-f267827d67d3fd11478fbf94da9cd6095400a49c.tar.bz2
gsoc2013-evolution-f267827d67d3fd11478fbf94da9cd6095400a49c.tar.lz
gsoc2013-evolution-f267827d67d3fd11478fbf94da9cd6095400a49c.tar.xz
gsoc2013-evolution-f267827d67d3fd11478fbf94da9cd6095400a49c.tar.zst
gsoc2013-evolution-f267827d67d3fd11478fbf94da9cd6095400a49c.zip
ETableSpecification: Implement GInitable.
e_table_specification_new() now takes a table specification filename and a GError and parses the file as part of instance creation. If a file or parse error occurs, e_table_specification_new() returns NULL. This replaces e_table_specification_load_from_file(). New functions: e_table_specification_get_filename() Removed functions: e_table_specification_load_from_file()
Diffstat (limited to 'calendar')
-rw-r--r--calendar/gui/e-cal-list-view.c10
-rw-r--r--calendar/gui/e-memo-table.c12
-rw-r--r--calendar/gui/e-task-table.c12
3 files changed, 28 insertions, 6 deletions
diff --git a/calendar/gui/e-cal-list-view.c b/calendar/gui/e-cal-list-view.c
index 801433e739..844ce26480 100644
--- a/calendar/gui/e-cal-list-view.c
+++ b/calendar/gui/e-cal-list-view.c
@@ -173,6 +173,7 @@ setup_e_table (ECalListView *cal_list_view)
GtkWidget *container;
GtkWidget *widget;
gchar *etspecfile;
+ GError *local_error = NULL;
model = e_calendar_view_get_model (E_CALENDAR_VIEW (cal_list_view));
@@ -286,8 +287,13 @@ setup_e_table (ECalListView *cal_list_view)
etspecfile = g_build_filename (
EVOLUTION_ETSPECDIR, "e-cal-list-view.etspec", NULL);
- specification = e_table_specification_new ();
- e_table_specification_load_from_file (specification, etspecfile);
+ specification = e_table_specification_new (etspecfile, &local_error);
+
+ /* Failure here is fatal. */
+ if (local_error != NULL) {
+ g_error ("%s: %s", etspecfile, local_error->message);
+ g_assert_not_reached ();
+ }
widget = e_table_new (E_TABLE_MODEL (model), extras, specification);
gtk_container_add (GTK_CONTAINER (container), widget);
diff --git a/calendar/gui/e-memo-table.c b/calendar/gui/e-memo-table.c
index 7537dc8130..4609356914 100644
--- a/calendar/gui/e-memo-table.c
+++ b/calendar/gui/e-memo-table.c
@@ -332,6 +332,7 @@ memo_table_constructed (GObject *object)
ETableSpecification *specification;
AtkObject *a11y;
gchar *etspecfile;
+ GError *local_error = NULL;
memo_table = E_MEMO_TABLE (object);
model = e_memo_table_get_model (memo_table);
@@ -408,12 +409,19 @@ memo_table_constructed (GObject *object)
etspecfile = g_build_filename (
EVOLUTION_ETSPECDIR, "e-memo-table.etspec", NULL);
- specification = e_table_specification_new ();
- e_table_specification_load_from_file (specification, etspecfile);
+ specification = e_table_specification_new (etspecfile, &local_error);
+
+ /* Failure here is fatal. */
+ if (local_error != NULL) {
+ g_error ("%s: %s", etspecfile, local_error->message);
+ g_assert_not_reached ();
+ }
+
e_table_construct (
E_TABLE (memo_table),
E_TABLE_MODEL (model),
extras, specification);
+
g_object_unref (specification);
g_free (etspecfile);
diff --git a/calendar/gui/e-task-table.c b/calendar/gui/e-task-table.c
index e0e817ec48..ddcc54dce0 100644
--- a/calendar/gui/e-task-table.c
+++ b/calendar/gui/e-task-table.c
@@ -460,6 +460,7 @@ task_table_constructed (GObject *object)
AtkObject *a11y;
gchar *etspecfile;
gint percent;
+ GError *local_error = NULL;
task_table = E_TASK_TABLE (object);
model = e_task_table_get_model (task_table);
@@ -695,12 +696,19 @@ task_table_constructed (GObject *object)
etspecfile = g_build_filename (
EVOLUTION_ETSPECDIR, "e-calendar-table.etspec", NULL);
- specification = e_table_specification_new ();
- e_table_specification_load_from_file (specification, etspecfile);
+ specification = e_table_specification_new (etspecfile, &local_error);
+
+ /* Failure here is fatal. */
+ if (local_error != NULL) {
+ g_error ("%s: %s", etspecfile, local_error->message);
+ g_assert_not_reached ();
+ }
+
e_table_construct (
E_TABLE (task_table),
E_TABLE_MODEL (model),
extras, specification);
+
g_object_unref (specification);
g_free (etspecfile);