diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2013-07-02 00:58:23 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2013-07-02 22:34:11 +0800 |
commit | 8b04ed82b34235f123d75d878806de2db3a5a82d (patch) | |
tree | 1cd52789a945f0c8f4df830ec58c14c9c346971e /e-util | |
parent | 4391d00cdfabb436e31ce1a3bdbe9d623132d79d (diff) | |
download | gsoc2013-evolution-8b04ed82b34235f123d75d878806de2db3a5a82d.tar.gz gsoc2013-evolution-8b04ed82b34235f123d75d878806de2db3a5a82d.tar.zst gsoc2013-evolution-8b04ed82b34235f123d75d878806de2db3a5a82d.zip |
e_table_new: Take an ETableSpecification parameter.
Creating an ETableSpecification is failable, so it's now up to the
caller to do that and handle errors before calling e_table_new().
Diffstat (limited to 'e-util')
-rw-r--r-- | e-util/e-table.c | 31 | ||||
-rw-r--r-- | e-util/e-table.h | 4 |
2 files changed, 13 insertions, 22 deletions
diff --git a/e-util/e-table.c b/e-util/e-table.c index 3875792bd1..43f47ae16b 100644 --- a/e-util/e-table.c +++ b/e-util/e-table.c @@ -1901,7 +1901,7 @@ et_real_construct (ETable *e_table, * @e_table: The newly created #ETable object. * @etm: The model for this table. * @ete: An optional #ETableExtras. (%NULL is valid.) - * @spec_str: The spec. + * @specification: an #ETableSpecification * * This is the internal implementation of e_table_new() for use by * subclasses or language bindings. See e_table_new() for details. @@ -1913,30 +1913,22 @@ ETable * e_table_construct (ETable *e_table, ETableModel *etm, ETableExtras *ete, - const gchar *spec_str) + ETableSpecification *specification) { - ETableSpecification *specification; ETableState *state; g_return_val_if_fail (E_IS_TABLE (e_table), NULL); g_return_val_if_fail (E_IS_TABLE_MODEL (etm), NULL); g_return_val_if_fail (ete == NULL || E_IS_TABLE_EXTRAS (ete), NULL); - g_return_val_if_fail (spec_str != NULL, NULL); + g_return_val_if_fail (E_IS_TABLE_SPECIFICATION (specification), NULL); g_object_ref (etm); - specification = e_table_specification_new (); - g_object_ref (specification); - if (!e_table_specification_load_from_string (specification, spec_str)) { - g_object_unref (specification); - return NULL; - } - state = g_object_ref (specification->state); e_table = et_real_construct (e_table, etm, ete, specification, state); - e_table->spec = specification; + e_table->spec = g_object_ref (specification); g_object_unref (state); return e_table; @@ -1990,7 +1982,7 @@ e_table_construct_from_spec_file (ETable *e_table, * e_table_new: * @etm: The model for this table. * @ete: An optional #ETableExtras. (%NULL is valid.) - * @spec_str: The spec. + * @specification: an #ETableSpecification * * This function creates an #ETable from the given parameters. The * #ETableModel is a table model to be represented. The #ETableExtras @@ -1998,10 +1990,9 @@ e_table_construct_from_spec_file (ETable *e_table, * used when interpreting the spec. If you pass in %NULL it uses the * default #ETableExtras. (See e_table_extras_new()). * - * @spec is the specification of the set of viewable columns and the - * default sorting state and such. @state is an optional string - * specifying the current sorting state and such. If @state is NULL, - * then the default state from the spec will be used. + * @specification is the specification of the set of viewable columns and the + * default sorting state and such. @state is an optional string specifying + * the current sorting state and such. * * Return value: * The newly created #ETable or %NULL if there's an error. @@ -2009,17 +2000,17 @@ e_table_construct_from_spec_file (ETable *e_table, GtkWidget * e_table_new (ETableModel *etm, ETableExtras *ete, - const gchar *spec_str) + ETableSpecification *specification) { ETable *e_table; g_return_val_if_fail (E_IS_TABLE_MODEL (etm), NULL); g_return_val_if_fail (ete == NULL || E_IS_TABLE_EXTRAS (ete), NULL); - g_return_val_if_fail (spec_str != NULL, NULL); + g_return_val_if_fail (E_IS_TABLE_SPECIFICATION (specification), NULL); e_table = g_object_new (E_TYPE_TABLE, NULL); - e_table = e_table_construct (e_table, etm, ete, spec_str); + e_table = e_table_construct (e_table, etm, ete, specification); return GTK_WIDGET (e_table); } diff --git a/e-util/e-table.h b/e-util/e-table.h index e8dfbfeeb1..1f2eb36193 100644 --- a/e-util/e-table.h +++ b/e-util/e-table.h @@ -270,10 +270,10 @@ GType e_table_get_type (void) G_GNUC_CONST; ETable * e_table_construct (ETable *e_table, ETableModel *etm, ETableExtras *ete, - const gchar *spec_str); + ETableSpecification *specification); GtkWidget * e_table_new (ETableModel *etm, ETableExtras *ete, - const gchar *spec_str); + ETableSpecification *specification); /* Create an ETable using files. */ ETable * e_table_construct_from_spec_file |