From f267827d67d3fd11478fbf94da9cd6095400a49c Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Tue, 2 Jul 2013 09:22:18 -0400 Subject: 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() --- mail/e-mail-paned-view.c | 17 +++++++++++++---- mail/message-list.c | 12 ++++++++++-- 2 files changed, 23 insertions(+), 6 deletions(-) (limited to 'mail') 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); -- cgit v1.2.3