[goffice] Make building graphs using introspection possible.
- From: Jean Bréfort <jbrefort src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] Make building graphs using introspection possible.
- Date: Tue, 12 Jan 2016 06:27:15 +0000 (UTC)
commit d170917adf5d843cda95795746f7e40a32ed4920
Author: Jean Brefort <jean brefort normalesup org>
Date: Tue Jan 12 07:26:14 2016 +0100
Make building graphs using introspection possible.
ChangeLog | 13 ++++-
docs/reference/goffice-0.10-sections.txt | 43 ++++++++++++--
goffice/data/go-data-simple.c | 91 ++++++++++++++++++++++++++++++
goffice/data/go-data-simple.h | 6 +-
goffice/graph/gog-series.c | 2 +-
5 files changed, 144 insertions(+), 11 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index de88faa..0e1ff4b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,18 @@
+2016-01-12 Jean Brefort <jean brefort normalesup org>
+
+ * docs/reference/goffice-0.10-sections.txt: add missing declarations.
+ * goffice/data/go-data-simple.c (go_data_scalar_str_new_copy),
+ (go_data_vector_val_new_copy), (go_data_vector_str_new_copy): new
+ functions for introspection.
+ * goffice/data/go-data-simple.h: ditto.
+ * goffice/graph/gog-series.c: add an annotation.
+
2016-01-11 Jean Brefort <jean brefort normalesup org>
- * goffice/app/go-plugin.c: add introspection anotations.
+ * goffice/app/go-plugin.c: add introspection annotations.
* goffice/goffice.c (libgoffice_init): initialise GOPluginLoaderModule
class to allow plugins initialization through introspection.
- * goffice/graph/gog-object.c: add an introspection anotation.
+ * goffice/graph/gog-object.c: add an introspection annotation.
* goffice/math/go-cspline.c: typo.
2016-01-01 Andreas J. Guelzow <aguelzow pyrshep ca>
diff --git a/docs/reference/goffice-0.10-sections.txt b/docs/reference/goffice-0.10-sections.txt
index 94546e6..e2566ec 100644
--- a/docs/reference/goffice-0.10-sections.txt
+++ b/docs/reference/goffice-0.10-sections.txt
@@ -798,12 +798,15 @@ GODataVectorStr
GODataVectorVal
go_data_matrix_val_new
go_data_scalar_str_new
+go_data_scalar_str_new_copy
go_data_scalar_str_set_str
go_data_scalar_val_new
go_data_vector_str_new
+go_data_vector_str_new_copy
go_data_vector_str_set_translate_func
go_data_vector_str_set_translation_domain
go_data_vector_val_new
+go_data_vector_val_new_copy
<SUBSECTION Standard>
GO_DATA_MATRIX_VAL
GO_DATA_SCALAR_STR
@@ -1211,6 +1214,7 @@ GO_SLIST_REVERSE
GO_SLIST_SORT
go_ascii_strcase_equal
go_ascii_strcase_hash
+go_debug_check_finalized
go_debug_flag
go_destroy_password
go_get_real_name
@@ -1297,6 +1301,7 @@ go_image_get_format_from_name
go_image_get_format_info
go_image_get_formats_with_pixbuf_saver
go_image_get_height
+go_image_get_info
go_image_get_name
go_image_get_pixbuf
go_image_get_scaled_pixbuf
@@ -1371,6 +1376,7 @@ go_image_sel_new
go_xml_get_child_by_name
go_xml_get_child_by_name_by_lang
go_xml_get_child_by_name_no_lang
+go_xml_in_doc_dispose_on_exit
go_xml_node_get_bool
go_xml_node_get_cstr
go_xml_node_get_double
@@ -1384,6 +1390,8 @@ go_xml_node_set_enum
go_xml_node_set_gocolor
go_xml_node_set_int
go_xml_out_add_color
+go_xml_out_add_double
+go_xml_out_add_long_double
go_xml_parse_file
</SECTION>
@@ -1392,20 +1400,31 @@ go_xml_parse_file
<TITLE>GOArrow</TITLE>
GOArrow
GOArrowType
+GOArrowSel
go_arrow_clear
+go_arrow_draw
go_arrow_dup
+go_arrow_equal
go_arrow_init
go_arrow_init_kite
go_arrow_init_oval
go_arrow_type_as_str
go_arrow_type_from_str
+go_arrow_sel_get_arrow
+go_arrow_sel_get_type
+go_arrow_sel_new
+go_arrow_sel_set_arrow
+<SUBSECTION Standard>
+GO_ARROW_TYPE
+GO_ARROW_SEL
+GO_IS_ARROW_SEL
+GO_TYPE_ARROW_SEL
</SECTION>
<SECTION>
<FILE>go-line</FILE>
<TITLE>Line</TITLE>
GOLineDashSequence
-GO_ARROW_TYPE
go_line_dash_as_label
go_line_dash_as_str
go_line_dash_from_str
@@ -1474,6 +1493,7 @@ go_marker_get_outline_color
go_marker_get_outline_width
go_marker_get_shape
go_marker_get_size
+go_marker_is_closed_shape
go_marker_new
go_marker_render
go_marker_set_fill_color
@@ -1492,6 +1512,7 @@ go_marker_get_type
<SECTION>
<FILE>go-marker-selector</FILE>
go_marker_selector_new
+go_marker_selector_set_auto_fill
go_marker_selector_set_colors
go_marker_selector_set_shape
</SECTION>
@@ -1518,7 +1539,16 @@ go_add_epsilon
go_add_epsilonl
go_ascii_strtod
go_ascii_strtold
+go_atan2pi
+go_atan2pil
+go_atanpi
+go_atanpil
go_continued_fraction
+go_cospi
+go_cospil
+go_cotpi
+go_cotpil
+go_dtoa
go_fake_ceil
go_fake_ceill
go_fake_floor
@@ -1539,11 +1569,6 @@ go_strtod
go_strtold
go_sub_epsilon
go_sub_epsilonl
-go_atan2pi
-go_atan2pil
-go_cospi
-go_cospil
-go_dtoa
isnan
ldexpl
log1p
@@ -1715,6 +1740,7 @@ go_persist_get_type
<TITLE>GOPixbuf</TITLE>
GOPixbuf
go_pixbuf_get_rowstride
+go_pixbuf_new_from_data
go_pixbuf_new_from_pixbuf
<SUBSECTION Standard>
GO_IS_PIXBUF
@@ -1947,6 +1973,7 @@ GOQuad
GOQuadl
GOQuad_
GOQuadl_
+GO_QUAD_IMPL
</SECTION>
<SECTION>
@@ -2836,6 +2863,7 @@ gog_axis_add_contributor
gog_axis_bound_changed
gog_axis_clear_contributors
gog_axis_contributors
+gog_axis_data_get_bounds
gog_axis_del_contributor
gog_axis_get_atype
gog_axis_get_bounds
@@ -2858,6 +2886,7 @@ gog_axis_get_ticks
gog_axis_is_center_on_ticks
gog_axis_is_discrete
gog_axis_is_inverted
+gog_axis_is_zero_important
gog_axis_set_bounds
gog_axis_set_extents
gog_axis_set_format
@@ -2902,6 +2931,8 @@ GogAxisPosition
GogAxisTickTypes
gog_axis_base_get_cross_location
gog_axis_base_get_crossed_axis
+gog_axis_base_get_crossed_axis_for_plot
+gog_axis_base_get_crossed_axis_type
gog_axis_line_get_ticks
<SUBSECTION Standard>
GOG_AXIS_BASE
diff --git a/goffice/data/go-data-simple.c b/goffice/data/go-data-simple.c
index 8fc7276..7dcf712 100644
--- a/goffice/data/go-data-simple.c
+++ b/goffice/data/go-data-simple.c
@@ -262,6 +262,13 @@ GSF_CLASS (GODataScalarStr, go_data_scalar_str,
go_data_scalar_str_class_init, go_data_scalar_str_init,
GO_TYPE_DATA_SCALAR)
+/**
+ * go_data_scalar_str_new: (skip)
+ * @str: the string.
+ * @needs_free: whether to free the string.
+ *
+ * Returns: (transfer full): the newly created #GOData.
+ **/
GOData *
go_data_scalar_str_new (char const *str, gboolean needs_free)
{
@@ -270,6 +277,23 @@ go_data_scalar_str_new (char const *str, gboolean needs_free)
res->needs_free = needs_free;
return GO_DATA (res);
}
+
+/**
+ * go_data_scalar_str_new_copy: (rename-to go_data_scalar_str_new)
+ * @str: (transfer none): the string.
+ *
+ * Makes a copy of the string.
+ * Returns: (transfer full): the newly created #GOData.
+ **/
+GOData *
+go_data_scalar_str_new_copy (char const *str)
+{
+ GODataScalarStr *res = g_object_new (GO_TYPE_DATA_SCALAR_STR, NULL);
+ res->str = g_strdup(str);
+ res->needs_free = TRUE;
+ return GO_DATA (res);
+}
+
void
go_data_scalar_str_set_str (GODataScalarStr *str,
char const *text, gboolean needs_free)
@@ -469,6 +493,14 @@ GSF_CLASS (GODataVectorVal, go_data_vector_val,
go_data_vector_val_class_init, NULL,
GO_TYPE_DATA_VECTOR)
+/**
+ * go_data_vector_val_new: (skip)
+ * @val: the values.
+ * @n: the values number.
+ * @notify: callback to destroy the values if needed.
+ *
+ * Returns: (transfer full): the newly created #GOData.
+ **/
GOData *
go_data_vector_val_new (double *val, unsigned n, GDestroyNotify notify)
{
@@ -479,6 +511,24 @@ go_data_vector_val_new (double *val, unsigned n, GDestroyNotify notify)
return GO_DATA (res);
}
+/**
+ * go_data_vector_val_new_copy: (rename-to go_data_vector_val_new)
+ * @val: (array length=n): the values.
+ * @n: the values number.
+ *
+ * Returns: (transfer full): the newly created #GOData.
+ **/
+GOData *
+go_data_vector_val_new_copy (double *val, unsigned n)
+{
+ GODataVectorVal *res = g_object_new (GO_TYPE_DATA_VECTOR_VAL, NULL);
+ res->val = g_malloc (n * sizeof (double));
+ memcpy (res->val, val, n * sizeof (double));
+ res->n = n;
+ res->notify = g_free;
+ return GO_DATA (res);
+}
+
/*****************************************************************************/
struct _GODataVectorStr {
@@ -739,6 +789,14 @@ GSF_CLASS (GODataVectorStr, go_data_vector_str,
go_data_vector_str_class_init, go_data_vector_str_init,
GO_TYPE_DATA_VECTOR)
+/**
+ * go_data_vector_str_new: (skip)
+ * @str: (array length=n) (transfer container): the values.
+ * @n: the values number.
+ * @notify: (allow-none): callback to destroy the values if needed.
+ *
+ * Returns: (transfer full): the newly created #GOData.
+ **/
GOData *
go_data_vector_str_new (char const * const *str, unsigned n, GDestroyNotify notify)
{
@@ -749,6 +807,39 @@ go_data_vector_str_new (char const * const *str, unsigned n, GDestroyNotify noti
return GO_DATA (res);
}
+static void
+clear_strings_cb (char **str)
+{
+ int i = 0;
+ while (str[i] != NULL) {
+ g_free (str[i]);
+ i++;
+ }
+ g_free (str);
+}
+
+/**
+ * go_data_vector_str_new_copy: (rename-to go_data_vector_str_new)
+ * @str: (array length=n) (transfer none): the values.
+ * @n: the values number.
+ *
+ * Returns: (transfer full): the newly created #GOData.
+ **/
+GOData *
+go_data_vector_str_new_copy (char const * const *str, unsigned n)
+{
+ GODataVectorStr *res = g_object_new (GO_TYPE_DATA_VECTOR_STR, NULL);
+ unsigned i;
+ char **cpy = g_malloc ((n + 1) * sizeof (char*));
+ for (i = 0; i < n; i++)
+ cpy[i] = g_strdup (str[i]);
+ cpy[i] = NULL;
+ res->str = (char const * const *) cpy;
+ res->n = n;
+ res->notify = (GDestroyNotify) clear_strings_cb;
+ return GO_DATA (res);
+}
+
/**
* go_data_vector_str_set_translate_func:
* @vector: a #GODataVectorStr
diff --git a/goffice/data/go-data-simple.h b/goffice/data/go-data-simple.h
index 203ef6d..1671411 100644
--- a/goffice/data/go-data-simple.h
+++ b/goffice/data/go-data-simple.h
@@ -40,7 +40,8 @@ GOData *go_data_scalar_val_new (double val);
typedef struct _GODataScalarStr GODataScalarStr;
GType go_data_scalar_str_get_type (void);
-GOData *go_data_scalar_str_new (char const *text, gboolean needs_free);
+GOData *go_data_scalar_str_new (char const *str, gboolean needs_free);
+GOData *go_data_scalar_str_new_copy (char const *str);
void go_data_scalar_str_set_str (GODataScalarStr *str,
char const *text, gboolean needs_free);
@@ -51,7 +52,7 @@ void go_data_scalar_str_set_str (GODataScalarStr *str,
typedef struct _GODataVectorVal GODataVectorVal;
GType go_data_vector_val_get_type (void);
GOData *go_data_vector_val_new (double *val, unsigned n, GDestroyNotify notify);
-
+GOData *go_data_vector_val_new_copy (double *val, unsigned n);
#define GO_TYPE_DATA_VECTOR_STR (go_data_vector_str_get_type ())
#define GO_DATA_VECTOR_STR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GO_TYPE_DATA_VECTOR_STR, GODataVectorStr))
#define GO_IS_DATA_VECTOR_STR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GO_TYPE_DATA_VECTOR_STR))
@@ -59,6 +60,7 @@ GOData *go_data_vector_val_new (double *val, unsigned n, GDestroyNotify n
typedef struct _GODataVectorStr GODataVectorStr;
GType go_data_vector_str_get_type (void);
GOData *go_data_vector_str_new (char const * const *str, unsigned n, GDestroyNotify notify);
+GOData *go_data_vector_str_new_copy (char const * const *str, unsigned n);
void go_data_vector_str_set_translate_func (GODataVectorStr *vector,
GOTranslateFunc func,
gpointer data,
diff --git a/goffice/graph/gog-series.c b/goffice/graph/gog-series.c
index 4ba0f8e..61977af 100644
--- a/goffice/graph/gog-series.c
+++ b/goffice/graph/gog-series.c
@@ -1114,7 +1114,7 @@ gog_series_set_name (GogSeries *series, GODataScalar *name_src, GError **err)
* @series: #GogSeries
* @dim_i: Which dimension
* @val: (transfer full): #GOData
- * @err: optional #GError pointer
+ * @err: (allow-none): optional #GError pointer
*
* Absorbs a ref to @val
**/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]