diff options
-rw-r--r-- | doc/reference/evolution-util/evolution-util-sections.txt | 1 | ||||
-rw-r--r-- | e-util/e-table-specification.c | 40 | ||||
-rw-r--r-- | e-util/e-table-specification.h | 3 |
3 files changed, 7 insertions, 37 deletions
diff --git a/doc/reference/evolution-util/evolution-util-sections.txt b/doc/reference/evolution-util/evolution-util-sections.txt index 15e629cca7..35f32d58d6 100644 --- a/doc/reference/evolution-util/evolution-util-sections.txt +++ b/doc/reference/evolution-util/evolution-util-sections.txt @@ -3879,7 +3879,6 @@ e_table_specification_new e_table_specification_ref_columns e_table_specification_get_column_index e_table_specification_load_from_file -e_table_specification_load_from_string <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 381504ecd6..348912acc5 100644 --- a/e-util/e-table-specification.c +++ b/e-util/e-table-specification.c @@ -554,46 +554,18 @@ 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)) { - success = e_table_specification_load_from_string ( - specification, contents); - g_free (contents); - contents = NULL; + if (!g_file_get_contents (filename, &contents, NULL, NULL)) { + g_warn_if_fail (contents == NULL); + return FALSE; } - g_warn_if_fail (contents == NULL); - - return success; -} - -/** - * e_table_specification_load_from_string: - * @specification: an #ETableSpecification - * @xml: a string containing an #ETable specification - * - * Parses the contents of @xml and configures @specification. - * - * @xml is typically returned by e_table_specification_save_to_string() - * or it can be embedded in your source code. - * - * Returns: %TRUE on success, %FALSE on failure - */ -gboolean -e_table_specification_load_from_string (ETableSpecification *specification, - const gchar *xml) -{ - GMarkupParseContext *context; - gboolean success = FALSE; - - g_return_val_if_fail (E_IS_TABLE_SPECIFICATION (specification), FALSE); - g_return_val_if_fail (xml != NULL, FALSE); - g_ptr_array_set_size (specification->priv->columns, 0); g_clear_object (&specification->state); @@ -602,7 +574,7 @@ e_table_specification_load_from_string (ETableSpecification *specification, g_object_ref (specification), (GDestroyNotify) g_object_unref); - if (g_markup_parse_context_parse (context, xml, -1, NULL)) + 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); @@ -614,6 +586,8 @@ e_table_specification_load_from_string (ETableSpecification *specification, 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 5abd0618a8..ff8ad062da 100644 --- a/e-util/e-table-specification.h +++ b/e-util/e-table-specification.h @@ -91,9 +91,6 @@ gint e_table_specification_get_column_index gboolean e_table_specification_load_from_file (ETableSpecification *specification, const gchar *filename); -gboolean e_table_specification_load_from_string - (ETableSpecification *specification, - const gchar *xml); G_END_DECLS |