aboutsummaryrefslogtreecommitdiffstats
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
parentdfc653bb43a6311c04d7881c2d1b1642c081f839 (diff)
downloadgsoc2013-evolution-f267827d67d3fd11478fbf94da9cd6095400a49c.tar.gz
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()
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.c16
-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
-rw-r--r--doc/reference/evolution-util/evolution-util-sections.txt2
-rw-r--r--e-util/e-table-specification.c207
-rw-r--r--e-util/e-table-specification.h8
-rw-r--r--mail/e-mail-paned-view.c17
-rw-r--r--mail/message-list.c12
-rw-r--r--modules/addressbook/e-book-shell-view-private.c16
-rw-r--r--modules/calendar/e-cal-shell-view-private.c16
-rw-r--r--modules/calendar/e-memo-shell-view-private.c16
-rw-r--r--modules/calendar/e-task-shell-view-private.c16
-rw-r--r--modules/mail/e-mail-shell-view-private.c16
14 files changed, 267 insertions, 109 deletions
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c
index 1bbbe04882..763ff87268 100644
--- a/addressbook/gui/widgets/e-addressbook-view.c
+++ b/addressbook/gui/widgets/e-addressbook-view.c
@@ -292,6 +292,7 @@ addressbook_view_create_table_view (EAddressbookView *view,
ECell *cell;
GtkWidget *widget;
gchar *etspecfile;
+ GError *local_error = NULL;
adapter = e_addressbook_table_adapter_new (view->priv->model);
@@ -301,14 +302,19 @@ addressbook_view_create_table_view (EAddressbookView *view,
cell = e_table_extras_get_cell (extras, "date");
e_cell_date_set_format_component (E_CELL_DATE (cell), "addressbook");
- /* Here we create the table. We give it the three pieces of
- * the table we've created, the header, the model, and the
- * initial layout. It does the rest. */
etspecfile = g_build_filename (
EVOLUTION_ETSPECDIR, "e-addressbook-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 ();
+ }
+ /* Here we create the table. We give it the three pieces of
+ * the table we've created, the header, the model, and the
+ * initial layout. It does the rest. */
widget = e_table_new (adapter, extras, specification);
gtk_container_add (GTK_CONTAINER (view), widget);
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);
diff --git a/doc/reference/evolution-util/evolution-util-sections.txt b/doc/reference/evolution-util/evolution-util-sections.txt
index b5014cabce..1cbf2ae268 100644
--- a/doc/reference/evolution-util/evolution-util-sections.txt
+++ b/doc/reference/evolution-util/evolution-util-sections.txt
@@ -3874,9 +3874,9 @@ e_table_sorting_utils_lookup_cmp_cache
<TITLE>ETableSpecification</TITLE>
ETableSpecification
e_table_specification_new
+e_table_specification_get_filename
e_table_specification_ref_columns
e_table_specification_get_column_index
-e_table_specification_load_from_file
<SUBSECTION Standard>
E_TABLE_SPECIFICATION
E_IS_TABLE_SPECIFICATION
diff --git a/e-util/e-table-specification.c b/e-util/e-table-specification.c
index 348912acc5..bacb5ece75 100644
--- a/e-util/e-table-specification.c
+++ b/e-util/e-table-specification.c
@@ -31,12 +31,25 @@
struct _ETableSpecificationPrivate {
GPtrArray *columns;
+ gchar *filename;
};
-G_DEFINE_TYPE (
+enum {
+ PROP_0,
+ PROP_FILENAME
+};
+
+/* Forward Declarations */
+static void e_table_specification_initable_init
+ (GInitableIface *interface);
+
+G_DEFINE_TYPE_WITH_CODE (
ETableSpecification,
e_table_specification,
- G_TYPE_OBJECT)
+ G_TYPE_OBJECT,
+ G_IMPLEMENT_INTERFACE (
+ G_TYPE_INITABLE,
+ e_table_specification_initable_init))
static void
table_specification_start_specification (GMarkupParseContext *context,
@@ -401,6 +414,51 @@ static const GMarkupParser table_specification_parser = {
};
static void
+table_specification_set_filename (ETableSpecification *specification,
+ const gchar *filename)
+{
+ g_return_if_fail (filename != NULL);
+ g_return_if_fail (specification->priv->filename == NULL);
+
+ specification->priv->filename = g_strdup (filename);
+}
+
+static void
+table_specification_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_FILENAME:
+ table_specification_set_filename (
+ E_TABLE_SPECIFICATION (object),
+ g_value_get_string (value));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
+table_specification_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ switch (property_id) {
+ case PROP_FILENAME:
+ g_value_set_string (
+ value,
+ e_table_specification_get_filename (
+ E_TABLE_SPECIFICATION (object)));
+ return;
+ }
+
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+}
+
+static void
table_specification_dispose (GObject *object)
{
ETableSpecification *specification;
@@ -426,11 +484,55 @@ table_specification_finalize (GObject *object)
g_free (specification->domain);
g_ptr_array_unref (specification->priv->columns);
+ g_free (specification->priv->filename);
/* Chain up to parent's finalize() method. */
G_OBJECT_CLASS (e_table_specification_parent_class)->finalize (object);
}
+static gboolean
+table_specification_initable_init (GInitable *initable,
+ GCancellable *cancellable,
+ GError **error)
+{
+ ETableSpecification *specification;
+ GMarkupParseContext *context;
+ const gchar *filename;
+ gchar *contents = NULL;
+ gboolean success = FALSE;
+
+ specification = E_TABLE_SPECIFICATION (initable);
+ filename = e_table_specification_get_filename (specification);
+ g_return_val_if_fail (filename != NULL, FALSE);
+
+ if (!g_file_get_contents (filename, &contents, NULL, error)) {
+ g_warn_if_fail (contents == NULL);
+ return FALSE;
+ }
+
+ context = g_markup_parse_context_new (
+ &table_specification_parser,
+ 0, /* no flags */
+ g_object_ref (specification),
+ (GDestroyNotify) g_object_unref);
+
+ if (g_markup_parse_context_parse (context, contents, -1, error))
+ success = g_markup_parse_context_end_parse (context, error);
+
+ g_markup_parse_context_free (context);
+
+ if (specification->state == NULL)
+ specification->state = e_table_state_vanilla (specification);
+
+ e_table_sort_info_set_can_group (
+ specification->state->sort_info,
+ specification->allow_grouping);
+
+ g_free (contents);
+
+ return success;
+}
+
static void
e_table_specification_class_init (ETableSpecificationClass *class)
{
@@ -439,8 +541,28 @@ e_table_specification_class_init (ETableSpecificationClass *class)
g_type_class_add_private (class, sizeof (ETableSpecificationPrivate));
object_class = G_OBJECT_CLASS (class);
+ object_class->set_property = table_specification_set_property;
+ object_class->get_property = table_specification_get_property;
object_class->dispose = table_specification_dispose;
object_class->finalize = table_specification_finalize;
+
+ g_object_class_install_property (
+ object_class,
+ PROP_FILENAME,
+ g_param_spec_string (
+ "filename",
+ "Filename",
+ "Name of the table specification file",
+ NULL,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_STRINGS));
+}
+
+static void
+e_table_specification_initable_init (GInitableIface *interface)
+{
+ interface->init = table_specification_initable_init;
}
static void
@@ -469,16 +591,37 @@ e_table_specification_init (ETableSpecification *specification)
/**
* e_table_specification_new:
+ * @filename: a table specification file
+ * @error: return location for a #GError, or %NULL
*
- * Creates a new #ETableSpecification. This holds the rendering information
- * for an #ETable.
+ * Creates a new #ETableSpecification from @filename. If a file or parse
+ * error occurs, the function sets @error and returns %NULL.
*
- * Returns: an #ETableSpecification
+ * Returns: an #ETableSpecification, or %NULL
*/
ETableSpecification *
-e_table_specification_new (void)
+e_table_specification_new (const gchar *filename,
+ GError **error)
{
- return g_object_new (E_TYPE_TABLE_SPECIFICATION, NULL);
+ return g_initable_new (
+ E_TYPE_TABLE_SPECIFICATION, NULL, error,
+ "filename", filename, NULL);
+}
+
+/**
+ * e_table_specification_get_filename:
+ * @specification: an #ETableSpecification
+ *
+ * Returns the filename from which @specification was loaded.
+ *
+ * Returns: the table specification filename
+ **/
+const gchar *
+e_table_specification_get_filename (ETableSpecification *specification)
+{
+ g_return_val_if_fail (E_IS_TABLE_SPECIFICATION (specification), NULL);
+
+ return specification->priv->filename;
}
/**
@@ -541,53 +684,3 @@ e_table_specification_get_column_index (ETableSpecification *specification,
return column_index;
}
-/**
- * e_table_specification_load_from_file:
- * @specification: an #ETableSpecification
- * @filename: the name of a file containing an #ETable specification
- *
- * Parses the contents of @filename and configures @specification.
- *
- * Returns: TRUE on success, FALSE on failure.
- */
-gboolean
-e_table_specification_load_from_file (ETableSpecification *specification,
- const gchar *filename)
-{
- GMarkupParseContext *context;
- gchar *contents = NULL;
- gboolean success = FALSE;
-
- g_return_val_if_fail (E_IS_TABLE_SPECIFICATION (specification), FALSE);
- g_return_val_if_fail (filename != NULL, FALSE);
-
- if (!g_file_get_contents (filename, &contents, NULL, NULL)) {
- g_warn_if_fail (contents == NULL);
- return FALSE;
- }
-
- g_ptr_array_set_size (specification->priv->columns, 0);
- g_clear_object (&specification->state);
-
- context = g_markup_parse_context_new (
- &table_specification_parser, 0,
- g_object_ref (specification),
- (GDestroyNotify) g_object_unref);
-
- if (g_markup_parse_context_parse (context, contents, -1, NULL))
- success = g_markup_parse_context_end_parse (context, NULL);
-
- g_markup_parse_context_free (context);
-
- if (specification->state == NULL)
- specification->state = e_table_state_vanilla (specification);
-
- e_table_sort_info_set_can_group (
- specification->state->sort_info,
- specification->allow_grouping);
-
- g_free (contents);
-
- return success;
-}
-
diff --git a/e-util/e-table-specification.h b/e-util/e-table-specification.h
index ff8ad062da..d5aa40a324 100644
--- a/e-util/e-table-specification.h
+++ b/e-util/e-table-specification.h
@@ -82,15 +82,15 @@ struct _ETableSpecificationClass {
GType e_table_specification_get_type (void) G_GNUC_CONST;
ETableSpecification *
- e_table_specification_new (void);
+ e_table_specification_new (const gchar *filename,
+ GError **error);
+const gchar * e_table_specification_get_filename
+ (ETableSpecification *specification);
GPtrArray * e_table_specification_ref_columns
(ETableSpecification *specification);
gint e_table_specification_get_column_index
(ETableSpecification *specification,
ETableColumnSpecification *column_spec);
-gboolean e_table_specification_load_from_file
- (ETableSpecification *specification,
- const gchar *filename);
G_END_DECLS
diff --git a/mail/e-mail-paned-view.c b/mail/e-mail-paned-view.c
index c491db7150..41c98f0e23 100644
--- a/mail/e-mail-paned-view.c
+++ b/mail/e-mail-paned-view.c
@@ -924,15 +924,22 @@ mail_paned_view_update_view_instance (EMailView *view)
ETableState *state;
GalView *view;
gchar *spec_filename;
+ GError *local_error = NULL;
- spec = e_table_specification_new ();
spec_filename = g_build_filename (
EVOLUTION_ETSPECDIR,
"message-list.etspec",
NULL);
- e_table_specification_load_from_file (
- spec, spec_filename);
- g_free (spec_filename);
+ spec = e_table_specification_new (
+ spec_filename, &local_error);
+
+ /* Failure here is fatal. */
+ if (local_error != NULL) {
+ g_error (
+ "%s: %s", spec_filename,
+ local_error->message);
+ g_assert_not_reached ();
+ }
state = e_table_state_new (spec);
view = gal_view_etable_new (spec, "");
@@ -947,6 +954,8 @@ mail_paned_view_update_view_instance (EMailView *view)
g_object_unref (state);
g_object_unref (view);
g_object_unref (spec);
+
+ g_free (spec_filename);
}
g_free (state_filename);
diff --git a/mail/message-list.c b/mail/message-list.c
index 2774ec690e..d7682042bb 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -3360,6 +3360,7 @@ message_list_construct (MessageList *message_list)
AtkObject *a11y;
gboolean constructed;
gchar *etspecfile;
+ GError *local_error = NULL;
/*
* The etree
@@ -3368,12 +3369,19 @@ message_list_construct (MessageList *message_list)
etspecfile = g_build_filename (
EVOLUTION_ETSPECDIR, "message-list.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 ();
+ }
+
constructed = e_tree_construct (
E_TREE (message_list),
E_TREE_MODEL (message_list),
message_list->extras, specification);
+
g_object_unref (specification);
g_free (etspecfile);
diff --git a/modules/addressbook/e-book-shell-view-private.c b/modules/addressbook/e-book-shell-view-private.c
index 70fb2c32b0..eb7f3e074c 100644
--- a/modules/addressbook/e-book-shell-view-private.c
+++ b/modules/addressbook/e-book-shell-view-private.c
@@ -463,22 +463,26 @@ book_shell_view_load_view_collection (EShellViewClass *shell_view_class)
ETableSpecification *spec;
const gchar *base_dir;
gchar *filename;
+ GError *local_error = NULL;
collection = shell_view_class->view_collection;
base_dir = EVOLUTION_ETSPECDIR;
- spec = e_table_specification_new ();
filename = g_build_filename (base_dir, ETSPEC_FILENAME, NULL);
- if (!e_table_specification_load_from_file (spec, filename))
- g_critical (
- "Unable to load ETable specification file "
- "for address book");
- g_free (filename);
+ spec = e_table_specification_new (filename, &local_error);
+
+ /* Failure here is fatal. */
+ if (local_error != NULL) {
+ g_error ("%s: %s", filename, local_error->message);
+ g_assert_not_reached ();
+ }
factory = gal_view_factory_etable_new (spec);
gal_view_collection_add_factory (collection, factory);
g_object_unref (factory);
+
g_object_unref (spec);
+ g_free (filename);
factory = gal_view_factory_minicard_new ();
gal_view_collection_add_factory (collection, factory);
diff --git a/modules/calendar/e-cal-shell-view-private.c b/modules/calendar/e-cal-shell-view-private.c
index 8f5ce93792..c8ace44255 100644
--- a/modules/calendar/e-cal-shell-view-private.c
+++ b/modules/calendar/e-cal-shell-view-private.c
@@ -419,17 +419,19 @@ cal_shell_view_load_view_collection (EShellViewClass *shell_view_class)
ETableSpecification *spec;
const gchar *base_dir;
gchar *filename;
+ GError *local_error = NULL;
collection = shell_view_class->view_collection;
base_dir = EVOLUTION_ETSPECDIR;
- spec = e_table_specification_new ();
filename = g_build_filename (base_dir, ETSPEC_FILENAME, NULL);
- if (!e_table_specification_load_from_file (spec, filename))
- g_critical (
- "Unable to load ETable specification file "
- "for calendars");
- g_free (filename);
+ spec = e_table_specification_new (filename, &local_error);
+
+ /* Failure here is fatal. */
+ if (local_error != NULL) {
+ g_error ("%s: %s", filename, local_error->message);
+ g_assert_not_reached ();
+ }
factory = calendar_view_factory_new (GNOME_CAL_DAY_VIEW);
gal_view_collection_add_factory (collection, factory);
@@ -450,7 +452,9 @@ cal_shell_view_load_view_collection (EShellViewClass *shell_view_class)
factory = gal_view_factory_etable_new (spec);
gal_view_collection_add_factory (collection, factory);
g_object_unref (factory);
+
g_object_unref (spec);
+ g_free (filename);
gal_view_collection_load (collection);
}
diff --git a/modules/calendar/e-memo-shell-view-private.c b/modules/calendar/e-memo-shell-view-private.c
index 73421854be..e83685548f 100644
--- a/modules/calendar/e-memo-shell-view-private.c
+++ b/modules/calendar/e-memo-shell-view-private.c
@@ -129,22 +129,26 @@ memo_shell_view_load_view_collection (EShellViewClass *shell_view_class)
ETableSpecification *spec;
const gchar *base_dir;
gchar *filename;
+ GError *local_error = NULL;
collection = shell_view_class->view_collection;
base_dir = EVOLUTION_ETSPECDIR;
- spec = e_table_specification_new ();
filename = g_build_filename (base_dir, ETSPEC_FILENAME, NULL);
- if (!e_table_specification_load_from_file (spec, filename))
- g_critical (
- "Unable to load ETable specification file "
- "for memos");
- g_free (filename);
+ spec = e_table_specification_new (filename, &local_error);
+
+ /* Failure here is fatal. */
+ if (local_error != NULL) {
+ g_error ("%s: %s", filename, local_error->message);
+ g_assert_not_reached ();
+ }
factory = gal_view_factory_etable_new (spec);
gal_view_collection_add_factory (collection, factory);
g_object_unref (factory);
+
g_object_unref (spec);
+ g_free (filename);
gal_view_collection_load (collection);
}
diff --git a/modules/calendar/e-task-shell-view-private.c b/modules/calendar/e-task-shell-view-private.c
index 1fb6e4a33a..5cba0571b7 100644
--- a/modules/calendar/e-task-shell-view-private.c
+++ b/modules/calendar/e-task-shell-view-private.c
@@ -194,22 +194,26 @@ task_shell_view_load_view_collection (EShellViewClass *shell_view_class)
ETableSpecification *spec;
const gchar *base_dir;
gchar *filename;
+ GError *local_error = NULL;
collection = shell_view_class->view_collection;
base_dir = EVOLUTION_ETSPECDIR;
- spec = e_table_specification_new ();
filename = g_build_filename (base_dir, ETSPEC_FILENAME, NULL);
- if (!e_table_specification_load_from_file (spec, filename))
- g_critical (
- "Unable to load ETable specification file "
- "for tasks");
- g_free (filename);
+ spec = e_table_specification_new (filename, &local_error);
+
+ /* Failure here is fatal. */
+ if (local_error != NULL) {
+ g_error ("%s: %s", filename, local_error->message);
+ g_assert_not_reached ();
+ }
factory = gal_view_factory_etable_new (spec);
gal_view_collection_add_factory (collection, factory);
g_object_unref (factory);
+
g_object_unref (spec);
+ g_free (filename);
gal_view_collection_load (collection);
}
diff --git a/modules/mail/e-mail-shell-view-private.c b/modules/mail/e-mail-shell-view-private.c
index 61cfd8b7ac..7779236e9e 100644
--- a/modules/mail/e-mail-shell-view-private.c
+++ b/modules/mail/e-mail-shell-view-private.c
@@ -545,22 +545,26 @@ mail_shell_view_load_view_collection (EShellViewClass *shell_view_class)
ETableSpecification *spec;
const gchar *base_dir;
gchar *filename;
+ GError *local_error = NULL;
collection = shell_view_class->view_collection;
base_dir = EVOLUTION_ETSPECDIR;
- spec = e_table_specification_new ();
filename = g_build_filename (base_dir, ETSPEC_FILENAME, NULL);
- if (!e_table_specification_load_from_file (spec, filename))
- g_critical (
- "Unable to load ETable specification file "
- "for mail");
- g_free (filename);
+ spec = e_table_specification_new (filename, &local_error);
+
+ /* Failure here is fatal. */
+ if (local_error != NULL) {
+ g_error ("%s: %s", filename, local_error->message);
+ g_assert_not_reached ();
+ }
factory = gal_view_factory_etable_new (spec);
gal_view_collection_add_factory (collection, factory);
g_object_unref (factory);
+
g_object_unref (spec);
+ g_free (filename);
gal_view_collection_load (collection);
}