[goffice] Update the build system.
- From: Jean BrÃfort <jbrefort src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] Update the build system.
- Date: Sat, 11 Aug 2012 08:59:07 +0000 (UTC)
commit 41181a68a8ad9d969a39deb63e6d09c98b910ff2
Author: Jean Brefort <jean brefort normalesup org>
Date: Sat Aug 11 10:58:37 2012 +0200
Update the build system.
ChangeLog | 15 +
INSTALL | 106 ++++-
configure.in | 8 -
docs/reference/Makefile.am | 2 +-
docs/reference/goffice-docs.xml | 7 +-
goffice.mk | 20 -
goffice/Makefile.am | 570 +++++++++++++++++++++++---
goffice/app/Makefile.am | 65 ---
goffice/app/error-info.c | 72 ++++-
goffice/app/error-info.h | 1 +
goffice/app/file.c | 59 ++-
goffice/app/go-cmd-context.c | 7 +
goffice/app/go-conf-gsettings.c | 4 +-
goffice/app/go-conf-keyfile.c | 4 +-
goffice/app/go-conf-win32.c | 4 +-
goffice/app/go-conf.c | 62 +++-
goffice/app/go-conf.h | 1 +
goffice/app/go-doc-control.c | 7 +
goffice/app/go-doc.c | 46 ++-
goffice/app/go-plugin-loader.c | 7 +
goffice/app/go-plugin-service.c | 14 +-
goffice/app/go-plugin.c | 64 ++--
goffice/app/goffice-app.h | 1 -
goffice/canvas/Makefile.am | 54 ---
goffice/canvas/goc-item.c | 6 +-
goffice/component/Makefile.am | 18 -
goffice/component/go-component-factory.c | 6 +
goffice/component/go-component.c | 2 +-
goffice/data/Makefile.am | 16 -
goffice/data/go-data.c | 48 ++-
goffice/data/go-data.h | 2 +
goffice/goffice.h | 6 +
goffice/graph/Makefile.am | 122 ------
goffice/graph/gog-3d-box.c | 2 +-
goffice/graph/gog-axis-line.c | 2 +-
goffice/graph/gog-axis.c | 4 +-
goffice/graph/gog-chart.c | 6 +-
goffice/graph/gog-data-set.c | 37 +-
goffice/graph/gog-equation.c | 2 +-
goffice/graph/gog-error-bar.c | 6 +-
goffice/graph/gog-graph.c | 6 +-
goffice/graph/gog-guru.c | 4 +-
goffice/graph/gog-label.c | 2 +-
goffice/graph/gog-object-xml.c | 17 +
goffice/graph/gog-object.c | 7 +-
goffice/graph/gog-plot-engine.c | 5 +
goffice/graph/gog-reg-curve.c | 2 +-
goffice/graph/gog-series-labels.c | 2 +-
goffice/graph/gog-series.c | 28 +-
goffice/graph/gog-styled-object.c | 8 +-
goffice/graph/gog-styled-object.h | 3 +
goffice/graph/gog-view.c | 38 ++-
goffice/graph/gog-view.h | 12 +-
goffice/gtk/Makefile.am | 86 ----
goffice/gtk/go-3d-rotation-sel.c | 2 +-
goffice/gtk/go-color-palette.c | 2 +-
goffice/gtk/go-color-selector.c | 28 ++-
goffice/gtk/go-color-selector.h | 6 +
goffice/gtk/go-combo-box.c | 2 -
goffice/gtk/go-font-sel.c | 2 +-
goffice/gtk/go-format-sel.c | 2 +-
goffice/gtk/go-gradient-selector.c | 29 ++-
goffice/gtk/go-gradient-selector.h | 5 +
goffice/gtk/go-graph-widget.c | 2 +-
goffice/gtk/go-image-sel.c | 2 +-
goffice/gtk/go-line-selector.c | 24 +-
goffice/gtk/go-line-selector.h | 5 +
goffice/gtk/go-pattern-selector.c | 2 +-
goffice/gtk/go-rotation-sel.c | 2 +-
goffice/gtk/goffice-gtk.c | 147 ++++++--
goffice/gtk/goffice-gtk.h | 13 +
goffice/math/Makefile.am | 33 --
goffice/math/go-accumulator.c | 42 ++
goffice/math/go-cspline.c | 34 ++
goffice/math/go-cspline.h | 6 +
goffice/math/go-fft.c | 2 +-
goffice/math/go-quad.c | 72 ++++
goffice/math/go-regression.c | 93 ++++-
goffice/math/go-regression.h | 7 +
goffice/utils/Makefile.am | 100 -----
goffice/utils/datetime.c | 21 +
goffice/utils/datetime.h | 2 +
goffice/utils/go-bezier.c | 25 ++-
goffice/utils/go-bezier.h | 2 +
goffice/utils/go-color.c | 7 +
goffice/utils/go-editor.c | 37 ++-
goffice/utils/go-editor.h | 2 +
goffice/utils/go-emf.c | 7 +
goffice/utils/go-file.c | 47 ++-
goffice/utils/go-file.h | 1 +
goffice/utils/go-font.c | 39 ++-
goffice/utils/go-font.h | 1 +
goffice/utils/go-format.c | 140 ++++++-
goffice/utils/go-format.h | 5 +
goffice/utils/go-gdk-pixbuf.c | 254 ++++++++++++
goffice/utils/go-gdk-pixbuf.h | 43 ++
goffice/utils/go-glib-extras.c | 105 ++++-
goffice/utils/go-glib-extras.h | 1 +
goffice/utils/go-image.c | 58 +++-
goffice/utils/go-image.h | 1 +
goffice/utils/go-libxml-extras.c | 36 ++-
goffice/utils/go-line.c | 26 ++-
goffice/utils/go-line.h | 2 +
goffice/utils/go-marker.c | 7 +
goffice/utils/go-pango-extras.c | 37 ++-
goffice/utils/go-pango-extras.h | 7 +
goffice/utils/go-path.c | 23 +-
goffice/utils/go-pattern.c | 2 +-
goffice/utils/go-pixbuf.c | 209 ----------
goffice/utils/go-pixbuf.h | 11 +-
goffice/utils/go-rsm.c | 7 +
goffice/utils/go-style.c | 28 +-
goffice/utils/go-styled-object.c | 6 +-
goffice/utils/go-undo.c | 16 +-
goffice/utils/goffice-utils.h | 1 +
plugins/plot_barcol/gog-barcol-prefs.c | 2 +-
plugins/plot_barcol/gog-dropbar.c | 2 +-
plugins/plot_barcol/gog-line.c | 2 +-
plugins/plot_barcol/gog-minmax.c | 2 +-
plugins/plot_distrib/gog-boxplot.c | 2 +-
plugins/plot_distrib/gog-histogram.c | 4 +-
plugins/plot_pie/gog-pie-prefs.c | 6 +-
plugins/plot_radar/gog-radar.c | 4 +-
plugins/plot_surface/gog-xyz-prefs.c | 2 +-
plugins/plot_surface/gog-xyz-surface-prefs.c | 2 +-
plugins/plot_xy/gog-bubble-prefs.c | 2 +-
plugins/plot_xy/gog-xy-dropbar.c | 2 +-
plugins/plot_xy/gog-xy.c | 6 +-
plugins/smoothing/gog-exp-smooth.c | 2 +-
plugins/smoothing/gog-moving-avg.c | 2 +-
130 files changed, 2523 insertions(+), 1104 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index db1594c..53c4373 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2012-08-11 Jean Brefort <jean brefort normalesup org>
+
+ * goffice/Makefile.am: changed the build system.
+ * goffice/app/Makefile.am: removed.
+ * goffice/canvas/Makefile.am: removed.
+ * goffice/component/Makefile.am: removed.
+ * goffice/data/Makefile.am: removed.
+ * goffice/graph/Makefile.am: removed.
+ * goffice/gtk/Makefile.am: removed.
+ * goffice/math/Makefile.am: removed.
+ * goffice/utils/Makefile.am: removed.
+ * goffice/utils/go-gdk-pixbuf.c: new file.
+ * goffice/utils/go-gdk-pixbuf.h: ditto.
+ * all others: fix introspection and gtk-doc warnings.
+
2012-08-04 Jean Brefort <jean brefort normalesup org>
* goffice/app/Makefile.am: new GoView class for use in file openers and
diff --git a/INSTALL b/INSTALL
index 2550dab..a1e89e1 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,11 +1,13 @@
Installation Instructions
*************************
-Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
-2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation,
+Inc.
- This file is free documentation; the Free Software Foundation gives
-unlimited permission to copy, distribute and modify it.
+ Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved. This file is offered as-is,
+without warranty of any kind.
Basic Installation
==================
@@ -13,7 +15,11 @@ Basic Installation
Briefly, the shell commands `./configure; make; make install' should
configure, build, and install this package. The following
more-detailed instructions are generic; see the `README' file for
-instructions specific to this package.
+instructions specific to this package. Some packages provide this
+`INSTALL' file but do not implement all of the features documented
+below. The lack of an optional feature in a given package is not
+necessarily a bug. More recommendations for GNU packages can be found
+in *note Makefile Conventions: (standards)Makefile Conventions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
@@ -42,7 +48,7 @@ may remove or edit it.
you want to change it or regenerate `configure' using a newer version
of `autoconf'.
-The simplest way to compile this package is:
+ The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system.
@@ -53,12 +59,22 @@ The simplest way to compile this package is:
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
- the package.
+ the package, generally using the just-built uninstalled binaries.
4. Type `make install' to install the programs and any data files and
- documentation.
-
- 5. You can remove the program binaries and object files from the
+ documentation. When installing into a prefix owned by root, it is
+ recommended that the package be configured and built as a regular
+ user, and only the `make install' phase executed with root
+ privileges.
+
+ 5. Optionally, type `make installcheck' to repeat any self-tests, but
+ this time using the binaries in their final installed location.
+ This target does not install anything. Running this target as a
+ regular user, particularly if the prior `make install' required
+ root privileges, verifies that the installation completed
+ correctly.
+
+ 6. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
@@ -67,8 +83,15 @@ The simplest way to compile this package is:
all sorts of other programs in order to regenerate files that came
with the distribution.
- 6. Often, you can also type `make uninstall' to remove the installed
- files again.
+ 7. Often, you can also type `make uninstall' to remove the installed
+ files again. In practice, not all packages have tested that
+ uninstallation works correctly, even though it is required by the
+ GNU Coding Standards.
+
+ 8. Some packages, particularly those that use Automake, provide `make
+ distcheck', which can by used by developers to test that all other
+ targets like `make install' and `make uninstall' work correctly.
+ This target is generally not run by end users.
Compilers and Options
=====================
@@ -93,7 +116,8 @@ same time, by placing the object files for each architecture in their
own directory. To do this, you can use GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
-source code in the directory that `configure' is in and in `..'.
+source code in the directory that `configure' is in and in `..'. This
+is known as a "VPATH" build.
With a non-GNU `make', it is safer to compile the package for one
architecture at a time in the source code directory. After you have
@@ -120,7 +144,8 @@ Installation Names
By default, `make install' installs the package's commands under
`/usr/local/bin', include files under `/usr/local/include', etc. You
can specify an installation prefix other than `/usr/local' by giving
-`configure' the option `--prefix=PREFIX'.
+`configure' the option `--prefix=PREFIX', where PREFIX must be an
+absolute file name.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
@@ -131,15 +156,46 @@ Documentation and other data files still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=DIR' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
-you can set and what kinds of files go in them.
+you can set and what kinds of files go in them. In general, the
+default for these options is expressed in terms of `${prefix}', so that
+specifying just `--prefix' will affect all of the other directory
+specifications that were not explicitly provided.
+
+ The most portable way to affect installation locations is to pass the
+correct locations to `configure'; however, many packages provide one or
+both of the following shortcuts of passing variable assignments to the
+`make install' command line to change installation locations without
+having to reconfigure or recompile.
+
+ The first method involves providing an override variable for each
+affected directory. For example, `make install
+prefix=/alternate/directory' will choose an alternate location for all
+directory configuration variables that were expressed in terms of
+`${prefix}'. Any directories that were specified during `configure',
+but not in terms of `${prefix}', must each be overridden at install
+time for the entire installation to be relocated. The approach of
+makefile variable overrides for each directory variable is required by
+the GNU Coding Standards, and ideally causes no recompilation.
+However, some platforms have known limitations with the semantics of
+shared libraries that end up requiring recompilation when using this
+method, particularly noticeable in packages that use GNU Libtool.
+
+ The second method involves providing the `DESTDIR' variable. For
+example, `make install DESTDIR=/alternate/directory' will prepend
+`/alternate/directory' before all installation names. The approach of
+`DESTDIR' overrides is not required by the GNU Coding Standards, and
+does not work on platforms that have drive letters. On the other hand,
+it does better at avoiding recompilation issues, and works well even
+when some directory options were not specified in terms of `${prefix}'
+at `configure' time.
+
+Optional Features
+=================
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
-Optional Features
-=================
-
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
@@ -152,6 +208,13 @@ find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
+ Some packages offer the ability to configure how verbose the
+execution of `make' will be. For these packages, running `./configure
+--enable-silent-rules' sets the default to minimal output, which can be
+overridden with `make V=1'; while running `./configure
+--disable-silent-rules' sets the default to verbose, which can be
+overridden with `make V=0'.
+
Particular systems
==================
@@ -163,6 +226,11 @@ order to use an ANSI C compiler:
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
+ HP-UX `make' updates targets which have the same time stamps as
+their prerequisites, which makes it generally unusable when shipped
+generated files such as `configure' are involved. Use GNU `make'
+instead.
+
On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
parse its `<wchar.h>' header file. The option `-nodtk' can be used as
a workaround. If GNU CC is not installed, it is therefore recommended
@@ -288,7 +356,7 @@ operates.
`configure' can determine that directory automatically.
`--prefix=DIR'
- Use DIR as the installation prefix. *Note Installation Names::
+ Use DIR as the installation prefix. *note Installation Names::
for more details, including other options available for fine-tuning
the installation locations.
diff --git a/configure.in b/configure.in
index 96b452b..c446f6c 100644
--- a/configure.in
+++ b/configure.in
@@ -768,14 +768,6 @@ AC_CONFIG_FILES([
Makefile
libgoffice.pc
goffice/Makefile
-goffice/app/Makefile
-goffice/utils/Makefile
-goffice/data/Makefile
-goffice/gtk/Makefile
-goffice/graph/Makefile
-goffice/math/Makefile
-goffice/canvas/Makefile
-goffice/component/Makefile
plugins/Makefile
plugins/plot_barcol/Makefile
plugins/plot_pie/Makefile
diff --git a/docs/reference/Makefile.am b/docs/reference/Makefile.am
index e0aa11e..1000cc9 100644
--- a/docs/reference/Makefile.am
+++ b/docs/reference/Makefile.am
@@ -8,7 +8,7 @@ DOC_SOURCE_DIR=../../goffice
SCANGOBJ_OPTIONS= --nogtkinit --type-init-func="g_type_init ()"
-SCAN_OPTIONS=--rebuild-types
+SCAN_OPTIONS= --deprecated-guards="GOFFICE_DISABLE_DEPRECATED" --rebuild-types
MKDB_OPTIONS=--xml-mode --output-format=xml
diff --git a/docs/reference/goffice-docs.xml b/docs/reference/goffice-docs.xml
index 1e21ef8..a0e84df 100644
--- a/docs/reference/goffice-docs.xml
+++ b/docs/reference/goffice-docs.xml
@@ -120,6 +120,7 @@
<xi:include href="xml/go-pattern.xml"/>
<xi:include href="xml/go-style.xml"/>
<xi:include href="xml/go-styled-object.xml"/>
+ <xi:include href="xml/goffice-utils.xml"/>
</chapter>
<chapter>
<title>Rendering utilities</title>
@@ -147,6 +148,8 @@
<xi:include href="xml/go-rangefunc.xml"/>
<xi:include href="xml/go-regression.xml"/>
<xi:include href="xml/go-units.xml"/>
+ <xi:include href="xml/go-quad.xml"/>
+ <xi:include href="xml/go-accumulator.xml"/>
</chapter>
<chapter>
<title>File utilities</title>
@@ -161,6 +164,7 @@
<xi:include href="xml/go-cmd-context.xml"/>
<xi:include href="xml/go-doc-control.xml"/>
<xi:include href="xml/go-doc.xml"/>
+ <xi:include href="xml/go-error-info.xml"/>
<xi:include href="xml/io-context.xml"/>
<xi:include href="xml/go-plugin.xml"/>
<xi:include href="xml/go-plugin-loader.xml"/>
@@ -183,7 +187,6 @@
<xi:include href="xml/go-persist.xml"/>
<xi:include href="xml/go-undo.xml"/>
<xi:include href="xml/go-string.xml"/>
- <xi:include href="xml/goffice-utils.xml"/>
</chapter>
</part>
<index id="gsf-index">
@@ -202,7 +205,6 @@
<xi:include href="xml/go-dock-item-grip.xml"/>
</chapter>
<xi:include href="xml/goffice-priv.xml"/>
-<xi:include href="xml/error-info.xml"/>
<xi:include href="xml/file-priv.xml"/>
<xi:include href="xml/file.xml"/>
<xi:include href="xml/go-error-stack.xml"/>
@@ -220,7 +222,6 @@
<xi:include href="xml/datetime.xml"/>
<xi:include href="xml/format-impl.xml"/>
<xi:include href="xml/go-file.xml"/>
-<xi:include href="xml/goffice-utils.xml"/>
<xi:include href="xml/go-marshalers.xml"/>
<xi:include href="xml/win32-stub.xml"/>
-->
diff --git a/goffice.mk b/goffice.mk
index 5bf12c7..6b8b0a7 100644
--- a/goffice.mk
+++ b/goffice.mk
@@ -9,23 +9,3 @@ GOFFICE_PLUGIN_FLAGS = $(GOFFICE_PLUGIN_LDFLAGS)
goffice_include_dir = $(includedir)/libgoffice- GOFFICE_API_VER@/goffice
include $(top_srcdir)/goffice-win32.mk
-
-all-local: list_of_sources
-
-list_of_sources: Makefile
- rm -f $ tmp
- touch $ tmp
- for i in $(SOURCES) $(HEADERS); do \
- echo $$i | grep '\.[ch]$$' >> $ tmp; \
- done
- test -z "${SUBDIRS}" || for s in ${SUBDIRS}; do \
- if test -e $$s/list_of_sources ; then \
- perl -pe "s{^}{$$s/}" $$s/list_of_sources >> $ tmp; \
- fi; \
- done
- mv $ tmp $@
-
-distclean-local: distclean-local-list_of_sources
-.PHONY: distclean-local-list_of_sources
-distclean-local-list_of_sources:
- rm -f list_of_sources
diff --git a/goffice/Makefile.am b/goffice/Makefile.am
index d93dd7a..ed65328 100644
--- a/goffice/Makefile.am
+++ b/goffice/Makefile.am
@@ -1,36 +1,497 @@
-SUBDIRS = utils data app graph math canvas
+-include $(INTROSPECTION_MAKEFILE)
+INTROSPECTION_GIRS =
+INTROSPECTION_SCANNER_ARGS = \
+ -v --warn-all --accept-unprefixed -DGOFFICE_DISABLE_DEPRECATED \
+ --namespace GOffice --nsversion="@GOFFICE_API_VER@" \
+ --identifier-prefix="GO" --identifier-prefix="Go" \
+ --symbol-prefix="go" --symbol-prefix="libgoffice"
+
+INTROSPECTION_COMPILER_ARGS = \
+ --includedir=$(srcdir) \
+ --includedir=.
+
+#####################################
+#app directory files
+
+noinst_HEADERS = \
+ app/file-priv.h
+
+app_SOURCES = \
+ app/go-doc.c \
+ app/go-doc-control.c \
+ app/go-view.c \
+ \
+ app/go-plugin.c \
+ app/go-plugin-loader.c \
+ app/go-plugin-loader-module.c \
+ app/go-plugin-service.c \
+ \
+ app/file.c \
+ app/error-info.c \
+ app/io-context.c \
+ app/go-cmd-context.c \
+ app/go-conf.c
+
+appdir = $(goffice_include_dir)/app
+app_api_headers = \
+ app/goffice-app.h \
+ \
+ app/go-doc.h \
+ app/go-doc-impl.h \
+ app/go-doc-control.h \
+ app/go-doc-control-impl.h \
+ app/go-view.h \
+ app/go-plugin.h \
+ app/go-plugin-loader.h \
+ app/go-plugin-loader-module.h \
+ app/go-plugin-service.h \
+ app/go-plugin-service-impl.h \
+ app/file.h \
+ app/error-info.h \
+ app/io-context.h \
+ app/io-context-priv.h \
+ app/go-cmd-context.h \
+ app/go-cmd-context-impl.h \
+ app/go-conf.h
+
+app_HEADERS = \
+ $(app_api_headers) \
+ app/module-plugin-defs.h
+
+# This list should be empty when we reach a stable phase.
+app_UNUSED = \
+ app/go-app.h \
+ app/go-error-stack.h \
+ app/go-object.c \
+ app/go-object.h \
+ app/go-service.c \
+ app/go-service.h \
+ app/go-service-impl.h
+
+EXTRA_DIST = $(app_UNUSED) \
+ app/go-conf-keyfile.c \
+ app/go-conf-gsettings.c \
+ app/go-conf-win32.c
+
+#####################################
+# canvas directory files
+
+canvas_SOURCES = \
+ canvas/goc-arc.c \
+ canvas/goc-canvas.c \
+ canvas/goc-circle.c \
+ canvas/goc-ellipse.c \
+ canvas/goc-graph.c \
+ canvas/goc-group.c \
+ canvas/goc-item.c \
+ canvas/goc-image.c \
+ canvas/goc-line.c \
+ canvas/goc-path.c \
+ canvas/goc-pixbuf.c \
+ canvas/goc-polyline.c \
+ canvas/goc-polygon.c \
+ canvas/goc-rectangle.c \
+ canvas/goc-styled-item.c \
+ canvas/goc-text.c \
+ canvas/goc-utils.c
+
+canvas_gtk_SOURCES= \
+ canvas/goc-component.c \
+ canvas/goc-widget.c
+
+canvasdir = $(goffice_include_dir)/canvas
+canvas_HEADERS = \
+ canvas/goc-arc.h \
+ canvas/goc-canvas.h \
+ canvas/goc-circle.h \
+ canvas/goc-component.h \
+ canvas/goc-ellipse.h \
+ canvas/goc-graph.h \
+ canvas/goc-group.h \
+ canvas/goc-item.h \
+ canvas/goc-image.h \
+ canvas/goc-line.h \
+ canvas/goc-path.h \
+ canvas/goc-pixbuf.h \
+ canvas/goc-polyline.h \
+ canvas/goc-polygon.h \
+ canvas/goc-rectangle.h \
+ canvas/goc-structs.h \
+ canvas/goc-styled-item.h \
+ canvas/goc-text.h \
+ canvas/goc-utils.h \
+ canvas/goc-widget.h \
+ canvas/goffice-canvas.h
+
+#####################################
+# component directory files
+
+component_SOURCES = \
+ component/go-component.c \
+ component/go-component-factory.c \
+ component/go-component-mime-dialog.c
+
+componentdir = $(goffice_include_dir)/component
+component_HEADERS = \
+ component/goffice-component.h \
+ component/go-component.h \
+ component/go-component-factory.h \
+ component/go-component-mime-dialog.h
+
+#####################################
+# data directory files
+
+data_SOURCES = \
+ data/go-data.c \
+ data/go-data-simple.c
+
+go_datadir = $(goffice_include_dir)/data
+go_data_HEADERS = \
+ data/goffice-data.h \
+ data/go-data.h \
+ data/go-data-impl.h \
+ data/go-data-simple.h
+
+#####################################
+# graph directory files
+
+graph_SOURCES = \
+ graph/gog-object.c \
+ graph/gog-object-xml.c \
+ graph/gog-styled-object.c \
+ graph/gog-outlined-object.c \
+ graph/gog-view.c \
+ \
+ graph/gog-graph.c \
+ graph/gog-chart.c \
+ \
+ graph/gog-chart-map.c \
+ graph/gog-chart-map-3d.c \
+ graph/gog-3d-box.c \
+ \
+ graph/gog-axis.c \
+ graph/gog-axis-line.c \
+ graph/gog-legend.c \
+ graph/gog-label.c \
+ graph/gog-grid.c \
+ graph/gog-grid-line.c \
+ \
+ graph/gog-theme.c \
+ \
+ graph/gog-plot.c \
+ graph/gog-plot-engine.c \
+ graph/gog-series.c \
+ graph/gog-error-bar.c \
+ graph/gog-trend-line.c \
+ graph/gog-reg-curve.c \
+ graph/gog-smoothed-curve.c \
+ graph/gog-series-labels.c \
+ graph/gog-series-lines.c \
+ graph/gog-data-set.c \
+ \
+ graph/gog-renderer.c
+
+graph_gtk_SOURCES = \
+ graph/gog-guru.c \
+ graph/gog-data-allocator.c \
+ graph/gog-child-button.c
+
+graph_lasem_SOURCES = \
+ graph/gog-equation.c
+
+graphdir = $(goffice_include_dir)/graph
+graph_HEADERS = \
+ graph/goffice-graph.h \
+ graph/gog-object.h \
+ graph/gog-object-xml.h \
+ graph/gog-styled-object.h \
+ graph/gog-outlined-object.h \
+ graph/gog-view.h \
+ graph/gog-graph.h \
+ graph/gog-graph-impl.h \
+ graph/gog-chart.h \
+ graph/gog-chart-impl.h \
+ graph/gog-chart-map.h \
+ graph/gog-chart-map-3d.h \
+ graph/gog-3d-box.h \
+ graph/gog-axis.h \
+ graph/gog-axis-line.h \
+ graph/gog-legend.h \
+ graph/gog-label.h \
+ graph/gog-grid.h \
+ graph/gog-grid-line.h \
+ graph/gog-theme.h \
+ graph/gog-plot.h \
+ graph/gog-plot-impl.h \
+ graph/gog-plot-engine.h \
+ graph/gog-series.h \
+ graph/gog-series-impl.h \
+ graph/gog-error-bar.h \
+ graph/gog-trend-line.h \
+ graph/gog-reg-curve.h \
+ graph/gog-smoothed-curve.h \
+ graph/gog-series-labels.h \
+ graph/gog-series-lines.h \
+ graph/gog-data-set.h \
+ graph/gog-renderer.h
+
+graph_gtkdir = $(goffice_include_dir)/graph
+graph_gtk_HEADERS = \
+ graph/gog-guru.h \
+ graph/gog-data-allocator.h \
+ graph/gog-child-button.h
+
+graph_lasemdir = $(goffice_include_dir)/graph
+graph_lasem_HEADERS = \
+ graph/gog-equation.h
+
+noinst_HEADERS += \
+ graph/gog-axis-line-impl.h
+
+#####################################
+# gtk directory files
+
+gtk_SOURCES = \
+ gtk/goffice-gtk.c \
+ \
+ gtk/go-font-sel.c \
+ gtk/go-format-sel.c \
+ gtk/go-rotation-sel.c \
+ gtk/go-charmap-sel.c \
+ gtk/go-locale-sel.c \
+ gtk/go-3d-rotation-sel.c \
+ \
+ gtk/go-optionmenu.c \
+ gtk/go-combo-box.c \
+ gtk/go-color-group.c \
+ gtk/go-color-palette.c \
+ gtk/go-combo-color.c \
+ gtk/go-combo-pixmaps.c \
+ \
+ gtk/go-action-combo-color.c \
+ gtk/go-action-combo-pixmaps.c \
+ gtk/go-action-combo-stack.c \
+ gtk/go-action-combo-text.c \
+ \
+ gtk/go-calendar-button.c \
+ gtk/go-palette.c \
+ gtk/go-selector.c \
+ gtk/go-color-selector.c \
+ gtk/go-gradient-selector.c \
+ gtk/go-line-selector.c \
+ gtk/go-marker-selector.c \
+ gtk/go-pattern-selector.c \
+ \
+ gtk/go-graph-widget.c \
+ gtk/go-image-sel.c
+
+gtkdir = $(goffice_include_dir)/gtk
+gtk_HEADERS = \
+ gtk/goffice-gtk.h \
+ \
+ gtk/go-font-sel.h \
+ gtk/go-format-sel.h \
+ gtk/go-rotation-sel.h \
+ gtk/go-charmap-sel.h \
+ gtk/go-locale-sel.h \
+ gtk/go-3d-rotation-sel.h \
+ \
+ gtk/go-optionmenu.h \
+ gtk/go-combo-box.h \
+ gtk/go-color-group.h \
+ gtk/go-color-palette.h \
+ gtk/go-combo-color.h \
+ gtk/go-combo-pixmaps.h \
+ \
+ gtk/go-action-combo-color.h \
+ gtk/go-action-combo-pixmaps.h \
+ gtk/go-action-combo-stack.h \
+ gtk/go-action-combo-text.h \
+ \
+ gtk/go-calendar-button.h \
+ gtk/go-palette.h \
+ gtk/go-selector.h \
+ gtk/go-color-selector.h \
+ gtk/go-gradient-selector.h \
+ gtk/go-line-selector.h \
+ gtk/go-marker-selector.h \
+ gtk/go-pattern-selector.h \
+ \
+ gtk/go-graph-widget.h \
+ gtk/go-image-sel.h
+
+#####################################
+# maths directory files
+
+math_SOURCES = \
+ math/go-accumulator.c \
+ math/go-math.c \
+ math/go-rangefunc.c \
+ math/go-regression.c \
+ math/go-cspline.c \
+ math/go-complex.c \
+ math/go-fft.c \
+ math/go-matrix3x3.c \
+ math/go-quad.c \
+ math/go-R.c \
+ math/go-distribution.c
+
+mathdir = $(goffice_include_dir)/math
+math_HEADERS = \
+ math/goffice-math.h \
+ math/go-accumulator.h \
+ math/go-math.h \
+ math/go-rangefunc.h \
+ math/go-regression.h \
+ math/go-cspline.h \
+ math/go-complex.h \
+ math/go-fft.h \
+ math/go-matrix3x3.h \
+ math/go-quad.h \
+ math/go-R.h \
+ math/go-distribution.h
+
+#####################################
+# utils directory files
+utils_SOURCES = \
+ utils/go-marshalers.list \
+ \
+ utils/go-color.c \
+ utils/go-file.c \
+ utils/go-font.c \
+ \
+ utils/go-cairo.c \
+ utils/go-gradient.c \
+ utils/go-image.c \
+ utils/go-pixbuf.c \
+ utils/go-svg.c \
+ utils/go-emf.c \
+ utils/go-spectre.c \
+ utils/go-line.c \
+ utils/go-locale.c \
+ utils/go-marker.c \
+ utils/go-path.c \
+ utils/go-pattern.c \
+ utils/go-geometry.c \
+ utils/go-rsm.c \
+ utils/go-string.c \
+ utils/go-undo.c \
+ utils/datetime.c \
+ utils/formats.c \
+ utils/go-format.c \
+ utils/regutf8.c \
+ \
+ utils/go-glib-extras.c \
+ utils/go-libxml-extras.c \
+ utils/go-pango-extras.c \
+ utils/go-gdk-pixbuf.c \
+ utils/go-persist.c \
+ utils/go-bezier.c \
+ utils/go-editor.c \
+ utils/go-style.c \
+ utils/go-styled-object.c
+
+utilsdir = $(goffice_include_dir)/utils
+utils_HEADERS = \
+ utils/goffice-utils.h \
+ utils/go-cairo.h \
+ utils/go-color.h \
+ utils/go-file.h \
+ utils/go-font.h \
+ utils/go-gradient.h \
+ utils/go-image.h \
+ utils/go-pixbuf.h \
+ utils/go-svg.h \
+ utils/go-emf.h \
+ utils/go-spectre.h \
+ utils/go-line.h \
+ utils/go-locale.h \
+ utils/go-marker.h \
+ utils/go-path.h \
+ utils/go-pattern.h \
+ utils/go-units.h \
+ utils/go-geometry.h \
+ utils/go-string.h \
+ utils/go-undo.h \
+ utils/datetime.h \
+ utils/go-format.h \
+ utils/regutf8.h \
+ utils/go-glib-extras.h \
+ utils/go-libxml-extras.h \
+ utils/go-pango-extras.h \
+ utils/go-gdk-pixbuf.h \
+ utils/go-persist.h \
+ utils/go-bezier.h \
+ utils/go-editor.h \
+ utils/go-rsm.h \
+ utils/go-style.h \
+ utils/go-styled-object.h
+
+# A hint is needed to build the header first:
+BUILT_SOURCES = utils/go-marshalers.h
+
+# Another hint, see bugs #172211 and #172212:
+non-intermediate: utils/go-marshalers.c
+
+GENMARSHAL_COMMAND = $(GLIB_GENMARSHAL) --prefix=go_
+
+.list.h:
+ if ! [ -x utils ]; then mkdir utils; fi && \
+ $(GENMARSHAL_COMMAND) --header $< >$@
+
+.list.c:
+ (echo '/* This file has been automatically generated. Do not edit. */' && \
+ echo '#include <goffice/goffice-config.h>' && \
+ echo '#include "$*.h"' && \
+ $(GENMARSHAL_COMMAND) --body $< ) >$@
lib_LTLIBRARIES = libgoffice- GOFFICE_API_VER@.la
libgoffice_ GOFFICE_API_VER@_la_LIBADD = \
- utils/libgoffice-utils.la \
- app/libgoffice-app.la \
- data/libgoffice-data.la \
- graph/libgoffice-graph.la \
- math/libgoffice-math.la \
$(GOFFICE_LIBS) \
$(GTK_MAC_LIBS)
-if WITH_GTK
-SUBDIRS += gtk component
-libgoffice_ GOFFICE_API_VER@_la_LIBADD += \
- gtk/libgoffice-gtk.la \
- component/libgoffice-component.la \
- canvas/libgoffice-canvas.la
-endif
-
libgoffice_ GOFFICE_API_VER@_la_LDFLAGS = -version-info $(VERSION_INFO)
if WITH_WIN32
libgoffice_ GOFFICE_API_VER@_la_DEPENDENCIES = goffice.def
libgoffice_ GOFFICE_API_VER@_la_LDFLAGS += -no-undefined -export-symbols goffice.def
endif
-BUILT_SOURCES = goffice-paths.h embedded-stuff.c
-CLEANFILES = $(BUILT_SOURCES)
+BUILT_SOURCES += goffice-paths.h embedded-stuff.c
+CLEANFILES = $(BUILT_SOURCES) \
+ utils/go-marshalers.c
libgoffice_ GOFFICE_API_VER@_la_SOURCES = \
goffice.c \
- goffice-priv.h
+ goffice-priv.h \
+ $(app_SOURCES) \
+ $(canvas_SOURCES) \
+ $(data_SOURCES) \
+ $(graph_SOURCES) \
+ $(math_SOURCES) \
+ $(utils_SOURCES)
+
+if WITH_GTK
+libgoffice_ GOFFICE_API_VER@_la_SOURCES += \
+ $(canvas_gtk_SOURCES) \
+ $(component_SOURCES) \
+ $(graph_gtk_SOURCES) \
+ $(gtk_SOURCES)
+else
+EXTRA_DIST += \
+ $(canvas_gtk_SOURCES) \
+ $(component_SOURCES) \
+ $(graph_gtk_SOURCES) \
+ $(gtk_SOURCES)
+endif
+
+if GOFFICE_WITH_LASEM
+libgoffice_ GOFFICE_API_VER@_la_SOURCES += \
+ $(graph_lasem_SOURCES)
+else
+EXTRA_DIST += \
+ $(graph_lasem_SOURCES)
+endif
libgoffice_ GOFFICE_API_VER@_ladir = $(goffice_include_dir)
libgoffice_ GOFFICE_API_VER@_la_HEADERS = \
@@ -120,6 +581,8 @@ embedded_stuff_raw = \
embedded_stuff = $(embedded_stuff_compress) $(embedded_stuff_raw)
+EXTRA_DIST += $(embedded_stuff)
+
embedded-stuff.c: $(top_srcdir)/tools/embedder $(embedded_stuff)
cd $(srcdir) && @PERL@ $(abs_top_srcdir)/tools/embedder \
--id-prefix=go: \
@@ -131,46 +594,51 @@ embedded-stuff.c: $(top_srcdir)/tools/embedder $(embedded_stuff)
>$(abs_builddir)/$@
-BUILT_GIRSOURCES = \
- GOffice- GOFFICE_API_VER@.gir
-
-GOffice- GOFFICE_API_VER@.gir: list_of_sources
-GOffice- GOFFICE_API_VER@.gir: libgoffice- GOFFICE_API_VER@.la
-GOffice- GOFFICE_API_VER@.gir: $(INTROSPECTION_SCANNER)
- $(AM_V_GEN) $(INTROSPECTION_SCANNER) -v --namespace GOffice \
- --nsversion="@GOFFICE_API_VER@" \
- --add-include-path=$(srcdir) --add-include-path=. \
- --include=GObject-2.0 \
- --include=Gio-2.0 \
- --include=libxml2-2.0 \
- --include=cairo-1.0 \
- --include=Pango-1.0 \
- --include=Gtk-3.0 \
- --include=Gsf-1 \
- --identifier-prefix="GO" \
- --identifier-prefix="Go" \
- --symbol-prefix="go" \
- --symbol-prefix="libgoffice" \
- --accept-unprefixed \
- --library=libgoffice- GOFFICE_API_VER@.la \
- --libtool="$(LIBTOOL)" \
- --nsversion="@GOFFICE_API_VER@" \
- --output $@ \
- -I$(top_srcdir) \
- $(GOFFICE_CFLAGS) \
- `perl -pe "s{^}{$(srcdir)/}" $(builddir)/list_of_sources`
-
if HAVE_INTROSPECTION
+INTROSPECTION_GIRS += GOffice- GOFFICE_API_VER@.gir
+
+GOffice- GOFFICE_API_VER@.gir: \
+ $(INTROSPECTION_SCANNER) \
+ libgoffice- GOFFICE_API_VER@.la
+GOffice_ GOFFICE_API_VER_@_gir_INCLUDES = \
+ GObject-2.0 \
+ Gio-2.0 \
+ libxml2-2.0 \
+ cairo-1.0 \
+ Pango-1.0 \
+ Gtk-3.0 \
+ Gsf-1
+GOffice_ GOFFICE_API_VER_@_gir_CFLAGS = $(AM_CPPFLAGS)
+GOffice_ GOFFICE_API_VER_@_gir_LIBS = libgoffice- GOFFICE_API_VER@.la
+GOffice_ GOFFICE_API_VER_@_gir_FILES = \
+ $(libgoffice_ GOFFICE_API_VER@_la_SOURCES) \
+ $(app_HEADERS) \
+ $(canvas_HEADERS) \
+ $(go_data_HEADERS) \
+ $(graph_HEADERS) \
+ $(math_HEADERS) \
+ $(utils_HEADERS)
+
+if WITH_GTK
+GOffice_ GOFFICE_API_VER_@_gir_FILES += \
+ $(canvas_gtk_HEADERS) \
+ $(component_HEADERS) \
+ $(graph_gtk_HEADERS) \
+ $(gtk_HEADERS)
+endif
+
+if GOFFICE_WITH_LASEM
+GOffice_ GOFFICE_API_VER_@_gir_FILES += \
+ $(graph_lasem_HEADERS)
+endif
+
girdir = $(GIRDIR)
-gir_DATA = $(BUILT_GIRSOURCES)
+gir_DATA = $(INTROSPECTION_GIRS)
typelibsdir = $(TYPELIBDIR)
-typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib)
+typelibs_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
CLEANFILES += $(gir_DATA) $(typelibs_DATA)
-%.typelib: %.gir $(INTROSPECTION_COMPILER)
- $(AM_V_GEN) LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}. $(INTROSPECTION_COMPILER) --includedir=$(srcdir) --includedir=. $(G_IR_COMPILER_OPTS) $< -o $(builddir)/$(@F)
-
endif # HAVE_INTROSPECTION
diff --git a/goffice/app/error-info.c b/goffice/app/error-info.c
index 27d18c4..f53ea8a 100644
--- a/goffice/app/error-info.c
+++ b/goffice/app/error-info.c
@@ -30,6 +30,7 @@ struct _GOErrorInfo {
gchar *msg;
GOSeverity severity;
GSList *details; /* list of GOErrorInfo */
+ unsigned ref_count;
};
GOErrorInfo *
@@ -39,6 +40,7 @@ go_error_info_new_str (char const *msg)
error->msg = g_strdup (msg);
error->severity = GO_ERROR;
error->details = NULL;
+ error->ref_count = 1;
return error;
}
@@ -55,6 +57,7 @@ go_error_info_new_vprintf (GOSeverity severity, char const *msg_format,
error->msg = g_strdup_vprintf (msg_format, args);
error->severity = severity;
error->details = NULL;
+ error->ref_count = 1;
return error;
}
@@ -72,6 +75,15 @@ go_error_info_new_printf (char const *msg_format, ...)
return error;
}
+/**
+ * go_error_info_new_str_with_details:
+ * @msg: error message
+ * @details: #GOErrorInfo to add
+ *
+ * Creates a new #GOErrorInfo from @message and an existing #GOErrorInfo
+ * instance to add to the message.
+ * Returns: (transfer full): the newly created #GOErrorInfo
+ **/
GOErrorInfo *
go_error_info_new_str_with_details (char const *msg, GOErrorInfo *details)
{
@@ -80,6 +92,15 @@ go_error_info_new_str_with_details (char const *msg, GOErrorInfo *details)
return error;
}
+/**
+ * go_error_info_new_str_with_details_list:
+ * @msg: error message
+ * @details: (element-type GOErrorInfo): a list of #GOErrorInfo to add
+ *
+ * Creates a new #GOErrorInfo from @message and a list of existing #GOErrorInfo
+ * instances to add to the message.
+ * Returns: (transfer full): the newly created #GOErrorInfo
+ **/
GOErrorInfo *
go_error_info_new_str_with_details_list (char const *msg, GSList *details)
{
@@ -88,6 +109,14 @@ go_error_info_new_str_with_details_list (char const *msg, GSList *details)
return error;
}
+/**
+ * go_error_info_new_from_error_list:
+ * @errors: (element-type GOErrorInfo): a list of #GOErrorInfo to add
+ *
+ * Creates a new #GOErrorInfo from a list of existing #GOErrorInfo
+ * instances to add to the message.
+ * Returns: (transfer full): the newly created #GOErrorInfo
+ **/
GOErrorInfo *
go_error_info_new_from_error_list (GSList *errors)
{
@@ -115,6 +144,13 @@ go_error_info_new_from_errno (void)
return go_error_info_new_str (g_strerror (errno));
}
+/**
+ * go_error_info_add_details:
+ * @error: #GOErrorInfo
+ * @details: #GOErrorInfo to add
+ *
+ * Adds an existing #GOErrorInfo instance to @error.
+ **/
void
go_error_info_add_details (GOErrorInfo *error, GOErrorInfo *details)
{
@@ -129,6 +165,13 @@ go_error_info_add_details (GOErrorInfo *error, GOErrorInfo *details)
error->details = g_slist_append (error->details, details);
}
+/**
+ * go_error_info_add_details_list:
+ * @error: #GOErrorInfo
+ * @details: (element-type GOErrorInfo): a list of #GOErrorInfo to add
+ *
+ * Adds a list of existing #GOErrorInfo instances to @error.
+ **/
void
go_error_info_add_details_list (GOErrorInfo *error, GSList *details)
{
@@ -156,7 +199,7 @@ go_error_info_free (GOErrorInfo *error)
{
GSList *l;
- if (error == NULL)
+ if (error == NULL || error->ref_count-- > 1)
return;
g_free (error->msg);
@@ -202,6 +245,13 @@ go_error_info_peek_message (GOErrorInfo *error)
return error->msg;
}
+/**
+ * go_error_info_peek_details:
+ * @error: error message
+ *
+ * Returns: (element-type GOErrorInfo) (transfer full): the newly details
+ * in @error
+ **/
GSList *
go_error_info_peek_details (GOErrorInfo *error)
{
@@ -217,3 +267,23 @@ go_error_info_peek_severity (GOErrorInfo *error)
return error->severity;
}
+
+static GOErrorInfo *
+go_error_info_ref (GOErrorInfo *error)
+{
+ error->ref_count++;
+ return error;
+}
+
+GType
+go_error_info_get_type (void)
+{
+ static GType t = 0;
+
+ if (t == 0) {
+ t = g_boxed_type_register_static ("GOErrorInfo",
+ (GBoxedCopyFunc)go_error_info_ref,
+ (GBoxedFreeFunc)go_error_info_free);
+ }
+ return t;
+}
diff --git a/goffice/app/error-info.h b/goffice/app/error-info.h
index 862a400..cda555b 100644
--- a/goffice/app/error-info.h
+++ b/goffice/app/error-info.h
@@ -11,6 +11,7 @@ typedef enum {
GO_ERROR
} GOSeverity;
+GType go_error_info_get_type (void);
GOErrorInfo *go_error_info_new_str (char const *msg);
GOErrorInfo *go_error_info_new_printf (char const *msg_format, ...) G_GNUC_PRINTF (1, 2);
GOErrorInfo *go_error_info_new_vprintf (GOSeverity severity,
diff --git a/goffice/app/file.c b/goffice/app/file.c
index 24c0ef0..36c8e93 100644
--- a/goffice/app/file.c
+++ b/goffice/app/file.c
@@ -120,11 +120,11 @@ GSF_CLASS (GOFileOpener, go_file_opener,
* @fo: Newly created GOFileOpener object
* @id: Optional ID of the opener (or NULL)
* @description: Description of supported file format
- * @suffixes: List of suffixes to associate with the opener
- * @mimes: List of mime types to associate with the opener
+ * @suffixes: (element-type char): List of suffixes to associate with the opener
+ * @mimes: (element-type char): List of mime types to associate with the opener
* @encoding_dependent: whether the opener depends on an encoding sel.
- * @probe_func: Optional pointer to "probe" function (or NULL)
- * @open_func: Pointer to "open" function
+ * @probe_func: (scope async): Optional pointer to "probe" function (or NULL)
+ * @open_func: (scope async): Pointer to "open" function
*
* Sets up GOFileOpener object, newly created with g_object_new function.
* This is intended to be used only by GOFileOpener derivates.
@@ -155,15 +155,15 @@ go_file_opener_setup (GOFileOpener *fo, gchar const *id,
* go_file_opener_new:
* @id: Optional ID of the opener (or NULL)
* @description: Description of supported file format
- * @suffixes: List of suffixes to associate with the opener
- * @mimes: List of mime types to associate with the opener
- * @probe_func: Optional pointer to "probe" function (or NULL)
- * @open_func: Pointer to "open" function
+ * @suffixes: (element-type char): List of suffixes to associate with the opener
+ * @mimes: (element-type char): List of mime types to associate with the opener
+ * @probe_func: (scope async): Optional pointer to "probe" function (or NULL)
+ * @open_func: (scope async): Pointer to "open" function
*
* Creates new GOFileOpener object. Optional @id will be used
* after registering it with go_file_opener_register function.
*
- * Returns: newly created GOFileOpener object.
+ * Returns: (transfer full): newly created GOFileOpener object.
**/
GOFileOpener *
go_file_opener_new (gchar const *id,
@@ -186,15 +186,15 @@ go_file_opener_new (gchar const *id,
* go_file_opener_new_with_enc:
* @id: Optional ID of the opener (or NULL)
* @description: Description of supported file format
- * @suffixes: List of suffixes to associate with the opener
- * @mimes: List of mime types to associate with the opener
- * @probe_func: Optional pointer to "probe" function (or NULL)
- * @open_func: Pointer to "open" function
+ * @suffixes: (element-type char): List of suffixes to associate with the opener
+ * @mimes: (element-type char): List of mime types to associate with the opener
+ * @probe_func: (scope async): Optional pointer to "probe" function (or NULL)
+ * @open_func: (scope async): Pointer to "open" function
*
* Creates new GOFileOpener object. Optional @id will be used
* after registering it with go_file_opener_register function.
*
- * Returns: newly created #GOFileOpener object.
+ * Returns: (transfer full): newly created #GOFileOpener object.
**/
GOFileOpener *
go_file_opener_new_with_enc (gchar const *id,
@@ -247,12 +247,25 @@ go_file_opener_can_probe (GOFileOpener const *fo, GOFileProbeLevel pl)
return GO_FILE_OPENER_METHOD (fo, can_probe) (fo, pl);
}
+/**
+ * go_file_opener_get_suffixes:
+ * @fo: #GOFileOpener
+ *
+ * Returns: (element-type char) (transfer none): the suffixes for the supporte file types.
+ **/
GSList const *
go_file_opener_get_suffixes (GOFileOpener const *fo)
{
g_return_val_if_fail (GO_IS_FILE_OPENER (fo), NULL);
return fo->suffixes;
}
+
+/**
+ * go_file_opener_get_mimes:
+ * @fo: #GOFileOpener
+ *
+ * Returns: (element-type char) (transfer none): the supported mime types.
+ **/
GSList const *
go_file_opener_get_mimes (GOFileOpener const *fo)
{
@@ -560,7 +573,7 @@ GSF_CLASS (GOFileSaver, go_file_saver,
* @extension: Optional default extension of saved files (or NULL)
* @description: Description of supported file format
* @level: File format level
- * @save_func: Pointer to "save" function
+ * @save_func: (scope async): Pointer to "save" function
*
* Creates new GOFileSaver object. Optional @id will be used
* after registering it with go_file_saver_register or
@@ -981,7 +994,7 @@ go_file_saver_unregister (GOFileSaver *fs)
* Finds file saver registered as default saver with the highest priority.
* Reference count for the saver is NOT incremented.
*
- * Returns: GOFileSaver object or NULL if default saver is not
+ * Returns: (transfer none): GOFileSaver object or NULL if default saver is not
* available.
**/
GOFileSaver *
@@ -997,7 +1010,7 @@ go_file_saver_get_default (void)
* go_file_saver_for_mime_type:
* @mime_type: A mime type
*
- * Returns: A #GOFileSaver object associated with @mime_type, or %NULL
+ * Returns: (transfer none): A #GOFileSaver object associated with @mime_type, or %NULL
**/
GOFileSaver *
go_file_saver_for_mime_type (gchar const *mime_type)
@@ -1031,7 +1044,7 @@ go_file_saver_for_mime_type (gchar const *mime_type)
* Searches for file saver with given @filename, registered using
* go_file_opener_register
*
- * Returns: GOFileSaver object or NULL if opener cannot be found.
+ * Returns: (transfer none): GOFileSaver object or NULL if opener cannot be found.
**/
GOFileSaver *
go_file_saver_for_file_name (char const *file_name)
@@ -1056,7 +1069,7 @@ go_file_saver_for_file_name (char const *file_name)
* Searches for file opener with given @id, registered using
* go_file_opener_register
*
- * Returns: #GOFileOpener object or %NULL if opener cannot be found.
+ * Returns: (transfer none): #GOFileOpener object or %NULL if opener cannot be found.
**/
GOFileOpener *
go_file_opener_for_id (gchar const *id)
@@ -1075,7 +1088,7 @@ go_file_opener_for_id (gchar const *id)
* Searches for file saver with given @id, registered using
* go_file_saver_register or register_file_opener_as_default.
*
- * Returns: GOFileSaver object or NULL if saver cannot be found.
+ * Returns: (transfer none): GOFileSaver object or NULL if saver cannot be found.
**/
GOFileSaver *
go_file_saver_for_id (gchar const *id)
@@ -1090,7 +1103,8 @@ go_file_saver_for_id (gchar const *id)
/**
* go_get_file_savers:
*
- * Returns: list of known# GOFileSaver types (do not modify list)
+ * Returns: (element-type GOFileSaver) (transfer none): list of known
+ * #GOFileSaver types (do not modify list)
*/
GList *
go_get_file_savers (void)
@@ -1101,7 +1115,8 @@ go_get_file_savers (void)
/**
* go_get_file_openers:
*
- * Returns: list of known #GOFileOpener types (do not modify list)
+ * Returns: (element-type GOFileSaver) (transfer none): list of known
+ * #GOFileOpener types (do not modify list)
**/
GList *
go_get_file_openers (void)
diff --git a/goffice/app/go-cmd-context.c b/goffice/app/go-cmd-context.c
index 93268da..377e156 100644
--- a/goffice/app/go-cmd-context.c
+++ b/goffice/app/go-cmd-context.c
@@ -50,6 +50,13 @@ go_cmd_context_error_info (GOCmdContext *context, GOErrorInfo *stack)
GCC_CLASS (context)->error.error_info (context, stack);
}
+/**
+ * go_cmd_context_error_info_list:
+ * @cc: #GOCmdContext
+ * @stack: (element-type GOErrorInfo): a list of errors
+ *
+ * Sends a list of errors to the command context.
+ **/
void
go_cmd_context_error_info_list (GOCmdContext *cc, GSList *stack)
{
diff --git a/goffice/app/go-conf-gsettings.c b/goffice/app/go-conf-gsettings.c
index fbda275..284fa15 100644
--- a/goffice/app/go-conf-gsettings.c
+++ b/goffice/app/go-conf-gsettings.c
@@ -22,6 +22,7 @@ struct _GOConfNode {
gchar *id;
gchar *key;
GSettings *settings;
+ unsigned ref_count;
};
static GHashTable *installed_schemas, *closures;
@@ -78,6 +79,7 @@ go_conf_get_node (GOConfNode *parent, gchar const *key)
formatted = go_conf_format_id (key);
node = g_new0 (GOConfNode, 1);
+ node->ref_count = 1;
if (parent) {
if (key && !parent->key) {
node->path = g_strconcat (parent->path, "/", key, NULL);
@@ -115,7 +117,7 @@ go_conf_get_node (GOConfNode *parent, gchar const *key)
void
go_conf_free_node (GOConfNode *node)
{
- if (node) {
+ if (node && node->ref_count-- > 1) {
if (node->settings)
g_object_unref (node->settings);
g_free (node->path);
diff --git a/goffice/app/go-conf-keyfile.c b/goffice/app/go-conf-keyfile.c
index e4879b4..893d16d 100644
--- a/goffice/app/go-conf-keyfile.c
+++ b/goffice/app/go-conf-keyfile.c
@@ -28,6 +28,7 @@
struct _GOConfNode {
gchar *path;
GKeyFile *key_file;
+ unsigned ref_count;
};
static GHashTable *key_files = NULL;
@@ -118,6 +119,7 @@ go_conf_get_node (GOConfNode *parent, gchar const *key)
node = g_new (GOConfNode, 1);
node->path = go_conf_get_real_key (parent, key);
+ node->ref_count = 1;
if (parent)
node->key_file = parent->key_file;
else {
@@ -142,7 +144,7 @@ go_conf_get_node (GOConfNode *parent, gchar const *key)
void
go_conf_free_node (GOConfNode *node)
{
- if (node != NULL) {
+ if (node != NULL && node->ref_count-- > 1) {
g_free (node->path);
g_free (node);
}
diff --git a/goffice/app/go-conf-win32.c b/goffice/app/go-conf-win32.c
index e8dd1de..92a79e5 100644
--- a/goffice/app/go-conf-win32.c
+++ b/goffice/app/go-conf-win32.c
@@ -25,6 +25,7 @@
struct _GOConfNode {
HKEY hKey;
gchar *path;
+ unsigned ref_count;
};
void
@@ -276,6 +277,7 @@ go_conf_get_node (GOConfNode *parent, const gchar *key)
node = g_new (GOConfNode, 1);
node->hKey = hKey;
node->path = win32_key;
+ node->ref_count = 1;
} else {
g_free (win32_key);
}
@@ -286,7 +288,7 @@ go_conf_get_node (GOConfNode *parent, const gchar *key)
void
go_conf_free_node (GOConfNode *node)
{
- if (node) {
+ if (node && node->ref_count-- > 1) {
RegCloseKey (node->hKey);
g_free (node->path);
g_free (node);
diff --git a/goffice/app/go-conf.c b/goffice/app/go-conf.c
index ce47650..9aca492 100644
--- a/goffice/app/go-conf.c
+++ b/goffice/app/go-conf.c
@@ -26,7 +26,6 @@
#include <goffice-config.h>
#include <goffice/goffice.h>
-#include <go-conf.h>
#define NO_DEBUG_GCONF
#ifndef NO_DEBUG_GCONF
@@ -51,6 +50,47 @@ go_conf_closure_free (GOConfClosure *cls)
g_free (cls);
}
+/**
+ * go_conf_get_node:
+ * @parent: parent node or %NULL
+ * @key: configuration key
+ *
+ * Returns: (transfer full): the #GOConfNode associated with @key
+ **/
+/**
+ * go_conf_set_str_list:
+ * @node: #GOConfNode
+ * @key: configuration key
+ * @list: (element-type char): the list of strings to set.
+ *
+ * Sets @list as the value for @key.
+ **/
+/**
+ * go_conf_get_str_list:
+ * @node: #GOConfNode
+ * @key: configuration key
+ *
+ * Returns: (element-type char) (transfer full): a list of strings asociated
+ * with @key.
+ **/
+/**
+ * go_conf_load_str_list:
+ * @node: #GOConfNode
+ * @key: configuration key
+ *
+ * Returns: (element-type char) (transfer full): a list of strings asociated
+ * with @key.
+ **/
+/**
+ * go_conf_add_monitor:
+ * @node: #GOConfNode
+ * @key: configuration key
+ * @monitor: (scope async): #GOMonitorFunc
+ * @data: user data
+ *
+ * @monitor will be called whenever the value associated with @key changes.
+ **/
+
#if defined GOFFICE_WITH_WINREG
#include "go-conf-win32.c"
#elif defined GOFFICE_WITH_GSETTINGS
@@ -59,6 +99,26 @@ go_conf_closure_free (GOConfClosure *cls)
#include "go-conf-keyfile.c"
#endif
+static GOConfNode *
+go_conf_node_ref (GOConfNode *node)
+{
+ node->ref_count++;
+ return node;
+}
+
+GType
+go_conf_node_get_type (void)
+{
+ static GType t = 0;
+
+ if (t == 0) {
+ t = g_boxed_type_register_static ("GOConfNode",
+ (GBoxedCopyFunc)go_conf_node_ref,
+ (GBoxedFreeFunc)go_conf_free_node);
+ }
+ return t;
+}
+
gchar *
go_conf_get_enum_as_str (GOConfNode *node, gchar const *key)
{
diff --git a/goffice/app/go-conf.h b/goffice/app/go-conf.h
index 820d193..ca34b36 100644
--- a/goffice/app/go-conf.h
+++ b/goffice/app/go-conf.h
@@ -10,6 +10,7 @@ typedef struct _GOConfNode GOConfNode;
void _go_conf_init (void);
void _go_conf_shutdown (void);
+GType go_conf_node_get_type (void);
GOConfNode * go_conf_get_node (GOConfNode *parent, gchar const *key);
void go_conf_free_node (GOConfNode *node);
diff --git a/goffice/app/go-doc-control.c b/goffice/app/go-doc-control.c
index a2bf6f7..1c1f8e7 100644
--- a/goffice/app/go-doc-control.c
+++ b/goffice/app/go-doc-control.c
@@ -35,6 +35,13 @@ go_doc_control_init (GODocControl *obj)
{
}
+/**
+ * go_doc_control_get_doc:
+ * @dc: #GODocControl
+ *
+ * Returns: (transfer none): the #GODoc associated to @dc
+ *
+ **/
GODoc *
go_doc_control_get_doc (GODocControl *dc)
{
diff --git a/goffice/app/go-doc.c b/goffice/app/go-doc.c
index ed2736a..6cf4d4e 100644
--- a/goffice/app/go-doc.c
+++ b/goffice/app/go-doc.c
@@ -215,9 +215,9 @@ go_doc_get_uri (GODoc const *doc)
}
/**
- * go_doc_set_dirty :
- * @doc : #GODoc
- * @is_dirty : bool
+ * go_doc_set_dirty:
+ * @doc: #GODoc
+ * @is_dirty :bool
*
* Changes the dirty state of @doc to @is_dirty and clears the pristine state
* no matter what.
@@ -241,8 +241,8 @@ go_doc_set_dirty (GODoc *doc, gboolean is_dirty)
}
/**
- * go_doc_is_dirty :
- * @doc : #GODoc
+ * go_doc_is_dirty:
+ * @doc: #GODoc
*
* Returns: TRUE if @doc has been modified.
**/
@@ -255,9 +255,9 @@ go_doc_is_dirty (GODoc const *doc)
}
/**
- * go_doc_set_dirty_time :
- * @doc : #GODoc
- * @t : a timestamp from g_get_real_time
+ * go_doc_set_dirty_time:
+ * @doc: #GODoc
+ * @t: a timestamp from g_get_real_time
*
* Changes the dirty time, i.e., the time the document was first marked
* dirty.
@@ -275,8 +275,8 @@ go_doc_set_dirty_time (GODoc *doc, gint64 t)
}
/**
- * go_doc_get_dirty_time :
- * @doc : #GODoc
+ * go_doc_get_dirty_time:
+ * @doc: #GODoc
*
* Returns: the time (as in g_get_real_time()) the document was first marked
* dirty.
@@ -326,6 +326,12 @@ go_doc_is_pristine (GODoc const *doc)
return doc->pristine;
}
+/**
+ * go_doc_get_meta_data:
+ * @doc: #GODoc
+ *
+ * Returns: (transfer none): @doc's metadata
+ **/
GsfDocMetaData *
go_doc_get_meta_data (GODoc const *doc)
{
@@ -334,9 +340,9 @@ go_doc_get_meta_data (GODoc const *doc)
}
/**
- * go_doc_set_meta_data :
- * @doc : #GODoc
- * @data : #GsfDocMetaData
+ * go_doc_set_meta_data:
+ * @doc: #GODoc
+ * @data: #GsfDocMetaData
*
* Adds a ref to @data.
**/
@@ -352,8 +358,8 @@ go_doc_set_meta_data (GODoc *doc, GsfDocMetaData *data)
}
/**
- * go_doc_update_meta_data :
- * @doc : #GODoc
+ * go_doc_update_meta_data:
+ * @doc: #GODoc
*
* Signal that @doc's metadata should be updated
* - statistics (sheet count, word count)
@@ -393,7 +399,7 @@ go_doc_get_image (GODoc *doc, char const *id)
*
* Adds @image to the document if no such image already exists. The name of
* the returned image might be different from @id, even if given.
- * Returns: either @image, in which case the document adds a reference on it, or
+ * Returns: (transfer none): either @image, in which case the document adds a reference on it, or
* an identical image for which the owner does not own a reference.
**/
GOImage *
@@ -433,6 +439,12 @@ go_doc_add_image (GODoc *doc, char const *id, GOImage *image)
return image;
}
+/**
+ * go_doc_get_images:
+ * @doc: #GODoc
+ *
+ * Returns: (transfer none): the images registered inside the document
+ **/
GHashTable *
go_doc_get_images (GODoc *doc) {
g_return_val_if_fail (doc, NULL);
@@ -579,7 +591,7 @@ go_doc_end_read (GODoc *doc)
* #GOImage.
* This function must be called after a call to go_doc_init_read(), otherwise
* it will emit a critical and return NULL.
- * Returns: the found or created #GOImage.
+ * Returns: (transfer none): the found or created #GOImage.
**/
GOImage *
go_doc_image_fetch (GODoc *doc, char const *id, GType type)
diff --git a/goffice/app/go-plugin-loader.c b/goffice/app/go-plugin-loader.c
index b855a28..f4ba8da 100644
--- a/goffice/app/go-plugin-loader.c
+++ b/goffice/app/go-plugin-loader.c
@@ -35,6 +35,13 @@ go_plugin_loader_is_base_loaded (GOPluginLoader *loader)
{
return g_object_get_data (G_OBJECT (loader), "is-base-loaded") != NULL;
}
+
+/**
+ * go_plugin_loader_get_plugin:
+ * @l: #GOPluginLoader
+ *
+ * Returns: (transfer full): the plugin
+ **/
GOPlugin *
go_plugin_loader_get_plugin (GOPluginLoader *l)
{
diff --git a/goffice/app/go-plugin-service.c b/goffice/app/go-plugin-service.c
index 289a153..d7d1bf8 100644
--- a/goffice/app/go-plugin-service.c
+++ b/goffice/app/go-plugin-service.c
@@ -1211,6 +1211,12 @@ go_plugin_service_get_description (GOPluginService *service)
return service->saved_description;
}
+/**
+ * go_plugin_service_get_plugin:
+ * @service: #GOPluginService
+ *
+ * Returns: (transfer none): the plugin offering @service
+ **/
GOPlugin *
go_plugin_service_get_plugin (GOPluginService *service)
{
@@ -1219,6 +1225,12 @@ go_plugin_service_get_plugin (GOPluginService *service)
return service->plugin;
}
+/**
+ * go_plugin_service_get_cbs:
+ * @service: #GOPluginService
+ *
+ * Returns: (transfer none): the callbacks for the service
+ **/
gpointer
go_plugin_service_get_cbs (GOPluginService *service)
{
@@ -1316,7 +1328,7 @@ go_plugin_services_shutdown (void)
/**
* go_plugin_service_define:
* @type_str: char const *
- * @ctor: #GOPluginServiceCreate
+ * @ctor: (scope async): #GOPluginServiceCreate
*
* Allow the definition of new service types
**/
diff --git a/goffice/app/go-plugin.c b/goffice/app/go-plugin.c
index 5472fa8..947643e 100644
--- a/goffice/app/go-plugin.c
+++ b/goffice/app/go-plugin.c
@@ -446,7 +446,8 @@ static GSF_CLASS (GOPluginTypeModule, go_plugin_type_module,
* go_plugin_get_type_module:
* @plugin: #GOPlugin
*
- * Returns: the GTypeModule associated with the plugin creating it if necessary.
+ * Returns: (transfer none): the GTypeModule associated with the plugin
+ * creating it if necessary.
**/
GTypeModule *
go_plugin_get_type_module (GOPlugin *plugin)
@@ -547,8 +548,8 @@ go_plugin_is_loaded (GOPlugin *plugin)
/* - */
/**
- * plugins_register_loader:
- * @loader_id: Loader's id
+ * go_plugins_register_loader:
+ * @id_str: Loader's id
* @service: Plugin service of type "plugin_loader"
*
* Registers new type of plugin loader identified by @loader_id (identifier
@@ -568,8 +569,8 @@ go_plugins_register_loader (gchar const *loader_id, GOPluginService *service)
}
/**
- * plugins_unregister_loader:
- * @loader_id: Loader's id
+ * go_plugins_unregister_loader:
+ * @id_str: Loader's id
*
* Unregisters a type of plugin loader identified by @loader_id. After
* callingthis function Gnumeric will be unable to load plugins supported
@@ -1265,7 +1266,8 @@ go_plugin_use_unref (GOPlugin *plugin)
* go_plugin_get_dependencies_ids:
* @plugin: #GOPlugin
*
- * Returns: the list of identifiers of plugins that @plugin depends on.
+ * Returns: (element-type char) (transfer full): the list of identifiers of
+ * plugins that @plugin depends on.
* All these plugins will be automatically activated before activating the
* @plugin itself. The caller must free the returned list together with
* the strings it points to (use g_slist_free_full (list, g_free) to do
@@ -1287,7 +1289,8 @@ go_plugin_get_dependencies_ids (GOPlugin *plugin)
* go_plugin_get_services:
* @plugin: #GOPlugin
*
- * Returns: A list of services. The list must not be freed or changed.
+ * Returns: (element-type GOPluginService) (transfer none):A list of services.
+ * The list must not be freed or changed.
**/
GSList *
go_plugin_get_services (GOPlugin *plugin)
@@ -1301,7 +1304,7 @@ go_plugin_get_services (GOPlugin *plugin)
* go_plugin_get_loader:
* @plugin: #GOPlugin
*
- * Returns: The loader.
+ * Returns: (transfer none): The loader.
**/
GOPluginLoader *
go_plugin_get_loader (GOPlugin *plugin)
@@ -1455,8 +1458,8 @@ go_plugin_list_read_for_all_dirs (GOErrorInfo **ret_error)
}
/**
- * plugin_db_activate_plugin_list:
- * @plugins: The list of plugins
+ * go_plugin_db_activate_plugin_list:
+ * @plugins: (element-type GOPlugin): The list of plugins
* @ret_error: Pointer used to report errors
*
* Activates all plugins in the list. If some of the plugins cannot be
@@ -1490,8 +1493,8 @@ go_plugin_db_activate_plugin_list (GSList *plugins, GOErrorInfo **ret_error)
}
/**
- * plugin_db_deactivate_plugin_list:
- * @plugins: The list of plugins
+ * go_plugin_db_deactivate_plugin_list:
+ * @plugins: (element-type GOPlugin): The list of plugins
* @ret_error: Pointer used to report errors
*
* Deactivates all plugins in the list. If some of the plugins cannot be
@@ -1525,10 +1528,11 @@ go_plugin_db_deactivate_plugin_list (GSList *plugins, GOErrorInfo **ret_error)
}
/**
- * plugins_get_available_plugins:
+ * go_plugins_get_available_plugins:
*
- * Returns: the list of available plugins. The returned value must not be freed
- * and stays valid until calling plugins_rescan or plugins_shutdown.
+ * Returns: (element-type GOPlugin) (transfer container): the list of available
+ * plugins. The returned value must not be freed and stays valid until calling
+ * plugins_rescan or plugins_shutdown.
**/
GSList *
go_plugins_get_available_plugins (void)
@@ -1537,10 +1541,10 @@ go_plugins_get_available_plugins (void)
}
/**
- * plugins_get_active_plugins:
+ * go_plugins_get_active_plugins:
*
- * Returns: the list of active plugins. The caller needs to free the list, but
- * not the content.
+ * Returns: (element-type char) (transfer container): the list of active
+ * plugins names. The caller needs to free the list, but not the content.
**/
GSList *
go_plugins_get_active_plugins (void)
@@ -1557,10 +1561,10 @@ go_plugins_get_active_plugins (void)
}
/**
- * plugins_get_plugin_by_id:
+ * go_plugins_get_plugin_by_id:
* @plugin_id: String containing plugin ID
*
- * Returns: GOPlugin object for plugin with ID equal to @plugin_id or NULL
+ * Returns: (transfer none): GOPlugin object for plugin with ID equal to @plugin_id or NULL
* if there's no plugin available with given id. Function returns
* "borrowed" reference, use g_object_ref if you want to be sure that
* plugin won't disappear.
@@ -1574,7 +1578,7 @@ go_plugins_get_plugin_by_id (gchar const *plugin_id)
}
/**
- * plugin_db_mark_plugin_for_deactivation:
+ * go_plugin_db_mark_plugin_for_deactivation:
* @plugin: #GOPlugin
* @mark:
*/
@@ -1596,7 +1600,7 @@ go_plugin_db_mark_plugin_for_deactivation (GOPlugin *plugin, gboolean mark)
}
/**
- * plugin_db_is_plugin_marked_for_deactivation:
+ * go_plugin_db_is_plugin_marked_for_deactivation:
* @plugin: #GOPlugin
*/
gboolean
@@ -1615,9 +1619,10 @@ ghf_set_state_old_unused (gpointer key, gpointer value, gpointer unused)
}
/**
- * plugins_rescan:
+ * go_plugins_rescan:
* @ret_error: Pointer used to report errors
- * @ret_new_plugins: Optional pointer to return list of new plugins
+ * @ret_new_plugins: (element-type GOPlugin): Optional pointer to return list
+ * of new plugins
*
*
*/
@@ -1749,9 +1754,9 @@ go_plugins_set_dirs (GSList *plugin_dirs)
/**
* go_plugins_init:
* @context: #GOCmdContext used to report errors
- * @known_states: A list of known states (defined how ?)
- * @active_plugins: A list of active plugins
- * @plugin_dirs:a list of directories to search for plugins
+ * @known_states: (element-type char): A list of known states (defined how ?)
+ * @active_plugins: (element-type char): A list of active plugins
+ * @plugin_dirs: (element-type char): a list of directories to search for plugins
* @activate_new_plugins: activate plugins we have no seen before.
* @default_loader_type: importer to use by default.
*
@@ -1856,11 +1861,14 @@ ghf_collect_used_plugin_state_strings (gpointer key, gpointer value, gpointer us
}
/**
- * plugins_shutdown:
+ * go_plugins_shutdown:
*
* Shuts down the plugin subsystem. Call this function only once before
* exiting the application. Some plugins may be left active or in broken
* state, so calling plugins_init again will NOT work properly.
+ *
+ * Returns: (element-type char) (transfer full): the list of plugins still in
+ * use.
*/
GSList *
go_plugins_shutdown (void)
diff --git a/goffice/app/goffice-app.h b/goffice/app/goffice-app.h
index 364dc8a..1ce7b03 100644
--- a/goffice/app/goffice-app.h
+++ b/goffice/app/goffice-app.h
@@ -26,7 +26,6 @@
G_BEGIN_DECLS
-typedef struct _GOApp GOApp;
typedef struct _GODoc GODoc;
typedef struct _GODocControl GODocControl;
typedef struct _GOCmdContext GOCmdContext;
diff --git a/goffice/canvas/goc-item.c b/goffice/canvas/goc-item.c
index 1e5c638..4a13dd2 100644
--- a/goffice/canvas/goc-item.c
+++ b/goffice/canvas/goc-item.c
@@ -35,7 +35,7 @@
**/
/**
- * GocItem:
+ * _GocItem:
* @base: the parent object.
* @canvas: the canvas in which the item is displayed.
* @parent: the parent item.
@@ -47,6 +47,10 @@
* @y0: the lowest vertical bound of the item.
* @x1: the highest horizontal bound of the item.
* @y1: the highest vertical bound of the item.
+ * @op: the #cairo_operator_t to use when drawing the item.
+ * @transform: the #cairo_matrix_t to apply to the item.
+ * @transformed: whether @transform is not unity.
+ * @priv: private data.
*
* <para>
* #GocItem contains the following fields:
diff --git a/goffice/component/go-component-factory.c b/goffice/component/go-component-factory.c
index 1172080..03331f3 100644
--- a/goffice/component/go-component-factory.c
+++ b/goffice/component/go-component-factory.c
@@ -272,6 +272,12 @@ _goc_plugin_services_shutdown (void)
g_hash_table_destroy (suffixes);
}
+/**
+ * go_components_get_mime_types:
+ *
+ * Returns: (element-type char) (transfer none): the list of mime types
+ * supported by at least one registered component.
+ **/
GSList *
go_components_get_mime_types (void)
{
diff --git a/goffice/component/go-component.c b/goffice/component/go-component.c
index 00a38ad..fe308bd 100644
--- a/goffice/component/go-component.c
+++ b/goffice/component/go-component.c
@@ -528,7 +528,7 @@ go_component_set_command_context (GOComponent *component, GOCmdContext *cc)
/**
* go_component_get_command_context:
- * @component: #GogComponent
+ * @component: #GOComponent
*
* Returns: (transfer none): the command context used by the component or the
* default command context if the argument is NULL.
diff --git a/goffice/data/go-data.c b/goffice/data/go-data.c
index 34888e6..095e853 100644
--- a/goffice/data/go-data.c
+++ b/goffice/data/go-data.c
@@ -95,10 +95,10 @@ GSF_CLASS_ABSTRACT (GOData, go_data,
G_TYPE_OBJECT)
/**
- * go_data_dup :
- * @src : #GOData
+ * go_data_dup:
+ * @src: #GOData
*
- * Returns: A deep copy of @src.
+ * Returns: (transfer full): A deep copy of @src.
**/
GOData *
go_data_dup (GOData const *src)
@@ -928,6 +928,12 @@ GSF_CLASS_ABSTRACT (GODataMatrix, go_data_matrix,
go_data_matrix_class_init, NULL,
GO_TYPE_DATA)
+/**
+ * go_data_matrix_get_size: (skip)
+ * @mat: #GODataMatrix
+ *
+ * Returns: the matrix size
+ **/
GODataMatrixSize
go_data_matrix_get_size (GODataMatrix *mat)
{
@@ -947,6 +953,42 @@ go_data_matrix_get_size (GODataMatrix *mat)
return mat->size;
}
+int
+go_data_matrix_get_rows (GODataMatrix *mat)
+{
+ if (!mat)
+ return 0;
+ if (! (mat->base.flags & GO_DATA_MATRIX_SIZE_CACHED)) {
+ GODataMatrixClass const *klass = GO_DATA_MATRIX_GET_CLASS (mat);
+
+ g_return_val_if_fail (klass != NULL, 0);
+
+ (*klass->load_size) (mat);
+
+ g_return_val_if_fail (mat->base.flags & GO_DATA_MATRIX_SIZE_CACHED, 0);
+ }
+
+ return mat->size.rows;
+}
+
+int
+go_data_matrix_get_columns (GODataMatrix *mat)
+{
+ if (!mat)
+ return 0;
+ if (! (mat->base.flags & GO_DATA_MATRIX_SIZE_CACHED)) {
+ GODataMatrixClass const *klass = GO_DATA_MATRIX_GET_CLASS (mat);
+
+ g_return_val_if_fail (klass != NULL, 0);
+
+ (*klass->load_size) (mat);
+
+ g_return_val_if_fail (mat->base.flags & GO_DATA_MATRIX_SIZE_CACHED, 0);
+ }
+
+ return mat->size.columns;
+}
+
double *
go_data_matrix_get_values (GODataMatrix *mat)
{
diff --git a/goffice/data/go-data.h b/goffice/data/go-data.h
index 500204f..f163527 100644
--- a/goffice/data/go-data.h
+++ b/goffice/data/go-data.h
@@ -106,6 +106,8 @@ gboolean go_data_vector_vary_uniformly (GODataVector *vec);
GType go_data_matrix_get_type (void);
GODataMatrixSize go_data_matrix_get_size (GODataMatrix *mat);
+int go_data_matrix_get_rows (GODataMatrix *mat);
+int go_data_matrix_get_columns (GODataMatrix *mat);
double *go_data_matrix_get_values (GODataMatrix *mat);
double go_data_matrix_get_value (GODataMatrix *mat, unsigned i, unsigned j);
char *go_data_matrix_get_str (GODataMatrix *mat, unsigned i, unsigned j);
diff --git a/goffice/goffice.h b/goffice/goffice.h
index 156351c..6dbfa8b 100644
--- a/goffice/goffice.h
+++ b/goffice/goffice.h
@@ -49,6 +49,12 @@
#include <gtk/gtk.h>
#endif
+#if GLIB_CHECK_VERSION(2,32,0)
+#define GOFFICE_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f)
+#else
+#define GOFFICE_DEPRECATED_FOR(f)
+#endif
+
#include <goffice/app/goffice-app.h>
#include <goffice/utils/goffice-utils.h>
#include <goffice/data/goffice-data.h>
diff --git a/goffice/graph/gog-3d-box.c b/goffice/graph/gog-3d-box.c
index 0acaa7b..7ee43b3 100644
--- a/goffice/graph/gog-3d-box.c
+++ b/goffice/graph/gog-3d-box.c
@@ -165,7 +165,7 @@ gog_3d_box_populate_editor (GogObject *gobj,
go_3d_rotation_sel_set_fov (GO_3D_ROTATION_SEL (g3d), box->fov);
go_editor_add_page (editor, g3d, _("Rotation"));
- gui = go_gtk_builder_new_internal ("res:go:graph/gog-3d-box-prefs.ui", GETTEXT_PACKAGE, cc);
+ gui = go_gtk_builder_load_internal ("res:go:graph/gog-3d-box-prefs.ui", GETTEXT_PACKAGE, cc);
if (gui == NULL)
return;
diff --git a/goffice/graph/gog-axis-line.c b/goffice/graph/gog-axis-line.c
index ad97006..7c64fb8 100644
--- a/goffice/graph/gog-axis-line.c
+++ b/goffice/graph/gog-axis-line.c
@@ -495,7 +495,7 @@ gog_axis_base_populate_editor (GogObject *gobj,
return;
}
- gui = go_gtk_builder_new_internal ("res:go:graph/gog-axis-prefs.ui", GETTEXT_PACKAGE, cc);
+ gui = go_gtk_builder_load_internal ("res:go:graph/gog-axis-prefs.ui", GETTEXT_PACKAGE, cc);
if (gui == NULL) {
(GOG_OBJECT_CLASS(gab_parent_klass)->populate_editor) (gobj, editor, dalloc, cc);
return;
diff --git a/goffice/graph/gog-axis.c b/goffice/graph/gog-axis.c
index b01a341..4c44968 100644
--- a/goffice/graph/gog-axis.c
+++ b/goffice/graph/gog-axis.c
@@ -2652,7 +2652,7 @@ gog_axis_populate_editor (GogObject *gobj,
GogDataset *set = GOG_DATASET (gobj);
GtkBuilder *gui;
- gui = go_gtk_builder_new_internal ("res:go:graph/gog-axis-prefs.ui", GETTEXT_PACKAGE, cc);
+ gui = go_gtk_builder_load_internal ("res:go:graph/gog-axis-prefs.ui", GETTEXT_PACKAGE, cc);
if (gui == NULL)
return;
@@ -3184,7 +3184,7 @@ gog_axis_clear_contributors (GogAxis *axis)
* gog_axis_contributors:
* @axis: #GogAxis
*
- * Returns: (element-type GogObject*) (transfer none): the list of the axis
+ * Returns: (element-type GogObject) (transfer none): the list of the axis
* contributors
**/
GSList const *
diff --git a/goffice/graph/gog-chart.c b/goffice/graph/gog-chart.c
index a85ea03..e0dba18 100644
--- a/goffice/graph/gog-chart.c
+++ b/goffice/graph/gog-chart.c
@@ -319,7 +319,7 @@ gog_chart_populate_editor (GogObject *gobj,
g_return_if_fail (chart != NULL);
- gui = go_gtk_builder_new_internal ("res:go:graph/gog-plot-prefs.ui", GETTEXT_PACKAGE, cc);
+ gui = go_gtk_builder_load_internal ("res:go:graph/gog-plot-prefs.ui", GETTEXT_PACKAGE, cc);
g_return_if_fail (gui != NULL);
(GOG_OBJECT_CLASS(chart_parent_klass)->populate_editor) (gobj, editor, dalloc, cc);
@@ -914,7 +914,7 @@ gog_chart_foreach_elem (GogChart *chart, gboolean only_visible,
* gog_chart_get_plots:
* @chart: #GogChart
*
- * Returns: (element-type GogPlot*) (transfer none): the list of the plots
+ * Returns: (element-type GogPlot) (transfer none): the list of the plots
* in @chart.
**/
GSList *
@@ -1014,7 +1014,7 @@ gog_chart_axis_set_assign (GogChart *chart, GogAxisSet axis_set)
* @chart: #GogChart
* @target: #GogAxisType
*
- * Returns: (element-type GogAxis*) (transfer container): a list which the
+ * Returns: (element-type GogAxis) (transfer container): a list which the
* caller must free of all axis of type @target
* associated with @chart.
**/
diff --git a/goffice/graph/gog-data-set.c b/goffice/graph/gog-data-set.c
index e866eac..1206b90 100644
--- a/goffice/graph/gog-data-set.c
+++ b/goffice/graph/gog-data-set.c
@@ -42,10 +42,10 @@ gog_dataset_get_type (void)
}
/**
- * gog_dataset_dims :
- * @set : #GogDataset
- * @first : inclusive
- * @last : _inclusive_
+ * gog_dataset_dims:
+ * @set: #GogDataset
+ * @first: inclusive
+ * @last: _inclusive_
*
* FIXME ?? Fix what ??
* Stores the first and last valid indicises to get/set dim
@@ -62,11 +62,11 @@ gog_dataset_dims (GogDataset const *set, int *first, int *last)
}
/**
- * gog_dataset_get_dim :
- * @set : #GogDataset
- * @dim_i :
+ * gog_dataset_get_dim:
+ * @set: #GogDataset
+ * @dim_i:
*
- * Returns: the GOData associated with dimension @dim_i. Does NOT add a
+ * Returns: (transfer none): the GOData associated with dimension @dim_i. Does NOT add a
* reference. or %NULL on failure.
**/
GOData *
@@ -79,10 +79,10 @@ gog_dataset_get_dim (GogDataset const *set, int dim_i)
}
/**
- * gog_dataset_set_dim :
+ * gog_dataset_set_dim:
* @set: #GogDataset
* @dim_i: < 0 gets the name
- * @val: #GOData
+ * @val: (transfer full): #GOData
* @err: #GError
*
* Absorbs a ref to @val if it is non NULL
@@ -124,6 +124,13 @@ done :
g_object_unref (val);
}
+/**
+ * gog_dataset_get_elem: (skip)
+ * @set: #GogDataset
+ * @dim_i:
+ *
+ * Returns: the GODataset associated with dimension @dim_i.
+ **/
GogDatasetElement *
gog_dataset_get_elem (GogDataset const *set, int dim_i)
{
@@ -143,11 +150,11 @@ cb_dataset_dim_changed (GOData *data, GogDatasetElement *elem)
}
/**
- * gog_dataset_set_dim_internal :
- * @set : #GogDataset
- * @dim_i : the index
- * @val : #GOData
- * @graph : #GogGraph
+ * gog_dataset_set_dim_internal:
+ * @set: #GogDataset
+ * @dim_i: the index
+ * @val: #GOData
+ * @graph: #GogGraph
*
* an internal routine to handle signal setup and teardown
**/
diff --git a/goffice/graph/gog-equation.c b/goffice/graph/gog-equation.c
index 2d9561d..51493fa 100644
--- a/goffice/graph/gog-equation.c
+++ b/goffice/graph/gog-equation.c
@@ -83,7 +83,7 @@ gog_equation_populate_editor (GogObject *obj,
GtkTextBuffer *buffer;
static guint equation_pref_page = 0;
- gui = go_gtk_builder_new_internal ("res:go:graph/gog-equation-prefs.ui", GETTEXT_PACKAGE, cc);
+ gui = go_gtk_builder_load_internal ("res:go:graph/gog-equation-prefs.ui", GETTEXT_PACKAGE, cc);
g_return_if_fail (gui != NULL);
widget = go_gtk_builder_get_widget (gui, "equation_text");
diff --git a/goffice/graph/gog-error-bar.c b/goffice/graph/gog-error-bar.c
index 07ae690..dbb91b5 100644
--- a/goffice/graph/gog-error-bar.c
+++ b/goffice/graph/gog-error-bar.c
@@ -252,7 +252,7 @@ gog_error_bar_prefs (GogSeries *series,
}
set = GOG_DATASET (series);
- gui = go_gtk_builder_new_internal ("res:go:graph/gog-error-bar-prefs.ui", GETTEXT_PACKAGE, cc);
+ gui = go_gtk_builder_load_internal ("res:go:graph/gog-error-bar-prefs.ui", GETTEXT_PACKAGE, cc);
/* Style properties */
@@ -273,7 +273,7 @@ gog_error_bar_prefs (GogSeries *series,
style_table = GTK_TABLE (gtk_builder_get_object (gui, "style_table"));
/* Color */
- w = go_color_selector_new (editor->color, GO_COLOR_BLACK, "error-bar");
+ w = go_selector_new_color (editor->color, GO_COLOR_BLACK, "error-bar");
gtk_label_set_mnemonic_widget (
GTK_LABEL (gtk_builder_get_object (gui, "color_label")), w);
g_signal_connect (G_OBJECT (w),
@@ -295,7 +295,7 @@ gog_error_bar_prefs (GogSeries *series,
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), cell, "text", 1, NULL);
for (i = 0; i < G_N_ELEMENTS (display_combo_desc); i++) {
- pixbuf = go_gdk_pixbuf_new_from_file (direction == GOG_ERROR_BAR_DIRECTION_HORIZONTAL ?
+ pixbuf = go_gdk_pixbuf_load_from_file (direction == GOG_ERROR_BAR_DIRECTION_HORIZONTAL ?
display_combo_desc[i].h_pixbuf :
display_combo_desc[i].v_pixbuf);
gtk_list_store_append (list, &iter);
diff --git a/goffice/graph/gog-graph.c b/goffice/graph/gog-graph.c
index df08229..c01b317 100644
--- a/goffice/graph/gog-graph.c
+++ b/goffice/graph/gog-graph.c
@@ -222,7 +222,7 @@ gog_graph_populate_editor (GogObject *gobj,
GSList *theme_names;
static guint graph_pref_page = 0;
- gui = go_gtk_builder_new_internal ("res:go:graph/gog-graph-prefs.ui", GETTEXT_PACKAGE, cc);
+ gui = go_gtk_builder_load_internal ("res:go:graph/gog-graph-prefs.ui", GETTEXT_PACKAGE, cc);
if (gui == NULL)
return;
@@ -608,7 +608,7 @@ gog_graph_set_theme (GogGraph *graph, GogTheme *theme)
* gog_graph_get_data:
* @graph: #GogGraph
*
- * Returns: (element-type GOData*) (transfer none): a list of the GOData objects that are data to the graph.
+ * Returns: (element-type GOData) (transfer none): a list of the GOData objects that are data to the graph.
* The caller should _not_ modify or free the list.
**/
GSList *
@@ -1135,7 +1135,7 @@ gog_graph_view_set_selection (GogGraphView *gview, GogObject *gobj)
*
* Builds a list of supported formats for image export.
*
- * returns: (element-type GOImageFormat*) (transfer container): a #GSList
+ * returns: (element-type GOImageFormat) (transfer container): a #GSList
* of #GOImageFormat.
**/
diff --git a/goffice/graph/gog-guru.c b/goffice/graph/gog-guru.c
index b65dd3d..9e26168 100644
--- a/goffice/graph/gog-guru.c
+++ b/goffice/graph/gog-guru.c
@@ -1164,7 +1164,7 @@ graph_guru_type_selector_new (GraphGuruState *s)
GtkBuilder *gui;
GOStyle *style;
- gui = go_gtk_builder_new_internal ("res:go:graph/gog-guru-type-selector.ui", GETTEXT_PACKAGE, s->cc);
+ gui = go_gtk_builder_load_internal ("res:go:graph/gog-guru-type-selector.ui", GETTEXT_PACKAGE, s->cc);
typesel = g_new0 (GraphGuruTypeSelector, 1);
typesel->state = s;
@@ -1257,7 +1257,7 @@ graph_guru_type_selector_new (GraphGuruState *s)
static gboolean
graph_guru_init (GraphGuruState *s)
{
- s->gui = go_gtk_builder_new_internal ("res:go:graph/gog-guru.ui", GETTEXT_PACKAGE, s->cc);
+ s->gui = go_gtk_builder_load_internal ("res:go:graph/gog-guru.ui", GETTEXT_PACKAGE, s->cc);
if (s->gui == NULL)
return TRUE;
diff --git a/goffice/graph/gog-label.c b/goffice/graph/gog-label.c
index aeb4cdf..7e1e6ea 100644
--- a/goffice/graph/gog-label.c
+++ b/goffice/graph/gog-label.c
@@ -535,7 +535,7 @@ gog_reg_eqn_populate_editor (GogObject *gobj,
GtkBuilder *gui;
GogRegEqn *reg_eqn = GOG_REG_EQN (gobj);
- gui = go_gtk_builder_new_internal ("res:go:graph/gog-reg-eqn-prefs.ui", GETTEXT_PACKAGE, cc);
+ gui = go_gtk_builder_load_internal ("res:go:graph/gog-reg-eqn-prefs.ui", GETTEXT_PACKAGE, cc);
if (gui == NULL)
return;
diff --git a/goffice/graph/gog-object-xml.c b/goffice/graph/gog-object-xml.c
index fa50d64..9a7edbd 100644
--- a/goffice/graph/gog-object-xml.c
+++ b/goffice/graph/gog-object-xml.c
@@ -226,6 +226,12 @@ typedef struct {
gpointer user_unserialize;
} GogXMLReadState;
+/**
+ * gog_xml_read_state_get_obj:
+ * @xin: #GsfXMLIn
+ *
+ * Returns: (transfer none): the laset rerad #GogObject
+ **/
GogObject *
gog_xml_read_state_get_obj (GsfXMLIn *xin)
{
@@ -493,6 +499,17 @@ static GsfXMLInNode const gog_dtd[] = {
GSF_XML_IN_NODE_END
};
static GsfXMLInDoc *gog_sax_doc = NULL;
+
+/**
+ * gog_object_sax_push_parser:
+ * @xin: #GsfXMLIn
+ * @attrs: XML attributes
+ * @handler: (scope call): callback
+ * @user_unserialize: user data for #GOData reading
+ * @user_data: user data for @handler
+ *
+ * Unserializes a #GogObject using @handler when done.
+ **/
void
gog_object_sax_push_parser (GsfXMLIn *xin, xmlChar const **attrs,
GogObjectSaxHandler handler,
diff --git a/goffice/graph/gog-object.c b/goffice/graph/gog-object.c
index 11edcd3..77697c4 100644
--- a/goffice/graph/gog-object.c
+++ b/goffice/graph/gog-object.c
@@ -477,7 +477,7 @@ gog_object_populate_editor (GogObject *gobj,
if (!(allowable_positions & (GOG_POSITION_MANUAL | GOG_POSITION_COMPASS)))
return;
- gui = go_gtk_builder_new_internal ("res:go:graph/gog-object-prefs.ui", GETTEXT_PACKAGE, cc);
+ gui = go_gtk_builder_load_internal ("res:go:graph/gog-object-prefs.ui", GETTEXT_PACKAGE, cc);
if (gui == NULL)
return;
@@ -1129,7 +1129,7 @@ gog_object_set_name (GogObject *obj, char *name, GError **err)
* @obj: a #GogObject
* @filter: an optional #GogObjectRole to use as a filter
*
- * Returns: (element-type GogObject*) (transfer container): list of @obj's
+ * Returns: (element-type GogObject) (transfer container): list of @obj's
* Children. Caller must free the list, but not the children.
**/
GSList *
@@ -1170,7 +1170,6 @@ gog_object_get_child_by_role (GogObject const *obj, GogObjectRole const *role)
}
/**
- *
* gog_object_get_child_by_name:
* @obj: a #GogObject
* @name: a #char to use as a role name filter
@@ -1258,7 +1257,7 @@ gog_role_cmp_full (GogObjectRole const *a, GogObjectRole const *b)
* gog_object_possible_additions:
* @parent: a #GogObject
*
- * Returns: (element-type GogObjectRole*) (transfer container): a list
+ * Returns: (element-type GogObjectRole) (transfer container): a list
* of GogObjectRoles that could be added. The resulting list needs to be freed
**/
GSList *
diff --git a/goffice/graph/gog-plot-engine.c b/goffice/graph/gog-plot-engine.c
index 5ad499c..97038b6 100644
--- a/goffice/graph/gog-plot-engine.c
+++ b/goffice/graph/gog-plot-engine.c
@@ -811,6 +811,11 @@ create_trend_line_types (void)
NULL, (GDestroyNotify) gog_trend_line_type_free);
}
+/**
+ * gog_trend_line_types:
+ *
+ * Returns: (transfer none): the registered trend line types.
+ **/
GHashTable const *
gog_trend_line_types (void)
{
diff --git a/goffice/graph/gog-reg-curve.c b/goffice/graph/gog-reg-curve.c
index a46cfa0..957664d 100644
--- a/goffice/graph/gog-reg-curve.c
+++ b/goffice/graph/gog-reg-curve.c
@@ -110,7 +110,7 @@ gog_reg_curve_populate_editor (GogObject *gobj,
struct reg_curve_closure *cl;
GogRegCurveDrawingBounds db = GOG_REG_CURVE (gobj)->drawing_bounds;
- gui = go_gtk_builder_new_internal ("res:go:graph/gog-reg-curve-prefs.ui", GETTEXT_PACKAGE, cc);
+ gui = go_gtk_builder_load_internal ("res:go:graph/gog-reg-curve-prefs.ui", GETTEXT_PACKAGE, cc);
if (gui == NULL)
return;
diff --git a/goffice/graph/gog-series-labels.c b/goffice/graph/gog-series-labels.c
index 7804872..a8f83bc 100644
--- a/goffice/graph/gog-series-labels.c
+++ b/goffice/graph/gog-series-labels.c
@@ -354,7 +354,7 @@ gog_series_labels_populate_editor (GogObject *gobj,
char const *custom_lbl;
gboolean supports_percent;
- gui = go_gtk_builder_new_internal ("res:go:graph/gog-series-labels-prefs.ui", GETTEXT_PACKAGE, cc);
+ gui = go_gtk_builder_load_internal ("res:go:graph/gog-series-labels-prefs.ui", GETTEXT_PACKAGE, cc);
labels_prefs = go_gtk_builder_get_widget (gui, "series-labels-prefs");
state->labels = gobj;
diff --git a/goffice/graph/gog-series.c b/goffice/graph/gog-series.c
index dd51a39..f5e75f2 100644
--- a/goffice/graph/gog-series.c
+++ b/goffice/graph/gog-series.c
@@ -562,7 +562,7 @@ gog_series_populate_editor (GogObject *gobj,
GtkBuilder *gui;
GtkWidget *widget;
- gui = go_gtk_builder_new_internal ("res:go:graph/gog-series-prefs.ui", GETTEXT_PACKAGE, cc);
+ gui = go_gtk_builder_load_internal ("res:go:graph/gog-series-prefs.ui", GETTEXT_PACKAGE, cc);
if (gui != NULL) {
int i;
GogAxisSet set = gog_plot_axis_set_pref (gog_series_get_plot (series));
@@ -617,7 +617,7 @@ gog_series_populate_editor (GogObject *gobj,
GtkBuilder *gui;
GtkWidget *widget;
- gui = go_gtk_builder_new_internal ("res:go:graph/gog-series-prefs.ui", GETTEXT_PACKAGE, cc);
+ gui = go_gtk_builder_load_internal ("res:go:graph/gog-series-prefs.ui", GETTEXT_PACKAGE, cc);
if (gui != NULL) {
widget = go_gtk_builder_get_widget (gui, "fill_type_combo");
gog_series_populate_fill_type_combo (GOG_SERIES (series), GTK_COMBO_BOX (widget));
@@ -885,7 +885,7 @@ GSF_CLASS_FULL (GogSeries, gog_series,
* gog_series_get_plot:
* @series: #GogSeries
*
- * Returns: the possibly NULL plot that contains this series.
+ * Returns: (transfer none): the possibly NULL plot that contains this series.
**/
GogPlot *
gog_series_get_plot (GogSeries const *series)
@@ -988,7 +988,7 @@ gog_series_set_index (GogSeries *series, int ind, gboolean is_manual)
* Gets the _source_ of the name associated with the series.
* NOTE : this is _NOT_ the actual name.
*
- * return value: a #GODataScalar, without added reference.
+ * return value: (transfer none): a #GODataScalar, without added reference.
**/
GOData *
gog_series_get_name (GogSeries const *series)
@@ -1067,6 +1067,14 @@ gog_series_num_elements (GogSeries const *series)
return series->num_elements;
}
+/**
+ * gog_series_get_overrides:
+ * @series: #GogSeries
+ *
+ * Overrides are data owning their own style, overriding the series style.
+ * Returns: (element-type GogSeriesElement) (transfer none): the series
+ * overrides.
+ **/
GList const *
gog_series_get_overrides (GogSeries const *series)
{
@@ -1111,8 +1119,8 @@ gog_series_get_valid_element_index (GogSeries const *series, int old_index, int
/**
* gog_series_get_element:
- * series: #GogSeries
- * index: the element index
+ * @series: #GogSeries
+ * @index: the element index
*
* Returns: (transfer none): the #GogSeriesElement corresponding to @index if
* any
@@ -1277,6 +1285,14 @@ gog_series_get_fill_type_from_combo (GogSeries const *series, GtkComboBox *combo
}
#endif
+/**
+ * gog_series_get_interpolation_params:
+ * @series: #GogSeries
+ *
+ * Only constrained cubic spline interpolation use parameters (for the
+ * slopes at each end).
+ * Returns: (transfer none): the interpolation parameters.
+ **/
GogDataset *
gog_series_get_interpolation_params (GogSeries const *series)
{
diff --git a/goffice/graph/gog-styled-object.c b/goffice/graph/gog-styled-object.c
index 0880ea3..f11949f 100644
--- a/goffice/graph/gog-styled-object.c
+++ b/goffice/graph/gog-styled-object.c
@@ -300,9 +300,15 @@ GSF_CLASS_FULL (GogStyledObject, gog_styled_object, NULL, NULL,
GOG_TYPE_OBJECT, G_TYPE_FLAG_ABSTRACT,
GSF_INTERFACE (gog_styled_object_so_init, GO_TYPE_STYLED_OBJECT))
-
+#ifndef GOFFICE_DISABLE_DEPRECTATED
+/**
+ * gog_style_new: (skip)
+ *
+ * Returns: (transfer full): the new #GogStyle
+ **/
GOStyle *
gog_style_new (void)
{
return g_object_new (gog_style_get_type (), NULL);
}
+#endif
diff --git a/goffice/graph/gog-styled-object.h b/goffice/graph/gog-styled-object.h
index 046aa8e..2081c68 100644
--- a/goffice/graph/gog-styled-object.h
+++ b/goffice/graph/gog-styled-object.h
@@ -50,7 +50,10 @@ typedef struct {
#define GOG_STYLED_OBJECT_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GOG_TYPE_STYLED_OBJECT, GogStyledObjectClass))
GType gog_styled_object_get_type (void);
+#ifndef GOFFICE_DISABLE_DEPRECATED
+GOFFICE_DEPRECATED_FOR(go_style_new)
GOStyle *gog_style_new (void);
+#endif
G_END_DECLS
diff --git a/goffice/graph/gog-view.c b/goffice/graph/gog-view.c
index 9f8b3b1..d434e22 100644
--- a/goffice/graph/gog-view.c
+++ b/goffice/graph/gog-view.c
@@ -206,6 +206,26 @@ static GogTool gog_tool_resize_object = {
/*****************************************************************************/
+static GogToolAction *
+gog_tool_action_ref (GogToolAction *action)
+{
+ action->ref_count++;
+ return action;
+}
+
+GType
+gog_tool_action_get_type (void)
+{
+ static GType t = 0;
+
+ if (t == 0) {
+ t = g_boxed_type_register_static ("GogToolAction",
+ (GBoxedCopyFunc)gog_tool_action_ref,
+ (GBoxedFreeFunc)gog_tool_action_free);
+ }
+ return t;
+}
+
GogToolAction *
gog_tool_action_new (GogView *view, GogTool *tool, double x, double y)
{
@@ -222,6 +242,7 @@ gog_tool_action_new (GogView *view, GogTool *tool, double x, double y)
action->data = NULL;
action->start_x = x;
action->start_y = y;
+ action->ref_count = 1;
if (tool->init != NULL)
(tool->init) (action);
@@ -252,6 +273,9 @@ gog_tool_action_free (GogToolAction *action)
{
g_return_if_fail (action != NULL);
+ if (action->ref_count-- > 1)
+ return;
+
if (action->tool->destroy != NULL)
(action->tool->destroy) (action);
@@ -626,6 +650,12 @@ GSF_CLASS_ABSTRACT (GogView, gog_view,
gog_view_class_init, gog_view_init,
G_TYPE_OBJECT)
+/**
+ * gog_view_get_model:
+ * @view: #GogView
+ *
+ * Returns: (transfer none): the #GogObject owning the view.
+ **/
GogObject *
gog_view_get_model (GogView const *view)
{
@@ -866,7 +896,7 @@ gog_view_size_child_request (GogView *view,
*
* Find the GogView contained in @container that corresponds to @model.
*
- * Returns: NULL on error or if @target_model has no view.
+ * Returns: (transfer none): NULL on error or if @target_model has no view.
**/
GogView *
gog_view_find_child_view (GogView const *container, GogObject const *target_model)
@@ -931,7 +961,7 @@ gog_view_render_toolkit (GogView *view)
* gog_view_get_toolkit:
* @view: #GogView
*
- * Returns: toolkit associated with given view.
+ * Returns: (element-type GogTool) (transfer none): toolkit associated with given view.
**/
GSList const *
gog_view_get_toolkit (GogView *view)
@@ -954,7 +984,7 @@ gog_view_get_toolkit (GogView *view)
* @y: in coords
* @gobj: pointed object or NULL
*
- * Returns: tool under cursor for a given view, or %NULL
+ * Returns: (transfer none): tool under cursor for a given view, or %NULL
**/
GogTool *
gog_view_get_tool_at_point (GogView *view, double x, double y, GogObject **gobj)
@@ -990,7 +1020,7 @@ gog_view_get_tool_at_point (GogView *view, double x, double y, GogObject **gobj)
* is stored in @obj. This object may or may not be @view->model of pointed view.
* This function also stores tool under cursor, for the pointed view.
*
- * return value: the #GogView at x,y position
+ * Returns: (transfer none): the #GogView at x,y position
**/
GogView *
gog_view_get_view_at_point (GogView *view, double x, double y, GogObject **obj, GogTool **tool)
diff --git a/goffice/graph/gog-view.h b/goffice/graph/gog-view.h
index 4f2b470..d1eee45 100644
--- a/goffice/graph/gog-view.h
+++ b/goffice/graph/gog-view.h
@@ -48,9 +48,11 @@ struct _GogToolAction {
GogView *view;
GogTool *tool;
gpointer data;
+ unsigned ref_count;
};
-GogToolAction *gog_tool_action_new (GogView *view, GogTool *tool, double x, double y);
+GType gog_tool_action_get_type (void);
+GogToolAction *gog_tool_action_new (GogView *view, GogTool *tool, double x, double y);
void gog_tool_action_move (GogToolAction *action, double x, double y);
void gog_tool_action_double_click (GogToolAction *action);
void gog_tool_action_free (GogToolAction *action);
@@ -68,9 +70,9 @@ struct _GogView {
GogViewAllocation allocation; /* in renderer units */
GogViewAllocation residual; /* left over after compass children are placed */
- unsigned allocation_valid : 1; /* adjust our layout when child changes size */
- unsigned child_allocations_valid : 1; /* some children need to adjust their layout */
- unsigned being_updated : 1;
+ unsigned allocation_valid: 1; /* adjust our layout when child changes size */
+ unsigned child_allocations_valid: 1; /* some children need to adjust their layout */
+ unsigned being_updated: 1;
GSList *toolkit; /* List of GogTool */
void *_priv; /* for future use */
@@ -79,7 +81,7 @@ struct _GogView {
typedef struct {
GObjectClass base;
- unsigned clip : 1; /* Automaticaly clip to object bounding box */
+ unsigned clip; /* Automaticaly clip to object bounding box */
/* Virtuals */
void (*state_init) (GogView *);
diff --git a/goffice/gtk/go-3d-rotation-sel.c b/goffice/gtk/go-3d-rotation-sel.c
index db99529..1a4db4a 100644
--- a/goffice/gtk/go-3d-rotation-sel.c
+++ b/goffice/gtk/go-3d-rotation-sel.c
@@ -328,7 +328,7 @@ g3d_init (GO3DRotationSel *g3d)
{
GtkWidget *w;
- g3d->gui = go_gtk_builder_new_internal ("res:go:gtk/go-3d-rotation-sel.ui",
+ g3d->gui = go_gtk_builder_load_internal ("res:go:gtk/go-3d-rotation-sel.ui",
GETTEXT_PACKAGE, NULL);
if (g3d->gui == NULL)
return;
diff --git a/goffice/gtk/go-color-palette.c b/goffice/gtk/go-color-palette.c
index ad42c90..837eee7 100644
--- a/goffice/gtk/go-color-palette.c
+++ b/goffice/gtk/go-color-palette.c
@@ -472,7 +472,7 @@ custom_colors :
&color_name, col, row + 1);
}
- w = go_gtk_button_new_with_stock (_("Custom Color..."),
+ w = go_gtk_button_build_with_stock (_("Custom Color..."),
GTK_STOCK_SELECT_COLOR);
gtk_button_set_alignment (GTK_BUTTON (w), 0., .5);
gtk_table_attach (GTK_TABLE (table), w, 0, cols,
diff --git a/goffice/gtk/go-color-selector.c b/goffice/gtk/go-color-selector.c
index 18b898c..6efb4db 100644
--- a/goffice/gtk/go-color-selector.c
+++ b/goffice/gtk/go-color-selector.c
@@ -261,7 +261,7 @@ go_color_selector_drag_fill_icon (GOSelector *selector, GdkPixbuf *pixbuf)
}
/**
- * go_color_selector_new:
+ * go_selector_new_color:
* @initial_color: initially selected color
* @default_color: automatic color
* @color_group: a #GOColorGroup name
@@ -270,10 +270,11 @@ go_color_selector_drag_fill_icon (GOSelector *selector, GdkPixbuf *pixbuf)
* Palette will contain an automatic button, which can be used to
* select @default_color. This widget supports color drag and drop.
*
- * Returns: a #GtkWidget.
+ * Since: 0.9.6
+ * Returns: (transfer full): a #GtkWidget.
**/
GtkWidget *
-go_color_selector_new (GOColor initial_color,
+go_selector_new_color (GOColor initial_color,
GOColor default_color,
char const *group)
{
@@ -315,6 +316,27 @@ go_color_selector_new (GOColor initial_color,
}
/**
+ * go_color_selector_new:
+ * @initial_color: initially selected color
+ * @default_color: automatic color
+ * @color_group: a #GOColorGroup name
+ *
+ * Creates a new color selector, with @initial_color selected.
+ * Palette will contain an automatic button, which can be used to
+ * select @default_color. This widget supports color drag and drop.
+ *
+ * Deprecated: 0.9.6 use go_selector_new_color()
+ * Returns: (transfer full): a #GtkWidget.
+ **/
+GtkWidget *
+go_color_selector_new (GOColor initial_color,
+ GOColor default_color,
+ char const *group)
+{
+ return go_selector_new_color (initial_color, default_color, group);
+}
+
+/**
* go_color_selector_set_color:
* @selector: a color selector
* @color: a color
diff --git a/goffice/gtk/go-color-selector.h b/goffice/gtk/go-color-selector.h
index b2e8ad3..b32e973 100644
--- a/goffice/gtk/go-color-selector.h
+++ b/goffice/gtk/go-color-selector.h
@@ -26,9 +26,15 @@
G_BEGIN_DECLS
+GtkWidget *go_selector_new_color (GOColor initial_color,
+ GOColor default_color,
+ char const *color_group);
+#ifndef GOFFICE_DISABLE_DEPRECATED
+GOFFICE_DEPRECATED_FOR(go_selector_new_color)
GtkWidget *go_color_selector_new (GOColor initial_color,
GOColor default_color,
char const *color_group);
+#endif
GOColor go_color_selector_get_color (GOSelector *selector, gboolean *is_auto);
gboolean go_color_selector_set_color (GOSelector *selector, GOColor color);
void go_color_selector_set_allow_alpha (GOSelector *selector, gboolean allow_alpha);
diff --git a/goffice/gtk/go-combo-box.c b/goffice/gtk/go-combo-box.c
index 2b4f8ce..bbe1897 100644
--- a/goffice/gtk/go-combo-box.c
+++ b/goffice/gtk/go-combo-box.c
@@ -644,12 +644,10 @@ static gboolean
cb_tearable_button_release (GtkWidget *w, GdkEventButton *event,
GOComboBox *combo)
{
- GtkTearoffMenuItem *tearable;
g_return_val_if_fail (w != NULL, FALSE);
g_return_val_if_fail (GTK_IS_TEAROFF_MENU_ITEM (w), FALSE);
- tearable = GTK_TEAROFF_MENU_ITEM (w);
/* FIXME: should we notify the parent menu? */
if (!combo->priv->torn_off) {
diff --git a/goffice/gtk/go-font-sel.c b/goffice/gtk/go-font-sel.c
index 13dfe47..065bf19 100644
--- a/goffice/gtk/go-font-sel.c
+++ b/goffice/gtk/go-font-sel.c
@@ -353,7 +353,7 @@ gfs_init (GOFontSel *gfs)
{
GtkWidget *w;
- gfs->gui = go_gtk_builder_new_internal ("res:go:gtk/go-font-sel.ui", GETTEXT_PACKAGE, NULL);
+ gfs->gui = go_gtk_builder_load_internal ("res:go:gtk/go-font-sel.ui", GETTEXT_PACKAGE, NULL);
if (gfs->gui == NULL)
return;
diff --git a/goffice/gtk/go-format-sel.c b/goffice/gtk/go-format-sel.c
index 277fd8c..3464380 100644
--- a/goffice/gtk/go-format-sel.c
+++ b/goffice/gtk/go-format-sel.c
@@ -1461,7 +1461,7 @@ nfs_init (GOFormatSel *gfs)
gfs->show_format_with_markup = FALSE;
gfs->locale = NULL;
- gfs->gui = go_gtk_builder_new_internal ("res:go:gtk/go-format-sel.ui", GETTEXT_PACKAGE, NULL);
+ gfs->gui = go_gtk_builder_load_internal ("res:go:gtk/go-format-sel.ui", GETTEXT_PACKAGE, NULL);
if (gfs->gui == NULL)
return;
diff --git a/goffice/gtk/go-gradient-selector.c b/goffice/gtk/go-gradient-selector.c
index f65a5e7..87b2cfe 100644
--- a/goffice/gtk/go-gradient-selector.c
+++ b/goffice/gtk/go-gradient-selector.c
@@ -84,8 +84,18 @@ go_gradient_swatch_render_func (cairo_t *cr,
cairo_pattern_destroy (cr_pattern);
}
+/**
+ * go_selector_new_gradient:
+ * @initial_direction: initially selected direction
+ * @default_direction: automatic gradient direction
+ *
+ * Creates a new gradient selector.
+ *
+ * Since: 0.9.6
+ * Returns: (transfer full): a new #GtkWidget.
+ **/
GtkWidget *
-go_gradient_selector_new (GOGradientDirection initial_direction,
+go_selector_new_gradient (GOGradientDirection initial_direction,
GOGradientDirection default_direction)
{
GtkWidget *palette;
@@ -108,6 +118,23 @@ go_gradient_selector_new (GOGradientDirection initial_direction,
return selector;
}
+/**
+ * go_gradient_selector_new:
+ * @initial_direction: initially selected direction
+ * @default_direction: automatic gradient direction
+ *
+ * Creates a new gradient selector.
+ *
+ * Deprecated: 0.9.6, use go_selector_new_gradient().
+ * Returns: (transfer full): a new #GtkWidget.
+ **/
+GtkWidget *
+go_gradient_selector_new (GOGradientDirection initial_direction,
+ GOGradientDirection default_direction)
+{
+ return go_selector_new_gradient (initial_direction, default_direction);
+}
+
void
go_gradient_selector_set_colors (GOSelector *selector,
GOColor start_color,
diff --git a/goffice/gtk/go-gradient-selector.h b/goffice/gtk/go-gradient-selector.h
index ce8ce16..ec0e972 100644
--- a/goffice/gtk/go-gradient-selector.h
+++ b/goffice/gtk/go-gradient-selector.h
@@ -26,8 +26,13 @@
G_BEGIN_DECLS
+GtkWidget *go_selector_new_gradient (GOGradientDirection initial_direction,
+ GOGradientDirection default_direction);
+#ifndef GOFFICE_DISABLE_DEPRECATED
+GOFFICE_DEPRECATED_FOR(go_selector_new_gradient)
GtkWidget *go_gradient_selector_new (GOGradientDirection initial_direction,
GOGradientDirection default_direction);
+#endif
void go_gradient_selector_set_colors (GOSelector *selector,
GOColor start,
GOColor stop);
diff --git a/goffice/gtk/go-graph-widget.c b/goffice/gtk/go-graph-widget.c
index aaac6bb..a0d7aa3 100644
--- a/goffice/gtk/go-graph-widget.c
+++ b/goffice/gtk/go-graph-widget.c
@@ -29,7 +29,7 @@
static void go_graph_widget_request_update (GOGraphWidget *w);
/**
- * SECTION: go_graph_widget
+ * SECTION: go-graph-widget
* @short_description: Widget showing a #GogGraph.
*
* Utility widget for showing a #GogGraph.
diff --git a/goffice/gtk/go-image-sel.c b/goffice/gtk/go-image-sel.c
index ded6273..8a97b41 100644
--- a/goffice/gtk/go-image-sel.c
+++ b/goffice/gtk/go-image-sel.c
@@ -233,7 +233,7 @@ go_image_sel_new (GODoc *doc, GOCmdContext *cc, GOImage **image)
state->doc = doc;
state->cc = cc;
state->result = image;
- state->gui = go_gtk_builder_new_internal ("res:go:gtk/go-image-sel.ui", GETTEXT_PACKAGE, state->cc);
+ state->gui = go_gtk_builder_load_internal ("res:go:gtk/go-image-sel.ui", GETTEXT_PACKAGE, state->cc);
if (state->gui == NULL) {
g_free (state);
return NULL;
diff --git a/goffice/gtk/go-line-selector.c b/goffice/gtk/go-line-selector.c
index c5ea319..27fd555 100644
--- a/goffice/gtk/go-line-selector.c
+++ b/goffice/gtk/go-line-selector.c
@@ -68,16 +68,17 @@ go_line_dash_palette_get_tooltip_func (int index, void *data)
}
/**
- * go_line_dash_selector_new:
+ * go_selector_new_line_dash:
* @initial_type: line type initially selected
* @default_type: automatic line type
*
* Creates a new line type selector.
*
- * Returns: a new #GtkWidget.
+ * Since: 0.9.6
+ * Returns: (transfer full): a new #GtkWidget.
**/
GtkWidget *
-go_line_dash_selector_new (GOLineDashType initial_type,
+go_selector_new_line_dash (GOLineDashType initial_type,
GOLineDashType default_type)
{
GtkWidget *palette;
@@ -95,3 +96,20 @@ go_line_dash_selector_new (GOLineDashType initial_type,
CLAMP (initial_type, 0, GO_LINE_MAX - 1));
return selector;
}
+
+/**
+ * go_line_dash_selector_new:
+ * @initial_type: line type initially selected
+ * @default_type: automatic line type
+ *
+ * Creates a new line type selector.
+ *
+ * Deprecated: 0.9.6, use go_selector_new_line_dash().
+ * Returns: (transfer full): a new #GtkWidget.
+ **/
+GtkWidget *
+go_line_dash_selector_new (GOLineDashType initial_type,
+ GOLineDashType default_type)
+{
+ return go_selector_new_line_dash (initial_type, default_type);
+}
diff --git a/goffice/gtk/go-line-selector.h b/goffice/gtk/go-line-selector.h
index be9eb79..ff83e51 100644
--- a/goffice/gtk/go-line-selector.h
+++ b/goffice/gtk/go-line-selector.h
@@ -26,8 +26,13 @@
G_BEGIN_DECLS
+GtkWidget *go_selector_new_line_dash (GOLineDashType initial_type,
+ GOLineDashType default_type);
+#ifndef GOFFICE_DISABLE_DEPRECATED
+GOFFICE_DEPRECATED_FOR(go_selector_new_line_dash)
GtkWidget *go_line_dash_selector_new (GOLineDashType initial_type,
GOLineDashType default_type);
+#endif
G_END_DECLS
diff --git a/goffice/gtk/go-pattern-selector.c b/goffice/gtk/go-pattern-selector.c
index 61fa16d..d3c4278 100644
--- a/goffice/gtk/go-pattern-selector.c
+++ b/goffice/gtk/go-pattern-selector.c
@@ -65,7 +65,7 @@ go_pattern_palette_render_func (cairo_t *cr,
*
* Creates a new pattern selector.
*
- * Returns: a new #GtkWidget.
+ * Returns: (transfer full): a new #GtkWidget.
**/
GtkWidget *
go_pattern_selector_new (GOPatternType initial_type,
diff --git a/goffice/gtk/go-rotation-sel.c b/goffice/gtk/go-rotation-sel.c
index 9bc166c..4125bed 100644
--- a/goffice/gtk/go-rotation-sel.c
+++ b/goffice/gtk/go-rotation-sel.c
@@ -205,7 +205,7 @@ grs_init (GORotationSel *grs)
{
GtkWidget *w;
- grs->gui = go_gtk_builder_new_internal ("res:go:gtk/go-rotation-sel.ui", GETTEXT_PACKAGE, NULL);
+ grs->gui = go_gtk_builder_load_internal ("res:go:gtk/go-rotation-sel.ui", GETTEXT_PACKAGE, NULL);
if (grs->gui == NULL)
return;
diff --git a/goffice/gtk/goffice-gtk.c b/goffice/gtk/goffice-gtk.c
index 943d511..a6305ba 100644
--- a/goffice/gtk/goffice-gtk.c
+++ b/goffice/gtk/goffice-gtk.c
@@ -50,17 +50,18 @@
/**
- * go_gtk_button_new_with_stock:
+ * go_gtk_button_build_with_stock:
* @text: button label
* @stock_id: id for stock icon
*
* FROM : gedit
* Creates a new GtkButton with custom label and stock image.
*
- * Returns: newly created button
+ * Since: 0.9.9
+ * Returns: (transfer full): newly created button
**/
GtkWidget*
-go_gtk_button_new_with_stock (char const *text, char const* stock_id)
+go_gtk_button_build_with_stock (char const *text, char const* stock_id)
{
GtkStockItem item;
GtkWidget *button = gtk_button_new_with_mnemonic (text);
@@ -71,6 +72,23 @@ go_gtk_button_new_with_stock (char const *text, char const* stock_id)
}
/**
+ * go_gtk_button_new_with_stock:
+ * @text: button label
+ * @stock_id: id for stock icon
+ *
+ * FROM : gedit
+ * Creates a new GtkButton with custom label and stock image.
+ *
+ * Deprecated: 09.6., use go_gtk_button_build_with_stock().
+ * Returns: (transfer full): newly created button
+ **/
+GtkWidget*
+go_gtk_button_new_with_stock (char const *text, char const* stock_id)
+{
+ return go_gtk_button_build_with_stock (text, stock_id);
+}
+
+/**
* go_gtk_dialog_add_button:
* @dialog: dialog you want to add a button
* @text: button label
@@ -80,7 +98,7 @@ go_gtk_button_new_with_stock (char const *text, char const* stock_id)
* FROM : gedit
* Creates and adds a button with stock image to the action area of an existing dialog.
*
- * Returns: newly created button
+ * Returns: (transfer none): newly created button
**/
GtkWidget*
go_gtk_dialog_add_button (GtkDialog *dialog, char const* text, char const* stock_id,
@@ -92,7 +110,7 @@ go_gtk_dialog_add_button (GtkDialog *dialog, char const* text, char const* stock
g_return_val_if_fail (text != NULL, NULL);
g_return_val_if_fail (stock_id != NULL, NULL);
- button = go_gtk_button_new_with_stock (text, stock_id);
+ button = go_gtk_button_build_with_stock (text, stock_id);
g_return_val_if_fail (button != NULL, NULL);
gtk_widget_set_can_default (button, TRUE);
@@ -137,14 +155,15 @@ apply_ui_from_file (GtkBuilder *gui, GsfInput *src, const char *uifile,
/**
- * go_gtk_builder_new:
+ * go_gtk_builder_load:
* @uifile: the name of the file load
* @domain: the translation domain
* @gcc: #GOCmdContext
*
* Simple utility to open ui files
*
- * Returns: a new #GtkBuilder or NULL
+ * Since 0.9.6
+ * Returns: (transfer full): a new #GtkBuilder or NULL
*
* @uifile should be one of these:
*
@@ -155,7 +174,7 @@ apply_ui_from_file (GtkBuilder *gui, GsfInput *src, const char *uifile,
* Data may be compressed, regardless of source.
**/
GtkBuilder *
-go_gtk_builder_new (char const *uifile,
+go_gtk_builder_load (char const *uifile,
char const *domain, GOCmdContext *gcc)
{
GtkBuilder *gui;
@@ -219,34 +238,106 @@ go_gtk_builder_new (char const *uifile,
return gui;
}
-/*
+
+/**
+ * go_gtk_builder_new:
+ * @uifile: the name of the file load
+ * @domain: the translation domain
+ * @gcc: #GOCmdContext
+ *
+ * Simple utility to open ui files
+ *
+ * Deprecated: 0.9.6, use go_gtk_builder_load().
+ * Returns: (transfer full): a new #GtkBuilder or NULL
+ *
+ * @uifile should be one of these:
+ *
+ * res:NAME -- data from resource manager
+ * data:DATA -- data right here
+ * filename -- data from local file
+ *
+ * Data may be compressed, regardless of source.
+**/
+GtkBuilder *
+go_gtk_builder_new (char const *uifile,
+ char const *domain, GOCmdContext *gcc)
+{
+ return go_gtk_builder_load (uifile, domain, gcc);
+}
+
+/**
+ * go_gtk_builder_load_internal:
+ * @uifile: the name of the file load
+ * @domain: the translation domain
+ * @gcc: #GOCmdContext
+ *
+ * Simple utility to open ui files
+ *
+ * Since: 0.9.6
+ * Returns: (transfer full): a new #GtkBuilder or NULL
+ *
* Variant of go_gtk_builder_new that searchs goffice directories
* for files.
- */
+ * @uifile should be one of these:
+ *
+ * res:NAME -- data from resource manager
+ * data:DATA -- data right here
+ * filename -- data from local file
+ *
+ * Data may be compressed, regardless of source.
+**/
GtkBuilder *
-go_gtk_builder_new_internal (char const *uifile,
+go_gtk_builder_load_internal (char const *uifile,
char const *domain, GOCmdContext *gcc)
{
char *f;
GtkBuilder *res;
if (g_path_is_absolute (uifile) || strncmp (uifile, "res:", 4) == 0)
- return go_gtk_builder_new (uifile, domain, gcc);
+ return go_gtk_builder_load (uifile, domain, gcc);
f = g_build_filename (go_sys_data_dir (), "ui", uifile, NULL);
- res = go_gtk_builder_new (f, domain, gcc);
+ res = go_gtk_builder_load (f, domain, gcc);
g_free (f);
return res;
}
+/**
+ * go_gtk_builder_new_internal:
+ * @uifile: the name of the file load
+ * @domain: the translation domain
+ * @gcc: #GOCmdContext
+ *
+ * Simple utility to open ui files
+ *
+ * Deprecated: 0.9.6, use go_gtk_builder_load_internal().
+ * Returns: (transfer full): a new #GtkBuilder or NULL
+ *
+ * Variant of go_gtk_builder_new that searchs goffice directories
+ * for files.
+ * @uifile should be one of these:
+ *
+ * res:NAME -- data from resource manager
+ * data:DATA -- data right here
+ * filename -- data from local file
+ *
+ * Data may be compressed, regardless of source.
+**/
+GtkBuilder *
+go_gtk_builder_new_internal (char const *uifile,
+ char const *domain, GOCmdContext *gcc)
+{
+ return go_gtk_builder_load_internal (uifile, domain, gcc);
+}
+
/**
* go_gtk_builder_signal_connect:
* @gui: #GtkBuilder
* @instance_name: widget name
* @detailed_signal: signal name
- * @c_handler: #GCallback
+ * @c_handler: (scope async): #GCallback
* @data: arbitrary
*
* Convenience wrapper around g_signal_connect for GtkBuilder.
@@ -268,11 +359,11 @@ go_gtk_builder_signal_connect (GtkBuilder *gui,
}
/**
- * go_xml_builder_signal_connect_swapped:
+ * go_gtk_builder_signal_connect_swapped:
* @gui: #GtkBuilder
* @instance_name: widget name
* @detailed_signal: signal name
- * @c_handler: #GCallback
+ * @c_handler: (scope async): #GCallback
* @data: arbitary
*
* Convenience wrapper around g_signal_connect_swapped for GtkBuilder.
@@ -301,7 +392,7 @@ go_gtk_builder_signal_connect_swapped (GtkBuilder *gui,
* Simple wrapper to #gtk_builder_get_object which returns the object
* as a GtkWidget.
*
- * Returns: a new #GtkWidget or NULL
+ * Returns: (transfer none): a new #GtkWidget or NULL
**/
GtkWidget *
go_gtk_builder_get_widget (GtkBuilder *gui, char const *widget_name)
@@ -317,7 +408,7 @@ go_gtk_builder_get_widget (GtkBuilder *gui, char const *widget_name)
* searches the #GtkComboBox in @gui and ensures it has a model and a
* renderer appropriate for using with #gtk_combo_box_append_text and friends.
*
- * Returns: the #GtkComboBox or NULL
+ * Returns: (transfer none): the #GtkComboBox or NULL
**/
GtkComboBox *
go_gtk_builder_combo_box_init_text (GtkBuilder *gui, char const *widget_name)
@@ -672,22 +763,22 @@ update_preview_cb (GtkFileChooser *chooser)
gtk_widget_hide (image);
gtk_widget_hide (label);
} else {
- GdkPixbuf *buf;
+ GOImage *buf;
gboolean dummy;
- buf = gdk_pixbuf_new_from_file (filename, NULL);
+ buf = go_image_new_from_file (filename, NULL);
if (buf) {
dummy = FALSE;
} else {
GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (chooser));
- buf = gtk_icon_theme_load_icon
- (gtk_icon_theme_get_for_screen (screen),
- "unknown_image", 100, 100, NULL);
+ buf = go_pixbuf_new_from_pixbuf (gtk_icon_theme_load_icon
+ (gtk_icon_theme_get_for_screen (screen),
+ "unknown_image", 100, 100, NULL));
dummy = buf != NULL;
}
if (buf) {
- GdkPixbuf *pixbuf = go_gdk_pixbuf_intelligent_scale (buf, PREVIEW_HSIZE, PREVIEW_VSIZE);
+ GdkPixbuf *pixbuf = go_image_get_scaled_pixbuf (buf, PREVIEW_HSIZE, PREVIEW_VSIZE);
gtk_image_set_from_pixbuf (GTK_IMAGE (image), pixbuf);
g_object_unref (pixbuf);
gtk_widget_show (image);
@@ -695,8 +786,8 @@ update_preview_cb (GtkFileChooser *chooser)
if (dummy)
gtk_label_set_text (GTK_LABEL (label), "");
else {
- int w = gdk_pixbuf_get_width (buf);
- int h = gdk_pixbuf_get_height (buf);
+ int w = go_image_get_width (buf);
+ int h = go_image_get_height (buf);
char *size = g_strdup_printf (_("%d x %d"), w, h);
gtk_label_set_text (GTK_LABEL (label), size);
g_free (size);
@@ -830,7 +921,7 @@ cb_format_combo_changed (GtkComboBox *combo, GtkWidget *expander)
/**
* go_gui_get_image_save_info:
* @toplevel: a #GtkWindow
- * @supported_formats: a #GSList of supported file formats
+ * @supported_formats: (element-type void): a #GSList of supported file formats
* @ret_format: default file format
* @resolution: export resolution
*
@@ -870,7 +961,7 @@ go_gui_get_image_save_info (GtkWindow *toplevel, GSList *supported_formats,
g_object_set (G_OBJECT (fsel), "title", _("Save as"), NULL);
- gui = go_gtk_builder_new_internal ("res:go:gtk/go-image-save-dialog-extra.ui",
+ gui = go_gtk_builder_load_internal ("res:go:gtk/go-image-save-dialog-extra.ui",
GETTEXT_PACKAGE, NULL);
if (gui != NULL) {
GtkWidget *widget;
diff --git a/goffice/gtk/goffice-gtk.h b/goffice/gtk/goffice-gtk.h
index 4fecfae..1c774a6 100644
--- a/goffice/gtk/goffice-gtk.h
+++ b/goffice/gtk/goffice-gtk.h
@@ -55,10 +55,18 @@ G_BEGIN_DECLS
void go_gtk_editable_enters (GtkWindow *window, GtkWidget *w);
+GtkBuilder *go_gtk_builder_load_internal (char const *uifile,
+ char const *domain, GOCmdContext *gcc);
+GtkBuilder *go_gtk_builder_load (char const *uifile,
+ char const *domain, GOCmdContext *gcc);
+#ifndef GOFFICE_DISABLE_DEPRECATED
+GOFFICE_DEPRECATED_FOR(go_gtk_builder_load_internal)
GtkBuilder *go_gtk_builder_new_internal (char const *uifile,
char const *domain, GOCmdContext *gcc);
+GOFFICE_DEPRECATED_FOR(go_gtk_builder_load)
GtkBuilder *go_gtk_builder_new (char const *uifile,
char const *domain, GOCmdContext *gcc);
+#endif
gulong go_gtk_builder_signal_connect (GtkBuilder *gui,
gchar const *instance_name,
gchar const *detailed_signal,
@@ -95,8 +103,13 @@ void go_gtk_notice_nonmodal_dialog (GtkWindow *parent, GtkWidget **ref,
gboolean go_gtk_query_yes_no (GtkWindow *toplevel, gboolean default_answer,
const gchar *format, ...) G_GNUC_PRINTF (3, 4);
+GtkWidget *go_gtk_button_build_with_stock (char const *text,
+ char const *stock_id);
+#ifndef GOFFICE_DISABLE_DEPRECATED
+GOFFICE_DEPRECATED_FOR(go_gtk_button_build_with_stock)
GtkWidget *go_gtk_button_new_with_stock (char const *text,
char const *stock_id);
+#endif
void go_gtk_widget_disable_focus (GtkWidget *w);
void go_gtk_window_set_transient (GtkWindow *toplevel, GtkWindow *window);
void go_gtk_help_button_init (GtkWidget *w, char const *data_dir,
diff --git a/goffice/math/go-accumulator.c b/goffice/math/go-accumulator.c
index 4e56942..61d6f64 100644
--- a/goffice/math/go-accumulator.c
+++ b/goffice/math/go-accumulator.c
@@ -67,6 +67,12 @@ SUFFIX(go_accumulator_functional) (void)
return SUFFIX(go_quad_functional) ();
}
+/**
+ * go_accumulator_start: (skip)
+ **/
+/**
+ * go_accumulator_startl: (skip)
+ **/
void *
SUFFIX(go_accumulator_start) (void)
{
@@ -79,6 +85,12 @@ SUFFIX(go_accumulator_end) (void *state)
SUFFIX(go_quad_end) (state);
}
+/**
+ * go_accumulator_new: (skip)
+ **/
+/**
+ * go_accumulator_newl: (skip)
+ **/
ACC *
SUFFIX(go_accumulator_new) (void)
{
@@ -87,6 +99,12 @@ SUFFIX(go_accumulator_new) (void)
return res;
}
+/**
+ * go_accumulator_free: (skip)
+ **/
+/**
+ * go_accumulator_freel: (skip)
+ **/
void
SUFFIX(go_accumulator_free) (ACC *acc)
{
@@ -96,6 +114,12 @@ SUFFIX(go_accumulator_free) (ACC *acc)
g_free (acc);
}
+/**
+ * go_accumulator_clear: (skip)
+ **/
+/**
+ * go_accumulator_clearl: (skip)
+ **/
void
SUFFIX(go_accumulator_clear) (ACC *acc)
{
@@ -103,6 +127,12 @@ SUFFIX(go_accumulator_clear) (ACC *acc)
g_array_set_size (acc->partials, 0);
}
+/**
+ * go_accumulator_add: (skip)
+ **/
+/**
+ * go_accumulator_addl: (skip)
+ **/
void
SUFFIX(go_accumulator_add) (ACC *acc, DOUBLE x)
{
@@ -130,6 +160,12 @@ SUFFIX(go_accumulator_add) (ACC *acc, DOUBLE x)
g_array_index (acc->partials, DOUBLE, ui) = x;
}
+/**
+ * go_accumulator_add_quad: (skip)
+ **/
+/**
+ * go_accumulator_add_quadl: (skip)
+ **/
void
SUFFIX(go_accumulator_add_quad) (ACC *acc, const SUFFIX(GOQuad) *x)
{
@@ -140,6 +176,12 @@ SUFFIX(go_accumulator_add_quad) (ACC *acc, const SUFFIX(GOQuad) *x)
SUFFIX(go_accumulator_add) (acc, x->l);
}
+/**
+ * go_accumulator_value: (skip)
+ **/
+/**
+ * go_accumulator_valuel: (skip)
+ **/
DOUBLE
SUFFIX(go_accumulator_value) (ACC *acc)
{
diff --git a/goffice/math/go-cspline.c b/goffice/math/go-cspline.c
index 7d2287d..e74d222 100644
--- a/goffice/math/go-cspline.c
+++ b/goffice/math/go-cspline.c
@@ -41,6 +41,7 @@
#endif
#define DOUBLE long double
#define SUFFIX(_n) _n ## l
+#define LONG_DOUBLE
#endif
#endif
@@ -89,6 +90,7 @@ SUFFIX(go_cspline_init) (DOUBLE const *x, DOUBLE const *y, int n,
sp->a = g_new0 (DOUBLE, nm1);
sp->b = g_new (DOUBLE, nm1);
sp->c = g_new (DOUBLE, nm1);
+ sp->ref_count = 1;
d1 = g_new0 (DOUBLE, n);
d2 = g_new0 (DOUBLE, n);
d3 = g_new0 (DOUBLE, n);
@@ -201,12 +203,44 @@ SUFFIX(go_cspline_init) (DOUBLE const *x, DOUBLE const *y, int n,
void SUFFIX(go_cspline_destroy) (SUFFIX(GOCSpline) *sp)
{
g_return_if_fail (sp);
+ if (sp->ref_count-- > 1)
+ return;
g_free (sp->a);
g_free (sp->b);
g_free (sp->c);
g_free (sp);
}
+static GOCSpline *
+SUFFIX(go_cspline_ref) (GOCSpline *sp)
+{
+ g_return_val_if_fail (sp, NULL);
+ sp->ref_count++;
+ return sp;
+}
+
+GType
+#ifdef LONG_DOUBLE
+go_cspline_get_type (void)
+#else
+go_csplinel_get_type (void)
+#endif
+{
+ static GType t = 0;
+
+ if (t == 0) {
+ t = g_boxed_type_register_static (
+#ifdef LONG_DOUBLE
+ "GOCSpline",
+#else
+ "GOCSplinel",
+#endif
+ (GBoxedCopyFunc)SUFFIX(go_cspline_ref),
+ (GBoxedFreeFunc)SUFFIX(go_cspline_destroy));
+ }
+ return t;
+}
+
/**
* go_cspline_get_value:
* @sp: a spline structure returned by go_cspline_init.
diff --git a/goffice/math/go-cspline.h b/goffice/math/go-cspline.h
index 70b109c..582ff58 100644
--- a/goffice/math/go-cspline.h
+++ b/goffice/math/go-cspline.h
@@ -22,6 +22,8 @@
#ifndef GO_CSPLINE_H
#define GO_CSPLINE_H
+#include <glib-object.h>
+
G_BEGIN_DECLS
typedef struct _GOCSpline GOCSpline;
@@ -29,6 +31,7 @@ struct _GOCSpline {
double const *x, *y;
double *a, *b, *c;
int n;
+ unsigned ref_count;
};
typedef enum {
@@ -39,6 +42,7 @@ typedef enum {
GO_CSPLINE_MAX
} GOCSplineType;
+GType go_cspline_get_type (void);
GOCSpline *go_cspline_init (double const *x, double const *y, int n,
unsigned limits, double c0, double cn);
void go_cspline_destroy (GOCSpline *sp);
@@ -54,8 +58,10 @@ struct _GOCSplinel {
long double const *x, *y;
long double *a, *b, *c;
int n;
+ unsigned ref_count;
};
+GType go_csplinel_get_type (void);
GOCSplinel *go_cspline_initl (long double const *x, long double const *y, int n,
unsigned limits, long double a0, long double a1);
void go_cspline_destroyl (GOCSplinel *sp);
diff --git a/goffice/math/go-fft.c b/goffice/math/go-fft.c
index 6e862a9..1519707 100644
--- a/goffice/math/go-fft.c
+++ b/goffice/math/go-fft.c
@@ -16,7 +16,7 @@
*/
#include <goffice-config.h>
-#include <go-fft.h>
+#include <goffice/math/go-fft.h>
#ifndef DOUBLE
diff --git a/goffice/math/go-quad.c b/goffice/math/go-quad.c
index b0d6ab5..6d11912 100644
--- a/goffice/math/go-quad.c
+++ b/goffice/math/go-quad.c
@@ -102,6 +102,18 @@ static guint SUFFIX(go_quad_depth) = 0;
static DOUBLE SUFFIX(CST);
+/**
+ * go_quad_start: (skip)
+ *
+ * Initializes #GOQuad arythmetics. Any use of #GOQuad must occur between calls
+ * to go_quad_start() and go_quad_end().
+ **/
+/**
+ * go_quad_startl: (skip)
+ *
+ * Initializes #GOQuadl arythmetics. Any use of #GOQuadl must occur between calls
+ * to go_quad_startl() and go_quad_endl().
+ **/
void *
SUFFIX(go_quad_start) (void)
{
@@ -135,6 +147,12 @@ SUFFIX(go_quad_start) (void)
return res;
}
+/**
+ * go_quad_end: (skip)
+ **/
+/**
+ * go_quad_endl: (skip)
+ **/
void
SUFFIX(go_quad_end) (void *state)
{
@@ -151,6 +169,12 @@ SUFFIX(go_quad_end) (void *state)
g_free (state);
}
+/**
+ * go_quad_init: (skip)
+ **/
+/**
+ * go_quad_initl: (skip)
+ **/
void
SUFFIX(go_quad_init) (QUAD *res, DOUBLE h)
{
@@ -158,12 +182,24 @@ SUFFIX(go_quad_init) (QUAD *res, DOUBLE h)
res->l = 0;
}
+/**
+ * go_quad_value: (skip)
+ **/
+/**
+ * go_quad_valuel: (skip)
+ **/
DOUBLE
SUFFIX(go_quad_value) (const QUAD *a)
{
return a->h + a->l;
}
+/**
+ * go_quad_add: (skip)
+ **/
+/**
+ * go_quad_addl: (skip)
+ **/
void
SUFFIX(go_quad_add) (QUAD *res, const QUAD *a, const QUAD *b)
{
@@ -177,6 +213,12 @@ SUFFIX(go_quad_add) (QUAD *res, const QUAD *a, const QUAD *b)
g_return_if_fail (SUFFIX(go_quad_depth) > 0);
}
+/**
+ * go_quad_sub: (skip)
+ **/
+/**
+ * go_quad_subl: (skip)
+ **/
void
SUFFIX(go_quad_sub) (QUAD *res, const QUAD *a, const QUAD *b)
{
@@ -188,6 +230,12 @@ SUFFIX(go_quad_sub) (QUAD *res, const QUAD *a, const QUAD *b)
res->l = r - res->h + s;
}
+/**
+ * go_quad_mul12: (skip)
+ **/
+/**
+ * go_quad_mul12l: (skip)
+ **/
void
SUFFIX(go_quad_mul12) (QUAD *res, DOUBLE x, DOUBLE y)
{
@@ -205,6 +253,12 @@ SUFFIX(go_quad_mul12) (QUAD *res, DOUBLE x, DOUBLE y)
res->l = p - res->h + q + tx * ty;
}
+/**
+ * go_quad_mul: (skip)
+ **/
+/**
+ * go_quad_mull: (skip)
+ **/
void
SUFFIX(go_quad_mul) (QUAD *res, const QUAD *a, const QUAD *b)
{
@@ -215,6 +269,12 @@ SUFFIX(go_quad_mul) (QUAD *res, const QUAD *a, const QUAD *b)
res->l = c.h - res->h + c.l;
}
+/**
+ * go_quad_div: (skip)
+ **/
+/**
+ * go_quad_divl: (skip)
+ **/
void
SUFFIX(go_quad_div) (QUAD *res, const QUAD *a, const QUAD *b)
{
@@ -226,6 +286,12 @@ SUFFIX(go_quad_div) (QUAD *res, const QUAD *a, const QUAD *b)
res->l = c.h - res->h + c.l;
}
+/**
+ * go_quad_sqrt: (skip)
+ **/
+/**
+ * go_quad_sqrtl: (skip)
+ **/
void
SUFFIX(go_quad_sqrt) (QUAD *res, const QUAD *a)
{
@@ -240,6 +306,12 @@ SUFFIX(go_quad_sqrt) (QUAD *res, const QUAD *a)
res->h = res->l = 0;
}
+/**
+ * go_quad_dot_product: (skip)
+ **/
+/**
+ * go_quad_dot_productl: (skip)
+ **/
void
SUFFIX(go_quad_dot_product) (QUAD *res, const QUAD *a, const QUAD *b, int n)
{
diff --git a/goffice/math/go-regression.c b/goffice/math/go-regression.c
index 4f1f998..7c42a20 100644
--- a/goffice/math/go-regression.c
+++ b/goffice/math/go-regression.c
@@ -79,6 +79,37 @@ general_linear_regressionl (long double *const *const xss, int xdim,
#endif
+/* Boxed types code */
+
+static SUFFIX(go_regression_stat_t) *
+SUFFIX(go_regression_stat_ref) (SUFFIX(go_regression_stat_t)* state)
+{
+ state->ref_count++;
+ return state;
+}
+
+GType
+#ifdef DEFINE_COMMON
+go_regression_stat_get_type (void)
+#else
+go_regression_statl_get_type (void)
+#endif
+{
+ static GType t = 0;
+
+ if (t == 0) {
+ t = g_boxed_type_register_static (
+#ifdef DEFINE_COMMON
+ "go_regression_stat_t",
+#else
+ "go_regression_stat_tl",
+#endif
+ (GBoxedCopyFunc)SUFFIX(go_regression_stat_ref),
+ (GBoxedFreeFunc)SUFFIX(go_regression_stat_destroy));
+ }
+ return t;
+}
+
/* ------------------------------------------------------------------------- */
#ifdef DEFINE_COMMON
@@ -1476,6 +1507,7 @@ SUFFIX(go_regression_stat_new) (void)
stat_->se = NULL;
stat_->t = NULL;
stat_->xbar = NULL;
+ stat_->ref_count = 1;
return stat_;
}
@@ -1485,7 +1517,7 @@ SUFFIX(go_regression_stat_new) (void)
void
SUFFIX(go_regression_stat_destroy) (SUFFIX(go_regression_stat_t) *stat_)
{
- if (stat_) {
+ if (stat_ && stat_->ref_count-- > 1) {
g_free(stat_->se);
g_free(stat_->t);
g_free(stat_->xbar);
@@ -1763,31 +1795,50 @@ SUFFIX(parameter_errors) (SUFFIX(GORegressionFunction) f,
return result;
}
-
-/*
+/**
+ * go_non_linear_regression:
+ * @f: (scope call): the model function
+ * @xvals: independent values.
+ * @par: model parameters.
+ * @yvals: dependent values.
+ * @sigmas: stahdard deviations for the dependent values.
+ * @x_dim: Number of data points.
+ * @p_dim: Number of parameters.
+ * @chi: Chi Squared of the final result. This value is not very
+ * meaningful without the sigmas.
+ * @errors: MUST ALREADY BE ALLOCATED. These are the approximated standard
+ * deviation for each parameter.
+ *
* SYNOPSIS:
* result = non_linear_regression (f, xvals, par, yvals, sigmas,
* x_dim, p_dim, &chi, errors)
- *
- * Returns the results of the non-linear regression from the given initial
+ * Non linear regression.
+ * Returns: the results of the non-linear regression from the given initial
* values.
- * The resulting parameters are placed back into 'par'.
- *
- * PARAMETERS:
- *
- * sigmas -> Measurement errors in the dataset (along the y-axis).
- * NULL means "no errors available", so they are all set to 1.
- *
- * x_dim -> Number of data points.
- *
- * p_dim -> Number of parameters.
- *
- * errors -> MUST ALREADY BE ALLOCATED. These are the approximated standard
- * deviation for each parameter.
+ * The resulting parameters are placed back into @par.
+ **/
+/**
+ * go_non_linear_regressionl:
+ * @f: (scope call): the model function
+ * @xvals: independent values.
+ * @par: model parameters.
+ * @yvals: dependent values.
+ * @sigmas: stahdard deviations for the dependent values.
+ * @x_dim: Number of data points.
+ * @p_dim: Number of parameters.
+ * @chi: Chi Squared of the final result. This value is not very
+ * meaningful without the sigmas.
+ * @errors: MUST ALREADY BE ALLOCATED. These are the approximated standard
+ * deviation for each parameter.
*
- * chi -> Chi Squared of the final result. This value is not very
- * meaningful without the sigmas.
- */
+ * SYNOPSIS:
+ * result = non_linear_regression (f, xvals, par, yvals, sigmas,
+ * x_dim, p_dim, &chi, errors)
+ * Non linear regression.
+ * Returns: the results of the non-linear regression from the given initial
+ * values.
+ * The resulting parameters are placed back into @par.
+ **/
GORegressionResult
SUFFIX(go_non_linear_regression) (SUFFIX(GORegressionFunction) f,
MATRIX xvals, /* The entire data set. */
diff --git a/goffice/math/go-regression.h b/goffice/math/go-regression.h
index ea80650..0e0b286 100644
--- a/goffice/math/go-regression.h
+++ b/goffice/math/go-regression.h
@@ -2,6 +2,7 @@
#define GO_UTILS_REGRESSION_H
#include <glib.h>
+#include <glib-object.h>
G_BEGIN_DECLS
@@ -33,8 +34,11 @@ typedef struct {
double ybar;
double *xbar;
double var; /* The variance of the entire regression: sum(errors^2)/(n-xdim) */
+ unsigned ref_count;
} go_regression_stat_t;
+#define GORegressionStat go_regression_stat_t
+GType go_regression_stat_get_type (void);
go_regression_stat_t *go_regression_stat_new (void);
void go_regression_stat_destroy (go_regression_stat_t *stat_);
@@ -124,8 +128,11 @@ typedef struct {
long double *xbar;
long double var; /* The variance of the entire regression:
sum(errors^2)/(n-xdim) */
+ unsigned ref_count;
} go_regression_stat_tl;
+#define GORegressionStatl go_regression_stat_tl
+GType go_regression_statl_get_type (void);
go_regression_stat_tl *go_regression_stat_newl (void);
void go_regression_stat_destroyl (go_regression_stat_tl *stat_);
diff --git a/goffice/utils/datetime.c b/goffice/utils/datetime.c
index 14a9af5..93d2138 100644
--- a/goffice/utils/datetime.c
+++ b/goffice/utils/datetime.c
@@ -34,6 +34,27 @@
#define HALF_SEC (0.5 / SECS_PER_DAY)
/* ------------------------------------------------------------------------- */
+static GODateConventions *
+go_date_conventions_copy (GODateConventions const *dc)
+{
+ GODateConventions *res = g_new (GODateConventions, 1);
+ memcpy (res, dc, sizeof(GODateConventions));
+ return res;
+}
+
+GType
+go_date_conventions_get_type (void)
+{
+ static GType t = 0;
+
+ if (t == 0)
+ t = g_boxed_type_register_static ("GODateConventions",
+ (GBoxedCopyFunc)go_date_conventions_copy,
+ (GBoxedFreeFunc)g_free);
+ return t;
+}
+
+/* ------------------------------------------------------------------------- */
/* One less that the Julian day number of 19000101. */
static int date_origin_1900 = 0;
diff --git a/goffice/utils/datetime.h b/goffice/utils/datetime.h
index 64f899f..e323579 100644
--- a/goffice/utils/datetime.h
+++ b/goffice/utils/datetime.h
@@ -11,6 +11,8 @@ struct _GODateConventions {
* Rather than the Win32 style 1900 */
};
+GType go_date_conventions_get_type (void);
+
/*
* Naming conventions:
*
diff --git a/goffice/utils/go-bezier.c b/goffice/utils/go-bezier.c
index aac6c33..5c2f709 100644
--- a/goffice/utils/go-bezier.c
+++ b/goffice/utils/go-bezier.c
@@ -74,7 +74,7 @@ go_bezier_spline_init (double const *x, double const *y, int n, gboolean closed)
sp->x = g_new (double, i);
sp->y = g_new (double, i);
sp->n = n;
- sp->closed = closed;
+ sp->closed = closed;sp->ref_count = 1;
/* Initialize vectors for intermediate data */
a = g_new (double, n);
@@ -306,11 +306,34 @@ void
go_bezier_spline_destroy (GOBezierSpline *sp)
{
g_return_if_fail (sp);
+ if (sp->ref_count-- > 1)
+ return;
g_free (sp->x);
g_free (sp->y);
g_free (sp);
}
+static GOBezierSpline *
+go_bezier_spline_ref (GOBezierSpline *sp)
+{
+ g_return_val_if_fail (sp, NULL);
+ sp->ref_count++;
+ return sp;
+}
+
+GType
+go_bezier_spline_get_type (void)
+{
+ static GType t = 0;
+
+ if (t == 0) {
+ t = g_boxed_type_register_static ("GOBezierSpline",
+ (GBoxedCopyFunc)go_bezier_spline_ref,
+ (GBoxedFreeFunc)go_bezier_spline_destroy);
+ }
+ return t;
+}
+
/**
* go_bezier_spline_to_path:
* @sp: a struct GOBezierSpline instance returned by go_bezier_spline_init
diff --git a/goffice/utils/go-bezier.h b/goffice/utils/go-bezier.h
index 11a8f3a..dc9aca7 100644
--- a/goffice/utils/go-bezier.h
+++ b/goffice/utils/go-bezier.h
@@ -30,8 +30,10 @@ typedef struct {
double *x, *y;
int n;
gboolean closed;
+ unsigned ref_count;
} GOBezierSpline;
+GType go_bezier_spline_get_type (void);
GOBezierSpline *go_bezier_spline_init (double const *x, double const *y, int n,
gboolean closed);
void go_bezier_spline_destroy (GOBezierSpline *sp);
diff --git a/goffice/utils/go-color.c b/goffice/utils/go-color.c
index 14a52fc..d37ef50 100644
--- a/goffice/utils/go-color.c
+++ b/goffice/utils/go-color.c
@@ -63,6 +63,13 @@ go_color_as_str (GOColor color)
return g_strdup_printf ("%X:%X:%X:%X", r, g, b, a);
}
+/**
+ * go_color_to_pango: (skip)
+ * @color: #GOColor
+ * @is_fore: whether to create a foreground or background color attribute.
+ *
+ * Returns: (transfer full): the newly created #PangoAttribute.
+ **/
PangoAttribute *
go_color_to_pango (GOColor color, gboolean is_fore)
{
diff --git a/goffice/utils/go-editor.c b/goffice/utils/go-editor.c
index 27da7ec..4301f29 100644
--- a/goffice/utils/go-editor.c
+++ b/goffice/utils/go-editor.c
@@ -22,13 +22,13 @@
/*****************************************************************************/
#include <goffice/goffice-config.h>
-#include <go-editor.h>
+#include <goffice/utils/go-editor.h>
#include <string.h>
/**
* go_editor_new:
*
- * Returns: a new GOEditor object, which is used to store a collection of
+ * Returns: (transfer full): a new GOEditor object, which is used to store a collection of
* property edition widgets (pages). The returned object must be freed
* using @go_editor_free.
**/
@@ -40,6 +40,7 @@ go_editor_new (void)
editor->store_page = NULL;
editor->pages = NULL;
g_datalist_init (&editor->registered_widgets);
+ editor->ref_count = 1;
return editor;
}
@@ -62,6 +63,8 @@ page_free (GOEditorPage *page)
void
go_editor_free (GOEditor *editor)
{
+ if (editor == NULL || editor->ref_count-- >1)
+ return;
g_slist_foreach (editor->pages, (GFunc) page_free, NULL);
g_slist_free (editor->pages);
g_datalist_clear (&editor->registered_widgets);
@@ -69,6 +72,25 @@ go_editor_free (GOEditor *editor)
g_free (editor);
}
+static GOEditor *
+go_editor_ref (GOEditor *editor)
+{
+ editor->ref_count++;
+ return editor;
+}
+
+GType
+go_editor_get_type (void)
+{
+ static GType t = 0;
+
+ if (t == 0)
+ t = g_boxed_type_register_static ("GOEditor",
+ (GBoxedCopyFunc)go_editor_ref,
+ (GBoxedFreeFunc)go_editor_free);
+ return t;
+}
+
/**
* go_editor_add_page:
* @editor: a #GOEditor
@@ -133,7 +155,7 @@ go_editor_register_widget (GOEditor *editor, GtkWidget *widget)
* @editor: a #GOEditor
* @name: the name of the registered widget
*
- * Returns: a widget previously registered using @go_editor_register_widget.
+ * Returns: (transfer none): a widget previously registered using @go_editor_register_widget.
**/
GtkWidget *
go_editor_get_registered_widget (GOEditor *editor, char const *name)
@@ -154,7 +176,7 @@ cb_switch_page (G_GNUC_UNUSED GtkNotebook *n, G_GNUC_UNUSED GtkWidget *p,
* go_editor_get_notebook:
* @editor: a #GOEditor
*
- * Returns: a GtkNotebook from the widget collection stored in @editor.
+ * Returns: (transfer full): a GtkNotebook from the widget collection stored in @editor.
**/
GtkWidget *
go_editor_get_notebook (GOEditor *editor)
@@ -194,6 +216,13 @@ go_editor_get_notebook (GOEditor *editor)
return notebook;
}
+/**
+ * go_editor_get_page:
+ * @editor: #GOEditor
+ * @name: page name
+ *
+ * Returns: (transfer none): the page with @name as name if any
+ **/
GtkWidget *
go_editor_get_page (GOEditor *editor, char const *name)
{
diff --git a/goffice/utils/go-editor.h b/goffice/utils/go-editor.h
index f7830c1..1b15f28 100644
--- a/goffice/utils/go-editor.h
+++ b/goffice/utils/go-editor.h
@@ -35,7 +35,9 @@ struct _GOEditor {
unsigned *store_page; /* pointer to a place for storing last edited page */
GSList *pages; /* GOEditorPage */
GData *registered_widgets;
+ unsigned ref_count;
};
+GType go_editor_get_type (void);
GOEditor *go_editor_new (void);
void go_editor_free (GOEditor *editor);
diff --git a/goffice/utils/go-emf.c b/goffice/utils/go-emf.c
index 2a119a1..2ae0f5e 100644
--- a/goffice/utils/go-emf.c
+++ b/goffice/utils/go-emf.c
@@ -196,6 +196,13 @@ GSF_CLASS (GOEmf, go_emf,
go_emf_class_init, go_emf_init,
GO_TYPE_IMAGE)
+/**
+ * go_emf_get_canvas:
+ * @emf: #GOEmf
+ *
+ * Returns: (transfer full): the canvas displaying the EMF image, adding a
+ * reference to it.
+ **/
GObject *go_emf_get_canvas (GOEmf *emf)
{
g_return_val_if_fail (GO_IS_EMF (emf), NULL);
diff --git a/goffice/utils/go-file.c b/goffice/utils/go-file.c
index e1a19b1..ff610b7 100644
--- a/goffice/utils/go-file.c
+++ b/goffice/utils/go-file.c
@@ -540,7 +540,7 @@ open_plain_file (char const *path, GError **err)
* @err: #GError
*
* Try all available methods to open a file or return an error
- * Returns: non-%NULL on success
+ * Returns: (transfer full): non-%NULL on success
**/
GsfInput *
go_file_open (char const *uri, GError **err)
@@ -578,6 +578,15 @@ go_file_open (char const *uri, GError **err)
return gsf_input_gio_new_for_uri (uri, err);
}
+/**
+ * go_file_create:
+ * @uri: target uri
+ * @err: #GError
+ *
+ * Creates a file or return an error. If the file already exists, it is
+ * replaced.
+ * Returns: (transfer full): non-%NULL on success
+ **/
GsfOutput *
go_file_create (char const *uri, GError **err)
{
@@ -610,6 +619,13 @@ go_file_create (char const *uri, GError **err)
/* ------------------------------------------------------------------------- */
/* Adapted from gtkfilechooserdefault.c. Unfortunately it is static there. */
+/**
+ * go_file_split_urls:
+ * @data: a string filled with a list of URIs separated by new lines.
+ *
+ * Splits the chain into a list of URIs. Lines starting with '#' are ignored.
+ * Returns: (element-type char) (transfer full): the URIs list.
+ **/
GSList *
go_file_split_urls (char const *data)
{
@@ -709,6 +725,27 @@ go_file_get_group_name (char const *uri)
return (nameutf8 ? g_string_free (nameutf8, FALSE) : NULL);
}
+static GOFilePermissions *
+go_file_permissions_copy (GOFilePermissions *file_permissions)
+{
+ GOFilePermissions *res = g_new (GOFilePermissions, 1);
+ memcpy (res, file_permissions, sizeof(GOFilePermissions));
+ return res;
+}
+
+GType
+go_file_permissions_get_type (void)
+{
+ static GType t = 0;
+
+ if (t == 0) {
+ t = g_boxed_type_register_static ("GOFilePermissions",
+ (GBoxedCopyFunc)go_file_permissions_copy,
+ (GBoxedFreeFunc)g_free);
+ }
+ return t;
+}
+
GOFilePermissions *
go_get_file_permissions (char const *uri)
{
@@ -1106,6 +1143,14 @@ go_mime_type_get_description (gchar const *mime_type)
static gchar **saved_args;
#endif
+/**
+ * go_shell_argv_to_glib_encoding:
+ * @argc: arguments number
+ * @argv: command line arguments
+ *
+ * Transform arguments to UTF-8 when needed.
+ * Returns: (transfer none): the arguments in UTF-8 locale.
+ **/
gchar const **
go_shell_argv_to_glib_encoding (gint argc, gchar const **argv)
{
diff --git a/goffice/utils/go-file.h b/goffice/utils/go-file.h
index 803e434..d2f081e 100644
--- a/goffice/utils/go-file.h
+++ b/goffice/utils/go-file.h
@@ -78,6 +78,7 @@ GSList *go_file_split_urls (char const *data);
gchar *go_file_get_owner_name (char const *uri);
gchar *go_file_get_group_name (char const *uri);
+GType go_file_permissions_get_type (void);
GOFilePermissions *go_get_file_permissions (char const *uri);
void go_set_file_permissions (char const *uri, GOFilePermissions * file_permissions);
diff --git a/goffice/utils/go-font.c b/goffice/utils/go-font.c
index c31ac0c..c49f76c 100644
--- a/goffice/utils/go-font.c
+++ b/goffice/utils/go-font.c
@@ -21,6 +21,7 @@
#include "go-font.h"
#include "go-glib-extras.h"
#include <pango/pango-layout.h>
+#include <string.h>
static GHashTable *font_hash;
static GPtrArray *font_array;
@@ -176,10 +177,13 @@ go_font_cache_unregister (GClosure *watcher)
font_watchers = g_slist_remove (font_watchers, watcher);
}
-/*
- * Returns a sorted list of strings of font family names. The list and
- * the names must be freed.
- */
+/**
+ * go_fonts_list_families:
+ * @context: #PangoContext
+ *
+ * Returns: (element-type char) (transfer full): a sorted list of strings of
+ * font family names. The list and the names must be freed.
+ **/
GSList *
go_fonts_list_families (PangoContext *context)
{
@@ -199,6 +203,12 @@ go_fonts_list_families (PangoContext *context)
return res;
}
+/**
+ * go_fonts_list_sizes:
+ *
+ * Returns: (element-type void) (transfer container): a sorted list of font
+ * sizes in Pango units. The list must be freed.
+ **/
GSList *
go_fonts_list_sizes (void)
{
@@ -312,6 +322,27 @@ go_font_metrics_free (GOFontMetrics *metrics)
g_free (metrics);
}
+static GOFontMetrics *
+go_font_metrics_copy (GOFontMetrics *file_permissions)
+{
+ GOFontMetrics *res = g_new (GOFontMetrics, 1);
+ memcpy (res, file_permissions, sizeof(GOFontMetrics));
+ return res;
+}
+
+GType
+go_font_metrics_get_type (void)
+{
+ static GType t = 0;
+
+ if (t == 0) {
+ t = g_boxed_type_register_static ("GOFontMetrics",
+ (GBoxedCopyFunc)go_font_metrics_copy,
+ (GBoxedFreeFunc)go_font_metrics_free);
+ }
+ return t;
+}
+
static GOFontMetrics go_font_metrics_unit_var;
/* All widths == 1. */
diff --git a/goffice/utils/go-font.h b/goffice/utils/go-font.h
index 0679e0d..466bd46 100644
--- a/goffice/utils/go-font.h
+++ b/goffice/utils/go-font.h
@@ -67,6 +67,7 @@ gboolean go_font_eq (GOFont const *a, GOFont const *b);
GSList *go_fonts_list_families (PangoContext *context);
GSList *go_fonts_list_sizes (void);
+GType go_font_metrics_get_type (void);
GOFontMetrics *go_font_metrics_new (PangoContext *context, GOFont const *font);
GO_VAR_DECL const GOFontMetrics *go_font_metrics_unit;
void go_font_metrics_free (GOFontMetrics *metrics);
diff --git a/goffice/utils/go-format.c b/goffice/utils/go-format.c
index b85325c..7cb617e 100644
--- a/goffice/utils/go-format.c
+++ b/goffice/utils/go-format.c
@@ -590,6 +590,13 @@ static long double beyond_precisionl;
/* WARNING : Global */
static GHashTable *style_format_hash = NULL;
+/**
+ * go_format_foreach:
+ * @func: (scope call): function to execute for each known format
+ * @user_data: user data for @func
+ *
+ * Executes @func for each registered #GOFormat
+ **/
void
go_format_foreach (GHFunc func, gpointer user_data)
{
@@ -4563,11 +4570,11 @@ go_format_measure_strlen (const GString *str,
} \
} while (0)
-/*
- * go_format_general:
+/**
+ * go_render_general:
* @layout: Optional PangoLayout, probably preseeded with font attribute.
* @str: a GString to store (not append!) the resulting string in.
- * @measure: Function to measure width of string/layout.
+ * @measure: (scope call): Function to measure width of string/layout.
* @metrics: Font metrics corresponding to @mesaure.
* @val: floating-point value. Must be finite.
* @col_width: intended max width of layout in pango units. -1 means
@@ -4577,7 +4584,22 @@ go_format_measure_strlen (const GString *str,
* Render a floating-point value into @layout in such a way that the
* layouting width does not needlessly exceed @col_width. Optionally
* use unicode minus instead of hyphen.
- */
+ **/
+/**
+ * go_render_generall:
+ * @layout: Optional PangoLayout, probably preseeded with font attribute.
+ * @str: a GString to store (not append!) the resulting string in.
+ * @measure: (scope call): Function to measure width of string/layout.
+ * @metrics: Font metrics corresponding to @mesaure.
+ * @val: floating-point value. Must be finite.
+ * @col_width: intended max width of layout in pango units. -1 means
+ * no restriction.
+ * @unicode_minus: Use unicode minuses, not hyphens.
+ *
+ * Render a floating-point value into @layout in such a way that the
+ * layouting width does not needlessly exceed @col_width. Optionally
+ * use unicode minus instead of hyphen.
+ **/
void
SUFFIX(go_render_general) (PangoLayout *layout, GString *str,
GOFormatMeasure measure,
@@ -4785,6 +4807,48 @@ SUFFIX(go_render_general) (PangoLayout *layout, GString *str,
#define FREE_NEW_STR do { if (new_str) (void)g_string_free (new_str, TRUE); } while (0)
+/**
+ * go_format_value_gstring:
+ * @layout: Optional PangoLayout, probably preseeded with font attribute.
+ * @str: a GString to store (not append!) the resulting string in.
+ * @measure: (scope call): Function to measure width of string/layout.
+ * @metrics: Font metrics corresponding to @mesaure.
+ * @fmt: #GOFormat
+ * @val: floating-point value. Must be finite.
+ * @type: a format character
+ * @sval: a string to append to @str after @val
+ * @go_color: a color to rende
+ * @col_width: intended max width of layout in pango units. -1 means
+ * no restriction.
+ * @date_conv: #GODateConv
+ * @unicode_minus: Use unicode minuses, not hyphens.
+ *
+ * Render a floating-point value into @layout in such a way that the
+ * layouting width does not needlessly exceed @col_width. Optionally
+ * use unicode minus instead of hyphen.
+ * Returns: a #GOFormatNumberError
+ **/
+/**
+ * go_format_value_gstringl:
+ * @layout: Optional PangoLayout, probably preseeded with font attribute.
+ * @str: a GString to store (not append!) the resulting string in.
+ * @measure: (scope call): Function to measure width of string/layout.
+ * @metrics: Font metrics corresponding to @mesaure.
+ * @fmt: #GOFormat
+ * @val: floating-point value. Must be finite.
+ * @type: a format character
+ * @sval: a string to append to @str after @val
+ * @go_color: a color to rende
+ * @col_width: intended max width of layout in pango units. -1 means
+ * no restriction.
+ * @date_conv: #GODateConv
+ * @unicode_minus: Use unicode minuses, not hyphens.
+ *
+ * Render a floating-point value into @layout in such a way that the
+ * layouting width does not needlessly exceed @col_width. Optionally
+ * use unicode minus instead of hyphen.
+ * Returns: a #GOFormatNumberError
+ **/
GOFormatNumberError
SUFFIX(go_format_value_gstring) (PangoLayout *layout, GString *str,
const GOFormatMeasure measure,
@@ -5617,12 +5681,12 @@ cb_attrs_as_string (PangoAttribute *a, GString *accum)
((c->blue & 0xff00) >> 8));
break;
default:
- if (a->klass->type == go_pango_attr_subscript_get_type ()) {
+ if (a->klass->type == go_pango_attr_subscript_get_attr_type ()) {
g_string_append_printf (accum, "[subscript=%d",
((GOPangoAttrSubscript *)a)->val ?
1:0);
break;
- } else if (a->klass->type == go_pango_attr_superscript_get_type ()) {
+ } else if (a->klass->type == go_pango_attr_superscript_get_attr_type ()) {
g_string_append_printf (accum, "[superscript=%d",
((GOPangoAttrSuperscript *)a)->val ?
1:0);
@@ -5936,6 +6000,20 @@ go_format_unref (GOFormat const *gf_)
}
#endif
+#ifdef DEFINE_COMMON
+GType
+go_format_get_type (void)
+{
+ static GType t = 0;
+
+ if (t == 0)
+ t = g_boxed_type_register_static ("GOFormat",
+ (GBoxedCopyFunc)go_format_ref,
+ (GBoxedFreeFunc)go_format_unref);
+ return t;
+}
+#endif
+
#ifdef DEFINE_COMMON
/**
@@ -6770,11 +6848,32 @@ go_format_generate_str (GString *dst, GOFormatDetails const *details)
#endif
#ifdef DEFINE_COMMON
+static GOFormatDetails *
+go_format_details_ref (GOFormatDetails * details)
+{
+ details->ref_count++;
+ return details;
+}
+
+GType
+go_format_details_get_type (void)
+{
+ static GType t = 0;
+
+ if (t == 0) {
+ t = g_boxed_type_register_static ("GOFormatDetails",
+ (GBoxedCopyFunc)go_format_details_ref,
+ (GBoxedFreeFunc)go_format_details_free);
+ }
+ return t;
+}
+
GOFormatDetails *
go_format_details_new (GOFormatFamily family)
{
GOFormatDetails *res = g_new (GOFormatDetails, 1);
go_format_details_init (res, family);
+ res->ref_count = 1;
return res;
}
#endif
@@ -6794,6 +6893,8 @@ go_format_details_finalize (GOFormatDetails *details)
void
go_format_details_free (GOFormatDetails *details)
{
+ if (!details || details->ref_count-- > 1)
+ return;
go_format_details_finalize (details);
g_free (details);
}
@@ -7069,6 +7170,33 @@ go_format_get_details (GOFormat const *fmt,
#ifdef DEFINE_COMMON
+
+/* making GOFormatCurrency a boxed type for introspection. ref and unref don't
+ * do anything because we always return a staic object */
+static GOFormatCurrency *
+go_format_currency_ref (GOFormatCurrency * currency)
+{
+ return currency;
+}
+
+static void
+go_format_currency_unref (GOFormatCurrency * currency)
+{
+}
+
+GType
+go_format_currency_get_type (void)
+{
+ static GType t = 0;
+
+ if (t == 0) {
+ t = g_boxed_type_register_static ("GOFormatCurrency",
+ (GBoxedCopyFunc)go_format_currency_ref,
+ (GBoxedFreeFunc)go_format_currency_unref);
+ }
+ return t;
+}
+
GOFormatCurrency const *
go_format_locale_currency (void)
{
diff --git a/goffice/utils/go-format.h b/goffice/utils/go-format.h
index 8ae07ae..5c6e5ea 100644
--- a/goffice/utils/go-format.h
+++ b/goffice/utils/go-format.h
@@ -75,6 +75,8 @@ typedef struct {
gboolean has_space;
} GOFormatCurrency;
+GType go_format_currency_get_type (void);
+
typedef struct {
GOFormatFamily family;
GOFormatMagic magic;
@@ -115,8 +117,10 @@ typedef struct {
int denominator;
int expansion[30];
+ unsigned ref_count;
} GOFormatDetails;
+GType go_format_details_get_type (void);
/*************************************************************************/
/* We need these in the format selector */
@@ -152,6 +156,7 @@ void go_render_generall (PangoLayout *layout, GString *str,
/*************************************************************************/
+GType go_format_get_type (void);
GOFormat *go_format_new_from_XL (char const *str);
GOFormat *go_format_new_markup (PangoAttrList *markup, gboolean add_ref);
diff --git a/goffice/utils/go-gdk-pixbuf.c b/goffice/utils/go-gdk-pixbuf.c
new file mode 100644
index 0000000..35dd4d3
--- /dev/null
+++ b/goffice/utils/go-gdk-pixbuf.c
@@ -0,0 +1,254 @@
+/*
+ * go-gdk-pixbuf.c
+ *
+ * Copyright (C) 2000-2004 Jody Goldberg (jody gnome org)
+ * Copyright (C) 2011-2012 Jean Brefort (jean brefort normalesup org)
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
+ * USA
+ */
+
+#include <goffice/goffice-config.h>
+#include "go-gdk-pixbuf.h"
+#include <goffice/goffice-priv.h>
+#include <string.h>
+
+/*****************************************************************************
+ * The functions below do not pertain to GOPixbuf, they should be moved to
+ * elsewhere, may be go-gdk-pixbuf.[c,h]
+ *****************************************************************************/
+/**
+ * go_gdk_pixbuf_intelligent_scale:
+ * @buf: a #GdkPixbuf
+ * @width: new width
+ * @height: new height
+ *
+ * Intelligent pixbuf scaling.
+ *
+ * Deprecated: 0.9.6 use go_image_get_scaled_pixbuf() instead
+ * Returns: a new GdkPixbuf reference.
+ **/
+/* FIXME: deprecate, use go_image_get_scaled_pixbuf instead*/
+GdkPixbuf *
+go_gdk_pixbuf_intelligent_scale (GdkPixbuf *buf, guint width, guint height)
+{
+ GdkPixbuf *scaled;
+ int w, h;
+ unsigned long int ow = gdk_pixbuf_get_width (buf);
+ unsigned long int oh = gdk_pixbuf_get_height (buf);
+
+ if (ow > width || oh > height) {
+ if (ow * height > oh * width) {
+ w = width;
+ h = width * (((double)oh)/(double)ow);
+ } else {
+ h = height;
+ w = height * (((double)ow)/(double)oh);
+ }
+
+ scaled = gdk_pixbuf_scale_simple (buf, w, h, GDK_INTERP_BILINEAR);
+ } else
+ scaled = g_object_ref (buf);
+
+ return scaled;
+}
+
+static GdkPixbuf *
+new_from_data (gconstpointer data, size_t length)
+{
+ GdkPixbuf *res;
+ GdkPixbufLoader *loader = gdk_pixbuf_loader_new ();
+ gdk_pixbuf_loader_write (loader, data, length, NULL);
+ gdk_pixbuf_loader_close (loader, NULL);
+ res = gdk_pixbuf_loader_get_pixbuf (loader);
+ if (res)
+ g_object_ref (res);
+ g_object_unref (loader);
+ return res;
+}
+
+/**
+ * go_gdk_pixbuf_load_from_file:
+ * @filename: pixbuf filename
+ *
+ * Utility routine to create pixbufs from file @name in the goffice_icon_dir.
+ * As a special case, @filename may have the form "res:<resource name>" in
+ * which case the resource manager is queried instead of loading a file.
+ *
+ * Since: 0.9.6
+ * Returns: (transfer full): a GdkPixbuf that the caller is responsible for.
+ **/
+GdkPixbuf *
+go_gdk_pixbuf_load_from_file (char const *filename)
+{
+ GdkPixbuf *pixbuf;
+
+ g_return_val_if_fail (filename != NULL, NULL);
+
+ if (strncmp (filename, "res:", 4) == 0) {
+ size_t length;
+ const char *data = go_rsm_lookup (filename + 4, &length);
+ pixbuf = data
+ ? new_from_data (data, length)
+ : NULL;
+ } else {
+ char *path = g_path_is_absolute (filename)
+ ? g_strdup (filename)
+ : g_build_filename (go_sys_icon_dir (), filename, NULL);
+ pixbuf = gdk_pixbuf_new_from_file (path, NULL);
+ g_free (path);
+ }
+
+ if (!pixbuf && go_debug_flag ("pixbuf"))
+ g_printerr ("Failed to load pixbuf from %s\n", filename);
+
+ return pixbuf;
+}
+
+/**
+ * go_gdk_pixbuf_new_from_file:
+ * @filename: pixbuf filename
+ *
+ * Utility routine to create pixbufs from file @name in the goffice_icon_dir.
+ * As a special case, @filename may have the form "res:<resource name>" in
+ * which case the resource manager is queried instead of loading a file.
+ *
+ * Deprecated: 0.9.6 use go_gdk_pixbuf_load_from_file() instead
+ * Returns: (transfer full): a GdkPixbuf that the caller is responsible for.
+ **/
+GdkPixbuf *
+go_gdk_pixbuf_new_from_file (char const *filename)
+{
+ return go_gdk_pixbuf_load_from_file (filename);
+}
+
+/**
+ * go_gdk_pixbuf_get_from_cache:
+ * @filename: pixbuf filename
+ *
+ * Retrieves a pixbuf from the image cache, loading it from the file
+ * @filename located in goffice_icon_dir if not cached yet.
+ *
+ * returns: (transfer none): a GdkPixbuf, NULL on error.
+ **/
+GdkPixbuf *
+go_gdk_pixbuf_get_from_cache (char const *filename)
+{
+ static GHashTable *cache = NULL;
+ GdkPixbuf *pixbuf;
+
+ g_return_val_if_fail (filename != NULL, NULL);
+
+ if (cache != NULL) {
+ pixbuf = g_hash_table_lookup (cache, filename);
+ if (pixbuf != NULL)
+ return pixbuf;
+ } else
+ cache = g_hash_table_new_full (g_str_hash, g_str_equal,
+ NULL, g_object_unref);
+
+ pixbuf = go_gdk_pixbuf_load_from_file (filename);
+ if (pixbuf != NULL)
+ g_hash_table_insert (cache, (gpointer) filename, pixbuf);
+
+ return pixbuf;
+}
+
+
+/**
+ * go_gdk_pixbuf_tile:
+ * @src: source pixbuf
+ * @w: desired width
+ * @h: desired height
+ *
+ * Deprecated: 0.9.6
+ * Returns: (transfer full): a new pixbuf consisting of the source pixbuf tiled
+ * enough times to fill out the space needed.
+ *
+ * The fractional tiles are spead evenly left-right and top-bottom.
+ */
+GdkPixbuf *
+go_gdk_pixbuf_tile (GdkPixbuf const *src, guint w, guint h)
+{
+ int src_w, src_h;
+ int tile_x, tile_y;
+ int left_x, left_y;
+ int dst_y = 0;
+ int stripe_y;
+ GdkPixbuf *dst;
+
+ g_return_val_if_fail (GDK_IS_PIXBUF (src), NULL);
+ g_return_val_if_fail (w < G_MAXINT, NULL);
+ g_return_val_if_fail (h < G_MAXINT, NULL);
+
+ src_w = gdk_pixbuf_get_width (src);
+ src_h = gdk_pixbuf_get_height (src);
+
+ tile_x = w / src_w; /* Number of full tiles */
+ tile_y = h / src_h;
+
+ left_x = w - tile_x * src_w;
+ left_y = h - tile_y * src_h;
+
+ dst_y = 0;
+ dst = gdk_pixbuf_new (gdk_pixbuf_get_colorspace (src),
+ gdk_pixbuf_get_has_alpha (src),
+ gdk_pixbuf_get_bits_per_sample (src),
+ MAX (w, 1),
+ MAX (h, 1));
+
+ for (stripe_y = -1; stripe_y <= tile_y; stripe_y++) {
+ int dst_x = 0;
+ int stripe_x;
+ int this_h, start_y = 0;
+
+ if (stripe_y == -1) {
+ this_h = (left_y + 1) / 2;
+ start_y = src_h - this_h;
+ } else if (stripe_y == tile_y)
+ this_h = left_y / 2;
+ else
+ this_h = src_h;
+
+ if (this_h == 0)
+ continue;
+
+ for (stripe_x = -1; stripe_x <= tile_x; stripe_x++) {
+ int this_w, start_x = 0;
+
+ if (stripe_x == -1) {
+ this_w = (left_x + 1) / 2;
+ start_x = src_w - this_w;
+ } else if (stripe_x == tile_x)
+ this_w = left_x / 2;
+ else
+ this_w = src_w;
+
+ if (this_w == 0)
+ continue;
+
+ gdk_pixbuf_copy_area (src, start_x, start_y,
+ this_w, this_h,
+ dst,
+ dst_x, dst_y);
+
+ dst_x += this_w;
+ }
+
+ dst_y += this_h;
+ }
+
+ return dst;
+}
diff --git a/goffice/utils/go-gdk-pixbuf.h b/goffice/utils/go-gdk-pixbuf.h
new file mode 100644
index 0000000..cc85614
--- /dev/null
+++ b/goffice/utils/go-gdk-pixbuf.h
@@ -0,0 +1,43 @@
+/*
+ * go-gdk-pixbuf.h - Misc GdkPixbuf utilities
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) version 3.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
+ * USA.
+ */
+
+#ifndef GO_GDK_PIXBUF_H
+#define GO_GDK_PIXBUF_H
+
+#include <goffice/goffice.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+G_BEGIN_DECLS
+
+GdkPixbuf *go_gdk_pixbuf_load_from_file (char const *filename);
+GdkPixbuf *go_gdk_pixbuf_get_from_cache (char const *filename);
+#ifndef GOFFICE_DISABLE_DEPRECATED
+GOFFICE_DEPRECATED_FOR(go_image_get_scaled_pixbuf)
+GdkPixbuf *go_gdk_pixbuf_intelligent_scale (GdkPixbuf *buf,
+ guint width, guint height);
+GOFFICE_DEPRECATED_FOR(go_gdk_pixbuf_load_from_file)
+GdkPixbuf *go_gdk_pixbuf_new_from_file (char const *filename);
+GOFFICE_DEPRECATED_FOR(go_image_get_pixbuf)
+GdkPixbuf *go_gdk_pixbuf_tile (GdkPixbuf const *src,
+ guint w, guint h);
+#endif
+
+G_END_DECLS
+
+#endif
diff --git a/goffice/utils/go-glib-extras.c b/goffice/utils/go-glib-extras.c
index f038db9..d9d22c8 100644
--- a/goffice/utils/go-glib-extras.c
+++ b/goffice/utils/go-glib-extras.c
@@ -50,13 +50,13 @@ cb_hash_collect_keys (gpointer key, gpointer value, GSList **accum)
}
/**
- * go_hash_keys :
- * @hash : #GHashTable
+ * go_hash_keys:
+ * @hash: #GHashTable
*
* Collects an unordered list of the keys in @hash.
*
- * Returns: a list which the caller needs to free.
- * The content has not additional references added
+ * Returns: (element-type void) (transfer container): a list which the
+ * caller needs to free. The content has not additional references added
**/
GSList *
go_hash_keys (GHashTable *hash)
@@ -88,11 +88,11 @@ go_ptr_array_insert (GPtrArray *array, gpointer value, int index)
/**
* go_slist_create:
* @item1: optionally %NULL
- * @Varargs: %NULL terminated list of additional items
+ * @...: %NULL terminated list of additional items
*
* Creates a GList from NULL-terminated list of arguments.
* As the arguments are just copied to the list, the caller owns them.
- * Returns: (transfer container): created list.
+ * Returns: (element-type void) (transfer container): created list.
**/
GSList *
go_slist_create (gpointer item1, ...)
@@ -112,11 +112,11 @@ go_slist_create (gpointer item1, ...)
/**
* go_slist_map:
- * @list: list of some items
- * @map_func: mapping function
+ * @list: (element-type void): list of some items
+ * @map_func: (scope call): mapping function
*
* The ownership of the list elements depends on map_func.
- * Returns: (transfer container): the mapped list
+ * Returns: (element-type void) (transfer container): the mapped list
**/
GSList *
go_slist_map (GSList const *list, GOMapFunc map_func)
@@ -130,6 +130,17 @@ go_slist_map (GSList const *list, GOMapFunc map_func)
return g_slist_reverse (list_copy);
}
+/**
+ * go_list_index_custom:
+ * @list: (element-type void): #GList
+ * @data: element for which the index is searched for
+ * @cmp_func: (scope call): #GCompareFunc
+ *
+ * Searched for @data in @list and return the corresponding index or -1 if not
+ * found.
+ *
+ * Returns: the data index in the list.
+ **/
gint
go_list_index_custom (GList *list, gpointer data, GCompareFunc cmp_func)
{
@@ -152,8 +163,9 @@ go_list_index_custom (GList *list, gpointer data, GCompareFunc cmp_func)
*
* Splits up string into tokens at delim and returns a string list.
*
- * Returns: string list which you should free after use using function
- * e_free_string_list().
+ * Returns: (element-type char) (transfer full): string list which you should
+ * free after use using function g_slist_free_full(), using g_free as second
+ * argument.
**/
GSList *
go_strsplit_to_slist (gchar const *string, gchar delimiter)
@@ -431,6 +443,7 @@ struct _GOMemChunk {
#ifdef DEBUG_CHUNK_ALLOCATOR
int blockid;
#endif
+ unsigned ref_count;
};
@@ -478,6 +491,7 @@ go_mem_chunk_new (char const *name, size_t user_atom_size, size_t chunk_size)
#ifdef DEBUG_CHUNK_ALLOCATOR
res->blockid = 0;
#endif
+ res->ref_count = 1;
return res;
}
@@ -489,6 +503,8 @@ go_mem_chunk_destroy (GOMemChunk *chunk, gboolean expect_leaks)
g_return_if_fail (chunk != NULL);
+ if (chunk->ref_count-- > 1)
+ return;
#ifdef DEBUG_CHUNK_ALLOCATOR
g_print ("Destroying %s.\n", chunk->name);
#endif
@@ -522,6 +538,32 @@ go_mem_chunk_destroy (GOMemChunk *chunk, gboolean expect_leaks)
g_free (chunk);
}
+static GOMemChunk *
+go_mem_chunk_ref (GOMemChunk *chunk)
+{
+ chunk->ref_count++;
+ return chunk;
+}
+
+GType
+go_mem_chunk_get_type (void)
+{
+ static GType t = 0;
+
+ if (t == 0) {
+ t = g_boxed_type_register_static ("GOMemChunk",
+ (GBoxedCopyFunc)go_mem_chunk_ref,
+ (GBoxedFreeFunc)go_mem_chunk_destroy);
+ }
+ return t;
+}
+
+/**
+ * go_mem_chunk_alloc:
+ * @chunk: #GOMemChunk
+ *
+ * Returns: (transfer none): an unused memory block
+ **/
gpointer
go_mem_chunk_alloc (GOMemChunk *chunk)
{
@@ -576,6 +618,12 @@ go_mem_chunk_alloc (GOMemChunk *chunk)
return res + chunk->alignment;
}
+/**
+ * go_mem_chunk_alloc0:
+ * @chunk: #GOMemChunk
+ *
+ * Returns: (transfer none): an unused memory block filled with 0
+ **/
gpointer
go_mem_chunk_alloc0 (GOMemChunk *chunk)
{
@@ -626,7 +674,12 @@ go_mem_chunk_free (GOMemChunk *chunk, gpointer mem)
}
}
-/*
+/**
+ * go_mem_chunk_foreach_leak:
+ * @chunk: #GOMemChunk
+ * @cb: (scope call): callback
+ * @user: user data for @cb
+ *
* Loop over all non-freed memory in the chunk. It's safe to allocate or free
* from the chunk in the callback.
*/
@@ -905,8 +958,13 @@ go_object_set_property (GObject *obj, const char *property_name,
-/*
+/**
+ * go_object_properties_collect:
+ * @obj: #GObject
+ *
* Collect all rw properties and their values.
+ * Returns: (element-type void) (transfer container): the list of collected
+ * properties as #GParamSpec and values as #GValue.
*/
GSList *
go_object_properties_collect (GObject *obj)
@@ -933,6 +991,17 @@ go_object_properties_collect (GObject *obj)
return res;
}
+/**
+ * go_object_properties_apply:
+ * @obj: #GObject
+ * @props: (element-type void): the list of properties and their values to
+ * apply
+ * @changed_only: whether to restrict calls to g_object_set_property() to
+ * properties with changed values.
+ *
+ * Sets a list of properties for @obj. The list needs to be a list of
+ * alternating #GParamSpec and #GValue.
+ **/
void
go_object_properties_apply (GObject *obj, GSList *props, gboolean changed_only)
{
@@ -963,6 +1032,14 @@ go_object_properties_apply (GObject *obj, GSList *props, gboolean changed_only)
}
}
+/**
+ * go_object_properties_free:
+ * @props: (element-type void): the list of properties and their values to
+ * unset
+ *
+ * Unsezts the values in the list which needs to be a list of alternating
+ * #GParamSpec and #GValue.
+ **/
void
go_object_properties_free (GSList *props)
{
@@ -982,7 +1059,7 @@ go_object_properties_free (GSList *props)
* go_parse_key_value:
* @options: Options string.
* @err: Reference to store GError if parsing fails.
- * @handler: Handler to call for each key-value pair.
+ * @handler: (scope call): Handler to call for each key-value pair.
* @user: user pointer.
*/
gboolean
diff --git a/goffice/utils/go-glib-extras.h b/goffice/utils/go-glib-extras.h
index 710c100..ada96c8 100644
--- a/goffice/utils/go-glib-extras.h
+++ b/goffice/utils/go-glib-extras.h
@@ -84,6 +84,7 @@ char const *go_guess_encoding (char const *raw, gsize len,
char const *go_get_real_name (void);
void go_destroy_password (char *passwd);
+GType go_mem_chunk_get_type (void);
GOMemChunk *go_mem_chunk_new (char const *name, gsize user_atom_size, gsize chunk_size);
void go_mem_chunk_destroy (GOMemChunk *chunk, gboolean expect_leaks);
gpointer go_mem_chunk_alloc (GOMemChunk *chunk);
diff --git a/goffice/utils/go-image.c b/goffice/utils/go-image.c
index 15c89ca..e0285b3 100644
--- a/goffice/utils/go-image.c
+++ b/goffice/utils/go-image.c
@@ -137,6 +137,31 @@ static GOImageFormatInfo const image_format_infos[GO_IMAGE_FORMAT_UNKNOWN] = {
(char *) "eps", FALSE, TRUE, TRUE},
};
+/* Making GOFormatInfo as a boxed type, as they are static, ref and unref don't
+ * need to do anything */
+static GOImageFormatInfo *
+go_image_format_info_ref (GOImageFormatInfo *info)
+{
+ return info;
+}
+
+static void
+go_image_format_info_unref (GOImageFormatInfo const *info)
+{
+}
+
+GType
+go_image_format_info_get_type (void)
+{
+ static GType t = 0;
+
+ if (t == 0)
+ t = g_boxed_type_register_static ("GOImageFormatInfo",
+ (GBoxedCopyFunc)go_image_format_info_ref,
+ (GBoxedFreeFunc)go_image_format_info_unref);
+ return t;
+}
+
static void
go_image_build_pixbuf_format_infos (void)
{
@@ -195,7 +220,7 @@ go_image_build_pixbuf_format_infos (void)
*
* Retrieves information associated to @format.
*
- * returns: a #GOImageFormatInfo struct.
+ * Returns: a #GOImageFormatInfo struct.
**/
GOImageFormatInfo const *
@@ -248,7 +273,8 @@ go_image_get_format_from_name (char const *name)
/**
* go_image_get_formats_with_pixbuf_saver:
*
- * returns: a list of #GOImageFormat that can be created from a pixbuf.
+ * Returns: (element-type GOImageFormat) (transfer container): a list of #GOImageFormat that can be created
+ * from a pixbuf.
**/
GSList *
@@ -460,6 +486,15 @@ go_image_draw (GOImage *image, cairo_t *cr)
#define GO_THUMBNAIL_SIZE 64
+/**
+ * go_image_get_thumbnail:
+ * @image: #GOImage
+ *
+ * Generates a thumbnail for @image if not already done and returns it, adding
+ a reference. The pixbuf is scaled so that its width and height are not larger
+ * than 64 pixels, and preserving the aspect ratio.
+ * Returns: (transfer full): the thumbnail for @image
+ **/
GdkPixbuf const *
go_image_get_thumbnail (GOImage *image)
{
@@ -469,6 +504,14 @@ go_image_get_thumbnail (GOImage *image)
return image->thumbnail;
}
+/**
+ * go_image_get_pixbuf:
+ * @image: #GOImage
+ *
+ * Builds a pixbuf from the image if not already done and returns it, adding
+ * a reference.
+ * Returns: (transfer full): the pixbuf for @image
+ **/
GdkPixbuf *
go_image_get_pixbuf (GOImage *image)
{
@@ -477,6 +520,17 @@ go_image_get_pixbuf (GOImage *image)
return g_object_ref (image->pixbuf);
}
+/**
+ * go_image_get_scaled_pixbuf:
+ * @image: #GOImage
+ * @width: the new pixbuf width
+ * @height: the new pixbuf height
+ *
+ * Builds a scaled pixbuf from the image and returns it. The caller needs to
+ * unref it. The pixbuf is scaled so that its width and height are not larger
+ * than, respectively, @width and @height, and preserving the aspect ratio.
+ * Returns: (transfer full): the scaled pixbuf for @image
+ **/
GdkPixbuf *
go_image_get_scaled_pixbuf (GOImage *image, int width, int height)
{
diff --git a/goffice/utils/go-image.h b/goffice/utils/go-image.h
index ab97cdb..374a84f 100644
--- a/goffice/utils/go-image.h
+++ b/goffice/utils/go-image.h
@@ -48,6 +48,7 @@ typedef struct {
gboolean alpha_support;
} GOImageFormatInfo;
+GType go_image_format_info_get_type (void);
char *go_mime_to_image_format (char const *mime_type);
char *go_image_format_to_mime (char const *format);
diff --git a/goffice/utils/go-libxml-extras.c b/goffice/utils/go-libxml-extras.c
index 7442d50..3090ae2 100644
--- a/goffice/utils/go-libxml-extras.c
+++ b/goffice/utils/go-libxml-extras.c
@@ -36,7 +36,7 @@
/**
- * go_xml_parse_file :
+ * go_xml_parse_file: (skip)
* @filename: the locale path to a file to parse.
*
* Like xmlParseFile, but faster. Does not accept compressed files.
@@ -45,7 +45,7 @@
* Note: this reads the entire file into memory and should therefore
* not be used for user-supplied files.
*
- * Returns: A libxml2 xmlDocPtr or %NULL.
+ * Returns: (transfer full): A libxml2 xmlDocPtr or %NULL.
**/
xmlDocPtr
go_xml_parse_file (char const *filename)
@@ -62,8 +62,14 @@ go_xml_parse_file (char const *filename)
return result;
}
-/* Get an xmlChar * value for a node carried as an attibute
+/**
+ * go_xml_node_get_cstr: (skip)
+ * @node: #xmlNodePtr
+ * @name: attribute name
+ * Get an xmlChar * value for a node carried as an attibute
* result must be xmlFree
+ *
+ * Returns: (transfer full): the attribute value
*/
xmlChar *
go_xml_node_get_cstr (xmlNodePtr node, char const *name)
@@ -241,6 +247,13 @@ go_xml_node_set_enum (xmlNodePtr node, char const *name, GType etype, gint val)
/*************************************************************************/
+/**
+ * go_xml_get_child_by_name: (skip)
+ * @tree: #xmlNode
+ * @name: child name
+ *
+ * Returns: (transfer none): the child with @name as name if any.
+ **/
xmlNode *
go_xml_get_child_by_name (xmlNode const *parent, char const *child_name)
{
@@ -257,6 +270,14 @@ go_xml_get_child_by_name (xmlNode const *parent, char const *child_name)
return NULL;
}
+/**
+ * go_xml_get_child_by_name_no_lang: (skip)
+ * @tree: #xmlNode
+ * @name: child name
+ *
+ * Returns: (transfer none): the child with @name as name and withou "xml:lang"
+ * attribute if any.
+ **/
xmlNode *
go_xml_get_child_by_name_no_lang (xmlNode const *parent, char const *name)
{
@@ -281,7 +302,14 @@ go_xml_get_child_by_name_no_lang (xmlNode const *parent, char const *name)
return NULL;
}
-
+/**
+ * go_xml_get_child_by_name_by_lang: (skip)
+ * @tree: #xmlNode
+ * @name: child name
+ *
+ * Returns: (transfer none): the child with @name as name and with "xml:lang"
+ * attribute corresponding to the preferred language.
+ **/
xmlNode *
go_xml_get_child_by_name_by_lang (xmlNode const *parent, gchar const *name)
{
diff --git a/goffice/utils/go-line.c b/goffice/utils/go-line.c
index ab9a913..f211a7f 100644
--- a/goffice/utils/go-line.c
+++ b/goffice/utils/go-line.c
@@ -59,6 +59,26 @@
* @GO_LINE_INTERPOLATION_MAX: First invalid value.
**/
+static GOLineDashSequence *
+go_line_dash_sequence_ref (GOLineDashSequence * sequence)
+{
+ sequence->ref_count++;
+ return sequence;
+}
+
+GType
+go_line_dash_sequence_get_type (void)
+{
+ static GType t = 0;
+
+ if (t == 0) {
+ t = g_boxed_type_register_static ("GOLineDashSequence",
+ (GBoxedCopyFunc)go_line_dash_sequence_ref,
+ (GBoxedFreeFunc)go_line_dash_sequence_free);
+ }
+ return t;
+}
+
typedef struct {
int n_dash;
double length;
@@ -254,6 +274,7 @@ go_line_dash_get_sequence (GOLineDashType type, double scale)
sequence->dash = g_new (double, sequence->n_dash);
for (i = 0; i < sequence->n_dash; i++)
sequence->dash[i] = scale * dash_desc->dash[i];
+ sequence->ref_count = 1;
}
return sequence;
@@ -268,8 +289,9 @@ go_line_dash_get_sequence (GOLineDashType type, double scale)
void
go_line_dash_sequence_free (GOLineDashSequence *sequence)
{
- if (sequence != NULL)
- g_free (sequence->dash);
+ if (sequence == NULL || sequence->ref_count-- > 1)
+ return;
+ g_free (sequence->dash);
g_free (sequence);
}
diff --git a/goffice/utils/go-line.h b/goffice/utils/go-line.h
index 694bf0a..38fd80f 100644
--- a/goffice/utils/go-line.h
+++ b/goffice/utils/go-line.h
@@ -30,7 +30,9 @@ typedef struct {
double offset;
unsigned int n_dash;
double *dash;
+ unsigned ref_count;
} GOLineDashSequence;
+GType go_line_dash_sequence_get_type (void);
GOLineDashType go_line_dash_from_str (char const *name);
char const *go_line_dash_as_str (GOLineDashType type);
diff --git a/goffice/utils/go-marker.c b/goffice/utils/go-marker.c
index b539760..863e4dd 100644
--- a/goffice/utils/go-marker.c
+++ b/goffice/utils/go-marker.c
@@ -217,6 +217,13 @@ go_marker_assign (GOMarker *dst, GOMarker const *src)
}
+/**
+ * go_marker_dup:
+ * @src: the #GOMarker to duplicate
+ *
+ * Duplicates @src.
+ * Returns: (transfer full): the duplicated marker.
+ **/
GOMarker *
go_marker_dup (GOMarker const *src)
{
diff --git a/goffice/utils/go-pango-extras.c b/goffice/utils/go-pango-extras.c
index edac05f..67cf12e 100644
--- a/goffice/utils/go-pango-extras.c
+++ b/goffice/utils/go-pango-extras.c
@@ -523,8 +523,8 @@ static gboolean
filter_func (PangoAttribute *attribute, G_GNUC_UNUSED gpointer data)
{
PangoAttrType type = attribute->klass->type;
- return (type == go_pango_attr_superscript_get_type () ||
- type == go_pango_attr_subscript_get_type ());
+ return (type == go_pango_attr_superscript_get_attr_type () ||
+ type == go_pango_attr_subscript_get_attr_type ());
}
static void
@@ -568,7 +568,7 @@ go_pango_translate_here (PangoAttrIterator *state_iter,
for (l = the_attrs; l != NULL; l = l->next) {
PangoAttribute *attribute = l->data;
PangoAttrType type = attribute->klass->type;
- if (type == go_pango_attr_superscript_get_type ()) {
+ if (type == go_pango_attr_superscript_get_attr_type ()) {
GOPangoAttrSuperscript *attr = (GOPangoAttrSuperscript *)attribute;
if (attr->val) {
scale *= GO_SUPERSCRIPT_SCALE;
@@ -658,7 +658,7 @@ go_pango_translate_layout (PangoLayout *layout)
}
PangoAttrType
-go_pango_attr_subscript_get_type (void)
+go_pango_attr_subscript_get_attr_type (void)
{
static PangoAttrType go_pango_attr_subscript_type = PANGO_ATTR_INVALID;
@@ -670,7 +670,13 @@ go_pango_attr_subscript_get_type (void)
}
PangoAttrType
-go_pango_attr_superscript_get_type (void)
+go_pango_attr_subscript_get_type (void)
+{
+ return go_pango_attr_subscript_get_attr_type ();
+}
+
+PangoAttrType
+go_pango_attr_superscript_get_attr_type (void)
{
static PangoAttrType go_pango_attr_superscript_type = PANGO_ATTR_INVALID;
@@ -681,6 +687,11 @@ go_pango_attr_superscript_get_type (void)
return go_pango_attr_superscript_type;
}
+PangoAttrType
+go_pango_attr_superscript_get_type (void)
+{
+ return go_pango_attr_superscript_get_attr_type ();
+}
static PangoAttribute *
go_pango_attr_subscript_copy (PangoAttribute const *attr)
@@ -720,6 +731,12 @@ go_pango_attr_subscript_compare (PangoAttribute const *attr1,
return (at1->val == at2->val);
}
+/**
+ * go_pango_attr_subscript_new: (skip)
+ * @val: %TRUE if the characters must be lowered.
+ *
+ * Returns: (transfer full): a subscript attribute.
+ **/
PangoAttribute *
go_pango_attr_subscript_new (gboolean val)
{
@@ -733,7 +750,7 @@ go_pango_attr_subscript_new (gboolean val)
};
if (!klass.type)
- klass.type = go_pango_attr_subscript_get_type ();
+ klass.type = go_pango_attr_subscript_get_attr_type ();
result = g_new (GOPangoAttrSubscript, 1);
result->attr.klass = &klass;
@@ -742,6 +759,12 @@ go_pango_attr_subscript_new (gboolean val)
return (PangoAttribute *) result;
}
+/**
+ * go_pango_attr_superscript_new: (skip)
+ * @val: %TRUE if the characters must be raised.
+ *
+ * Returns: (transfer full): a superscript attribute.
+ **/
PangoAttribute *
go_pango_attr_superscript_new (gboolean val)
{
@@ -755,7 +778,7 @@ go_pango_attr_superscript_new (gboolean val)
};
if (!klass.type)
- klass.type = go_pango_attr_superscript_get_type ();
+ klass.type = go_pango_attr_superscript_get_attr_type ();
result = g_new (GOPangoAttrSuperscript, 1);
result->attr.klass = &klass;
diff --git a/goffice/utils/go-pango-extras.h b/goffice/utils/go-pango-extras.h
index 6e0b3b9..1db7491 100644
--- a/goffice/utils/go-pango-extras.h
+++ b/goffice/utils/go-pango-extras.h
@@ -6,6 +6,7 @@
#ifdef GOFFICE_WITH_GTK
#include <gtk/gtk.h>
#endif
+#include <goffice/goffice.h>
G_BEGIN_DECLS
@@ -38,8 +39,14 @@ PangoAttrList *go_pango_translate_attributes (PangoAttrList *attrs);
void go_pango_translate_layout (PangoLayout *layout);
PangoAttribute *go_pango_attr_subscript_new (gboolean val);
PangoAttribute *go_pango_attr_superscript_new (gboolean val);
+PangoAttrType go_pango_attr_subscript_get_attr_type (void);
+PangoAttrType go_pango_attr_superscript_get_attr_type (void);
+#ifndef GOFFICE_DISABLE_DEPRECATED
+GOFFICE_DEPRECATED_FOR(go_pango_attr_subscript_get_attr_type)
PangoAttrType go_pango_attr_subscript_get_type (void);
+GOFFICE_DEPRECATED_FOR(go_pango_attr_superscript_get_attr_type)
PangoAttrType go_pango_attr_superscript_get_type (void);
+#endif
char *go_pango_attrs_to_markup (PangoAttrList *attrs, char const *text);
diff --git a/goffice/utils/go-path.c b/goffice/utils/go-path.c
index 54e7618..f70acfe 100644
--- a/goffice/utils/go-path.c
+++ b/goffice/utils/go-path.c
@@ -483,6 +483,19 @@ go_path_rectangle (GOPath *path,
go_path_close (path);
}
+/**
+ * go_path_interpret:
+ * @path: #GOPath
+ * @direction: #GOPathDirection
+ * @move_to: (scope call): the callback for move to.
+ * @line_to: (scope call): the callback for drawing a line.
+ * @curve_to: (scope call): the callback for drawing a bezier cubic spline.
+ * @close_path: (scope call): the callback for closing the path.
+ * @closure: data to pass as first argument to the callbacks.
+ *
+ * This function can be used to draw a path or for other purposes.
+ * To draw using cairo, the closure argument should be a valid #cairo_t.
+ **/
void
go_path_interpret (GOPath const *path,
GOPathDirection direction,
@@ -590,13 +603,14 @@ go_path_cairo_curve_to (cairo_t *cr, GOPathPoint const *point0,
cairo_curve_to (cr, point0->x, point0->y, point1->x, point1->y, point2->x, point2->y);
}
-/** go_path_to_cairo:
+/**
+ * go_path_to_cairo:
* @path: #GOPath
* @direction: #GOPathDirection
* @cr: #cairo_t
*
* Renders the path to the cairo context using its current settings.
- */
+ **/
void
go_path_to_cairo (GOPath const *path, GOPathDirection direction, cairo_t *cr)
@@ -633,11 +647,12 @@ go_path_append_close (GOPath *path)
go_path_close (path);
}
-/** go_path_copy:
+/**
+ * go_path_copy:
* @path: #GOPath
*
* Returns: a new #GOPath identical to @path.
- */
+ **/
GOPath *go_path_copy (GOPath const *path)
{
diff --git a/goffice/utils/go-pattern.c b/goffice/utils/go-pattern.c
index ec91a16..55c97c4 100644
--- a/goffice/utils/go-pattern.c
+++ b/goffice/utils/go-pattern.c
@@ -138,7 +138,7 @@ go_pattern_get_pattern (GOPattern const *pat)
}
/**
- * go_pattern_get_svg_path:
+ * go_pattern_get_svg_path: (skip)
* @pattern: a #GOPattern
* @width: pattern width
* @height: pattern height
diff --git a/goffice/utils/go-pixbuf.c b/goffice/utils/go-pixbuf.c
index 87ec88b..0fa97dc 100644
--- a/goffice/utils/go-pixbuf.c
+++ b/goffice/utils/go-pixbuf.c
@@ -1,7 +1,6 @@
/*
* go-pixbuf.c
*
- * Copyright (C) 2000-2004 Jody Goldberg (jody gnome org)
* Copyright (C) 2011 Jean Brefort (jean brefort normalesup org)
*
* This program is free software; you can redistribute it and/or
@@ -24,220 +23,12 @@
#include "go-pixbuf.h"
#include <goffice/goffice-priv.h>
-#include <string.h>
#include <gsf/gsf-utils.h>
#include <gsf/gsf-impl-utils.h>
#include <glib/gi18n-lib.h>
-/**
- * go_gdk_pixbuf_intelligent_scale:
- * @buf: a #GdkPixbuf
- * @width: new width
- * @height: new height
- *
- * Intelligent pixbuf scaling.
- *
- * returns: a new GdkPixbuf reference.
- **/
-
-GdkPixbuf *
-go_gdk_pixbuf_intelligent_scale (GdkPixbuf *buf, guint width, guint height)
-{
- GdkPixbuf *scaled;
- int w, h;
- unsigned long int ow = gdk_pixbuf_get_width (buf);
- unsigned long int oh = gdk_pixbuf_get_height (buf);
-
- if (ow > width || oh > height) {
- if (ow * height > oh * width) {
- w = width;
- h = width * (((double)oh)/(double)ow);
- } else {
- h = height;
- w = height * (((double)ow)/(double)oh);
- }
-
- scaled = gdk_pixbuf_scale_simple (buf, w, h, GDK_INTERP_BILINEAR);
- } else
- scaled = g_object_ref (buf);
-
- return scaled;
-}
-
-static GdkPixbuf *
-new_from_data (gconstpointer data, size_t length)
-{
- GdkPixbuf *res;
- GdkPixbufLoader *loader = gdk_pixbuf_loader_new ();
- gdk_pixbuf_loader_write (loader, data, length, NULL);
- gdk_pixbuf_loader_close (loader, NULL);
- res = gdk_pixbuf_loader_get_pixbuf (loader);
- if (res)
- g_object_ref (res);
- g_object_unref (loader);
- return res;
-}
-
-/**
- * go_gdk_pixbuf_new_from_file:
- * @filename: pixbuf filename
- *
- * Utility routine to create pixbufs from file @name in the goffice_icon_dir.
- * As a special case, @filename may have the form "res:<resource name>" in
- * which case the resource manager is queried instead of loading a file.
- *
- * Returns: a GdkPixbuf that the caller is responsible for.
- **/
-
-GdkPixbuf *
-go_gdk_pixbuf_new_from_file (char const *filename)
-{
- GdkPixbuf *pixbuf;
-
- g_return_val_if_fail (filename != NULL, NULL);
-
- if (strncmp (filename, "res:", 4) == 0) {
- size_t length;
- const char *data = go_rsm_lookup (filename + 4, &length);
- pixbuf = data
- ? new_from_data (data, length)
- : NULL;
- } else {
- char *path = g_path_is_absolute (filename)
- ? g_strdup (filename)
- : g_build_filename (go_sys_icon_dir (), filename, NULL);
- pixbuf = gdk_pixbuf_new_from_file (path, NULL);
- g_free (path);
- }
-
- if (!pixbuf && go_debug_flag ("pixbuf"))
- g_printerr ("Failed to load pixbuf from %s\n", filename);
-
- return pixbuf;
-}
-
-/**
- * go_gdk_pixbuf_get_from_cache:
- * @filename: pixbuf filename
- *
- * Retrieves a pixbuf from the image cache, loading it from the file
- * @filename located in goffice_icon_dir if not cached yet.
- *
- * returns: a GdkPixbuf, NULL on error.
- **/
-
-GdkPixbuf *
-go_gdk_pixbuf_get_from_cache (char const *filename)
-{
- static GHashTable *cache = NULL;
- GdkPixbuf *pixbuf;
-
- g_return_val_if_fail (filename != NULL, NULL);
-
- if (cache != NULL) {
- pixbuf = g_hash_table_lookup (cache, filename);
- if (pixbuf != NULL)
- return pixbuf;
- } else
- cache = g_hash_table_new_full (g_str_hash, g_str_equal,
- NULL, g_object_unref);
-
- pixbuf = go_gdk_pixbuf_new_from_file (filename);
- if (pixbuf != NULL)
- g_hash_table_insert (cache, (gpointer) filename, pixbuf);
-
- return pixbuf;
-}
-
-
-/**
- * go_gdk_pixbuf_tile:
- * @src: source pixbuf
- * @w: desired width
- * @h: desired height
- *
- * returns: a new pixbuf consisting of the source pixbuf tiled
- * enough times to fill out the space needed.
- *
- * The fractional tiles are spead evenly left-right and top-bottom.
- */
-GdkPixbuf *
-go_gdk_pixbuf_tile (GdkPixbuf const *src, guint w, guint h)
-{
- int src_w, src_h;
- int tile_x, tile_y;
- int left_x, left_y;
- int dst_y = 0;
- int stripe_y;
- GdkPixbuf *dst;
-
- g_return_val_if_fail (GDK_IS_PIXBUF (src), NULL);
- g_return_val_if_fail (w < G_MAXINT, NULL);
- g_return_val_if_fail (h < G_MAXINT, NULL);
-
- src_w = gdk_pixbuf_get_width (src);
- src_h = gdk_pixbuf_get_height (src);
-
- tile_x = w / src_w; /* Number of full tiles */
- tile_y = h / src_h;
-
- left_x = w - tile_x * src_w;
- left_y = h - tile_y * src_h;
-
- dst_y = 0;
- dst = gdk_pixbuf_new (gdk_pixbuf_get_colorspace (src),
- gdk_pixbuf_get_has_alpha (src),
- gdk_pixbuf_get_bits_per_sample (src),
- MAX (w, 1),
- MAX (h, 1));
-
- for (stripe_y = -1; stripe_y <= tile_y; stripe_y++) {
- int dst_x = 0;
- int stripe_x;
- int this_h, start_y = 0;
-
- if (stripe_y == -1) {
- this_h = (left_y + 1) / 2;
- start_y = src_h - this_h;
- } else if (stripe_y == tile_y)
- this_h = left_y / 2;
- else
- this_h = src_h;
-
- if (this_h == 0)
- continue;
-
- for (stripe_x = -1; stripe_x <= tile_x; stripe_x++) {
- int this_w, start_x = 0;
-
- if (stripe_x == -1) {
- this_w = (left_x + 1) / 2;
- start_x = src_w - this_w;
- } else if (stripe_x == tile_x)
- this_w = left_x / 2;
- else
- this_w = src_w;
-
- if (this_w == 0)
- continue;
-
- gdk_pixbuf_copy_area (src, start_x, start_y,
- this_w, this_h,
- dst,
- dst_x, dst_y);
-
- dst_x += this_w;
- }
-
- dst_y += this_h;
- }
-
- return dst;
-}
-
/* GOPixbuf implementation */
-
struct _GOPixbuf {
GOImage parent;
unsigned rowstride;
diff --git a/goffice/utils/go-pixbuf.h b/goffice/utils/go-pixbuf.h
index f07872b..bd57c24 100644
--- a/goffice/utils/go-pixbuf.h
+++ b/goffice/utils/go-pixbuf.h
@@ -1,5 +1,7 @@
/*
- * go-pixbuf.h - Misc GdkPixbuf utilities
+ * go-pixbuf.h
+ *
+ * Copyright (C) 2011-2012 Jean Brefort (jean brefort normalesup org)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
@@ -25,13 +27,6 @@
G_BEGIN_DECLS
-GdkPixbuf *go_gdk_pixbuf_intelligent_scale (GdkPixbuf *buf,
- guint width, guint height);
-GdkPixbuf *go_gdk_pixbuf_new_from_file (char const *filename);
-GdkPixbuf *go_gdk_pixbuf_get_from_cache (char const *filename);
-GdkPixbuf *go_gdk_pixbuf_tile (GdkPixbuf const *src,
- guint w, guint h);
-
#define GO_TYPE_PIXBUF (go_pixbuf_get_type ())
#define GO_PIXBUF(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GO_TYPE_PIXBUF, GOPixbuf))
#define GO_IS_PIXBUF(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GO_TYPE_PIXBUF))
diff --git a/goffice/utils/go-rsm.c b/goffice/utils/go-rsm.c
index bb912a8..d7407a7 100644
--- a/goffice/utils/go-rsm.c
+++ b/goffice/utils/go-rsm.c
@@ -74,6 +74,13 @@ go_rsm_unregister_file (const char *id)
g_hash_table_remove (rsm, id);
}
+/**
+ * go_rsm_lookup:
+ * @id: resource name
+ * @len: where to store the resource size in bytes
+ *
+ * Returns: (transfer full): the resource or %NULL if not found
+ **/
gconstpointer
go_rsm_lookup (const char *id, size_t *len)
{
diff --git a/goffice/utils/go-style.c b/goffice/utils/go-style.c
index 61ddf7a..b5d100e 100644
--- a/goffice/utils/go-style.c
+++ b/goffice/utils/go-style.c
@@ -113,7 +113,7 @@ create_go_combo_color (StylePrefState *state,
{
GtkWidget *w;
- w = go_color_selector_new (initial_color, automatic_color, group);
+ w = go_selector_new_color (initial_color, automatic_color, group);
gtk_widget_set_halign (w, GTK_ALIGN_START);
gtk_label_set_mnemonic_widget (
GTK_LABEL (gtk_builder_get_object (gui, label_name)), w);
@@ -209,7 +209,7 @@ outline_init (StylePrefState *state, gboolean enable, GOEditor *editor)
}
/* DashType */
- w = go_line_dash_selector_new (style->line.dash_type,
+ w = go_selector_new_line_dash (style->line.dash_type,
default_style->line.dash_type);
gtk_widget_set_halign (w, GTK_ALIGN_START);
gtk_grid_attach (GTK_GRID (grid), w, 1, 0, 2, 1);
@@ -284,7 +284,7 @@ line_init (StylePrefState *state, gboolean enable, GOEditor *editor)
go_editor_register_widget (editor, grid);
/* DashType */
- w = go_line_dash_selector_new (style->line.dash_type,
+ w = go_selector_new_line_dash (style->line.dash_type,
default_style->line.dash_type);
gtk_widget_set_halign (w, GTK_ALIGN_START);
gtk_grid_attach (GTK_GRID (grid), w, 1, 0, 2, 1);
@@ -405,7 +405,7 @@ fill_gradient_init (StylePrefState *state)
GtkWidget *label;
state->fill.gradient.selector = selector =
- go_gradient_selector_new (style->fill.gradient.dir,
+ go_selector_new_gradient (style->fill.gradient.dir,
style->fill.gradient.dir);
go_gradient_selector_set_colors (GO_SELECTOR (selector),
style->fill.pattern.back,
@@ -744,7 +744,7 @@ marker_init (StylePrefState *state, gboolean enable, GOEditor *editor, GOCmdCont
if (!enable)
return;
- gui = go_gtk_builder_new_internal ("res:go:utils/go-style-prefs.ui", GETTEXT_PACKAGE, cc);
+ gui = go_gtk_builder_load_internal ("res:go:utils/go-style-prefs.ui", GETTEXT_PACKAGE, cc);
if (gui == NULL)
return;
@@ -858,7 +858,7 @@ font_init (StylePrefState *state, guint32 enable, GOEditor *editor, GOCmdContext
g_return_if_fail (style->font.font != NULL);
- gui = go_gtk_builder_new_internal ("res:go:utils/go-style-prefs.ui", GETTEXT_PACKAGE, cc);
+ gui = go_gtk_builder_load_internal ("res:go:utils/go-style-prefs.ui", GETTEXT_PACKAGE, cc);
if (gui == NULL)
return;
@@ -1034,7 +1034,7 @@ go_style_populate_editor (GOStyle *style,
state->doc = NULL;
if ((enable & (GO_STYLE_OUTLINE | GO_STYLE_LINE | GO_STYLE_FILL)) != 0) {
- gui = go_gtk_builder_new_internal ("res:go:utils/go-style-prefs.ui", GETTEXT_PACKAGE, cc);
+ gui = go_gtk_builder_load_internal ("res:go:utils/go-style-prefs.ui", GETTEXT_PACKAGE, cc);
if (gui == NULL) {
g_free (state);
return;
@@ -1064,6 +1064,16 @@ go_style_populate_editor (GOStyle *style,
}
}
+/**
+ * go_style_get_editor:
+ * @style: #GOStyle
+ * @default_style: the style used as default
+ * @cc: #GOCmdContext
+ * @object_with_style: the object owning the style
+ *
+ * Builds the widget used to edit the style.
+ * Returns: (transfer full): the style editor
+ **/
gpointer
go_style_get_editor (GOStyle *style,
GOStyle *default_style,
@@ -1097,7 +1107,7 @@ go_style_new (void)
*
* Duplicates @style.
*
- * return value: a new #GOStyle
+ * Returns: (transfer full): a new #GOStyle
**/
GOStyle *
go_style_dup (GOStyle const *src)
@@ -1793,7 +1803,7 @@ go_style_set_marker (GOStyle *style, GOMarker *marker)
*
* Accessor for @style::marker, without referencing it.
*
- * return value: the style #GOMarker.
+ * Returns: (transfer none): the style #GOMarker.
**/
GOMarker const *
go_style_get_marker (GOStyle *style)
diff --git a/goffice/utils/go-styled-object.c b/goffice/utils/go-styled-object.c
index 2949695..832db08 100644
--- a/goffice/utils/go-styled-object.c
+++ b/goffice/utils/go-styled-object.c
@@ -121,7 +121,7 @@ go_styled_object_set_style (GOStyledObject *gso, GOStyle *style)
*
* Simply an accessor function that returns @gso->style, without referencing it.
*
- * return value: the styled object's #GOStyle
+ * Returns: (transfer none): the styled object's #GOStyle
**/
GOStyle*
go_styled_object_get_style (GOStyledObject *gso)
@@ -139,7 +139,7 @@ go_styled_object_get_style (GOStyledObject *gso)
* This function returns a new style that is initialized with the auto values for @gso.
* Caller is responsible for the result.
*
- * return value: a new #GOStyle
+ * Returns: (transfer full): a new #GOStyle
**/
GOStyle*
go_styled_object_get_auto_style (GOStyledObject *gso)
@@ -189,7 +189,7 @@ go_styled_object_apply_theme (GOStyledObject *gso, GOStyle *style)
*
* A #GODoc is necessary to store images. If no GODoc is associated with the
* object, image filling will not be supported.
- * return value: the #GODoc associated with the object if any.
+ * Returns: (transfer none): he #GODoc associated with the object if any.
**/
GODoc*
diff --git a/goffice/utils/go-undo.c b/goffice/utils/go-undo.c
index 6c3c2ce..873eb11 100644
--- a/goffice/utils/go-undo.c
+++ b/goffice/utils/go-undo.c
@@ -70,7 +70,7 @@ go_undo_undo (GOUndo *u)
* of the result to the caller. Either argument may be NULL in which case the
* other is returned.
*
- * Returns: the combination of two undo operations.
+ * Returns: (transfer full): the combination of two undo operations.
**/
GOUndo *
go_undo_combine (GOUndo *a, GOUndo *b)
@@ -217,14 +217,14 @@ GSF_CLASS (GOUndoBinary, go_undo_binary,
* go_undo_binary_new:
* @a: first argument for undo operation
* @b: second argument for undo operation
- * @undo: function to call with arguments @a and @b for undo.
- * @fa: optional function to free @a.
- * @fb: optional function to free @b.
+ * @undo: (scope async): function to call with arguments @a and @b for undo.
+ * @fa: (scope async): optional function to free @a.
+ * @fb: (scope async): optional function to free @b.
*
* This function creates a new undo object for undo operations of two
* arguments. (In addition, an undo-time argument is added for context.)
*
- * Returns: a new undo object.
+ * Returns: (transfer full): a new undo object.
**/
GOUndo *
go_undo_binary_new (gpointer a, gpointer b, GOUndoBinaryFunc undo,
@@ -280,13 +280,13 @@ GSF_CLASS (GOUndoUnary, go_undo_unary,
/**
* go_undo_unary_new:
* @a: argument for undo operation
- * @undo: function to call with argument @a for undo.
- * @fa: optional function to free @a.
+ * @undo: (scope async): function to call with argument @a for undo.
+ * @fa: (scope async): optional function to free @a.
*
* This function creates a new undo object for undo operations of one
* argument. (In addition, an undo-time argument is added for context.)
*
- * Returns: a new undo object.
+ * Returns: (transfer full): a new undo object.
**/
GOUndo *
go_undo_unary_new (gpointer a, GOUndoUnaryFunc undo, GFreeFunc fa)
diff --git a/goffice/utils/goffice-utils.h b/goffice/utils/goffice-utils.h
index ffa039d..42a975d 100644
--- a/goffice/utils/goffice-utils.h
+++ b/goffice/utils/goffice-utils.h
@@ -116,6 +116,7 @@ G_END_DECLS
#include <goffice/utils/go-format.h>
#include <goffice/utils/go-geometry.h>
#include <goffice/utils/go-glib-extras.h>
+#include <goffice/utils/go-gdk-pixbuf.h>
#include <goffice/utils/go-gradient.h>
#include <goffice/utils/go-image.h>
#include <goffice/utils/go-pixbuf.h>
diff --git a/plugins/plot_barcol/gog-barcol-prefs.c b/plugins/plot_barcol/gog-barcol-prefs.c
index fdea6ed..30c630a 100644
--- a/plugins/plot_barcol/gog-barcol-prefs.c
+++ b/plugins/plot_barcol/gog-barcol-prefs.c
@@ -49,7 +49,7 @@ gog_barcol_plot_pref (GogBarColPlot *barcol, GOCmdContext *cc)
{
GtkWidget *w;
GtkBuilder *gui =
- go_gtk_builder_new ("res:go:plot_barcol/gog-barcol-prefs.ui",
+ go_gtk_builder_load ("res:go:plot_barcol/gog-barcol-prefs.ui",
GETTEXT_PACKAGE, cc);
if (gui == NULL)
return NULL;
diff --git a/plugins/plot_barcol/gog-dropbar.c b/plugins/plot_barcol/gog-dropbar.c
index 5e9c838..ca1f83d 100644
--- a/plugins/plot_barcol/gog-dropbar.c
+++ b/plugins/plot_barcol/gog-dropbar.c
@@ -88,7 +88,7 @@ gog_dropbar_populate_editor (GogObject *obj,
{
#ifdef GOFFICE_WITH_GTK
GtkBuilder *gui =
- go_gtk_builder_new ("res:go:plot_barcol/gog-area-prefs.ui",
+ go_gtk_builder_load ("res:go:plot_barcol/gog-area-prefs.ui",
GETTEXT_PACKAGE, cc);
if (gui != NULL) {
GtkWidget *w = go_gtk_builder_get_widget (gui, "before-grid");
diff --git a/plugins/plot_barcol/gog-line.c b/plugins/plot_barcol/gog-line.c
index f36c41b..29b61aa 100644
--- a/plugins/plot_barcol/gog-line.c
+++ b/plugins/plot_barcol/gog-line.c
@@ -409,7 +409,7 @@ gog_area_plot_populate_editor (GogObject *obj,
{
#ifdef GOFFICE_WITH_GTK
GtkBuilder *gui =
- go_gtk_builder_new ("res:go:plot_barcol/gog-area-prefs.ui",
+ go_gtk_builder_load ("res:go:plot_barcol/gog-area-prefs.ui",
GETTEXT_PACKAGE, cc);
if (gui != NULL) {
GtkWidget *w = go_gtk_builder_get_widget (gui, "before-grid");
diff --git a/plugins/plot_barcol/gog-minmax.c b/plugins/plot_barcol/gog-minmax.c
index 92faf6e..20691a0 100644
--- a/plugins/plot_barcol/gog-minmax.c
+++ b/plugins/plot_barcol/gog-minmax.c
@@ -178,7 +178,7 @@ gog_minmax_plot_populate_editor (GogObject *item,
{
GogMinMaxPlot *minmax = GOG_MINMAX_PLOT (item);
GtkBuilder *gui =
- go_gtk_builder_new ("res:go:plot_barcol/gog-minmax-prefs.ui",
+ go_gtk_builder_load ("res:go:plot_barcol/gog-minmax-prefs.ui",
GETTEXT_PACKAGE, cc);
GtkWidget *w;
diff --git a/plugins/plot_distrib/gog-boxplot.c b/plugins/plot_distrib/gog-boxplot.c
index 31b2ca5..5522a42 100644
--- a/plugins/plot_distrib/gog-boxplot.c
+++ b/plugins/plot_distrib/gog-boxplot.c
@@ -112,7 +112,7 @@ gog_box_plot_pref (GogObject *obj,
{
GogBoxPlot *boxplot = GOG_BOX_PLOT (obj);
GtkBuilder *gui =
- go_gtk_builder_new ("res:go:plot_distrib/gog-boxplot-prefs.ui",
+ go_gtk_builder_load ("res:go:plot_distrib/gog-boxplot-prefs.ui",
GETTEXT_PACKAGE, cc);
GtkWidget *w;
diff --git a/plugins/plot_distrib/gog-histogram.c b/plugins/plot_distrib/gog-histogram.c
index c18dda1..604b11b 100644
--- a/plugins/plot_distrib/gog-histogram.c
+++ b/plugins/plot_distrib/gog-histogram.c
@@ -311,7 +311,7 @@ gog_histogram_plot_populate_editor (GogObject *item,
GtkWidget *w;
GogHistogramPlot *hist = GOG_HISTOGRAM_PLOT (item);
GtkBuilder *gui =
- go_gtk_builder_new ("res:go:plot_distrib/gog-histogram-prefs.ui",
+ go_gtk_builder_load ("res:go:plot_distrib/gog-histogram-prefs.ui",
GETTEXT_PACKAGE, cc);
if (gui != NULL) {
w = go_gtk_builder_get_widget (gui, "vertical");
@@ -429,7 +429,7 @@ gog_double_histogram_plot_populate_editor (GogObject *gobj,
GtkWidget *w;
GogDataset *set = GOG_DATASET (gobj);
GtkBuilder *gui =
- go_gtk_builder_new ("res:go:plot_distrib/gog-double-histogram-prefs.ui",
+ go_gtk_builder_load ("res:go:plot_distrib/gog-double-histogram-prefs.ui",
GETTEXT_PACKAGE, cc);
if (gui != NULL) {
table = GTK_TABLE (gtk_builder_get_object (gui, "double-histogram-prefs"));
diff --git a/plugins/plot_pie/gog-pie-prefs.c b/plugins/plot_pie/gog-pie-prefs.c
index ac5808c..08af2c0 100644
--- a/plugins/plot_pie/gog-pie-prefs.c
+++ b/plugins/plot_pie/gog-pie-prefs.c
@@ -37,7 +37,7 @@ GtkWidget *
gog_pie_series_element_pref (GogPieSeriesElement *element, GOCmdContext *cc)
{
GtkBuilder *gui =
- go_gtk_builder_new ("res:go:plot_pie/gog-pie-series.ui",
+ go_gtk_builder_load ("res:go:plot_pie/gog-pie-series.ui",
GETTEXT_PACKAGE, cc);
GtkWidget *w;
if (gui == NULL)
@@ -150,7 +150,7 @@ GtkWidget *
gog_pie_plot_pref (GogPiePlot *pie, GOCmdContext *cc)
{
GtkBuilder *gui =
- go_gtk_builder_new ("res:go:plot_pie/gog-pie-prefs.ui",
+ go_gtk_builder_load ("res:go:plot_pie/gog-pie-prefs.ui",
GETTEXT_PACKAGE, cc);
GtkWidget *w;
PiePrefState *state;
@@ -191,7 +191,7 @@ GtkWidget *
gog_ring_plot_pref (GogRingPlot *ring, GOCmdContext *cc)
{
GtkBuilder *gui =
- go_gtk_builder_new ("res:go:plot_pie/gog-ring-prefs.ui",
+ go_gtk_builder_load ("res:go:plot_pie/gog-ring-prefs.ui",
GETTEXT_PACKAGE, cc);
GtkWidget *w;
PiePrefState *state;
diff --git a/plugins/plot_radar/gog-radar.c b/plugins/plot_radar/gog-radar.c
index d145964..ffdcd3c 100644
--- a/plugins/plot_radar/gog-radar.c
+++ b/plugins/plot_radar/gog-radar.c
@@ -394,7 +394,7 @@ gog_polar_area_populate_editor (GogObject *obj,
#ifdef GOFFICE_WITH_GTK
GogObjectClass *gog_class = (GogObjectClass *) g_type_class_peek_parent (G_OBJECT_GET_CLASS (obj));
GtkBuilder *gui =
- go_gtk_builder_new ("res:go:plot_radar/gog-polar-prefs.ui",
+ go_gtk_builder_load ("res:go:plot_radar/gog-polar-prefs.ui",
GETTEXT_PACKAGE, cc);
if (gui != NULL) {
@@ -582,7 +582,7 @@ gog_color_polar_plot_populate_editor (GogObject *obj,
{
#ifdef GOFFICE_WITH_GTK
GtkBuilder *gui =
- go_gtk_builder_new ("res:go:plot_radar/gog-color-polar-prefs.ui",
+ go_gtk_builder_load ("res:go:plot_radar/gog-color-polar-prefs.ui",
GETTEXT_PACKAGE, cc);
if (gui != NULL) {
GtkWidget *w = go_gtk_builder_get_widget (gui, "hide-outliers");
diff --git a/plugins/plot_surface/gog-xyz-prefs.c b/plugins/plot_surface/gog-xyz-prefs.c
index ff2629b..bd9575b 100644
--- a/plugins/plot_surface/gog-xyz-prefs.c
+++ b/plugins/plot_surface/gog-xyz-prefs.c
@@ -39,7 +39,7 @@ gog_xyz_plot_pref (GogXYZPlot *plot, GOCmdContext *cc)
{
GtkWidget *w;
GtkBuilder *gui =
- go_gtk_builder_new ("res:go:plot_surface/gog-xyz-prefs.ui",
+ go_gtk_builder_load ("res:go:plot_surface/gog-xyz-prefs.ui",
GETTEXT_PACKAGE, cc);
if (gui == NULL)
return NULL;
diff --git a/plugins/plot_surface/gog-xyz-surface-prefs.c b/plugins/plot_surface/gog-xyz-surface-prefs.c
index 15d0768..17670ef 100644
--- a/plugins/plot_surface/gog-xyz-surface-prefs.c
+++ b/plugins/plot_surface/gog-xyz-surface-prefs.c
@@ -93,7 +93,7 @@ gog_xyz_surface_plot_pref (GogXYZPlot *plot, GogDataAllocator *dalloc, GOCmdCont
XYZSurfPrefsState *state;
GtkWidget *w, *grid;
GtkBuilder *gui =
- go_gtk_builder_new ("res:go:plot_surface/gog-xyz-surface-prefs.ui",
+ go_gtk_builder_load ("res:go:plot_surface/gog-xyz-surface-prefs.ui",
GETTEXT_PACKAGE, cc);
if (gui == NULL)
diff --git a/plugins/plot_xy/gog-bubble-prefs.c b/plugins/plot_xy/gog-bubble-prefs.c
index a8b6b23..fc6e37a 100644
--- a/plugins/plot_xy/gog-bubble-prefs.c
+++ b/plugins/plot_xy/gog-bubble-prefs.c
@@ -68,7 +68,7 @@ gog_bubble_plot_pref (GogBubblePlot *bubble, GOCmdContext *cc)
{
GtkWidget *w;
GtkBuilder *gui =
- go_gtk_builder_new ("res:go:plot_xy/gog-bubble-prefs.ui",
+ go_gtk_builder_load ("res:go:plot_xy/gog-bubble-prefs.ui",
GETTEXT_PACKAGE, cc);
if (gui == NULL)
diff --git a/plugins/plot_xy/gog-xy-dropbar.c b/plugins/plot_xy/gog-xy-dropbar.c
index e9b6e0b..d9d912d 100644
--- a/plugins/plot_xy/gog-xy-dropbar.c
+++ b/plugins/plot_xy/gog-xy-dropbar.c
@@ -130,7 +130,7 @@ gog_xy_dropbar_populate_editor (GogObject *obj,
#ifdef GOFFICE_WITH_GTK
GogXYDropBarPlot *dropbar = GOG_XY_DROPBAR_PLOT (obj);
GtkBuilder *gui =
- go_gtk_builder_new ("res:go:plot_xy/gog-xy-dropbar-prefs.ui",
+ go_gtk_builder_load ("res:go:plot_xy/gog-xy-dropbar-prefs.ui",
GETTEXT_PACKAGE, cc);
if (gui != NULL) {
diff --git a/plugins/plot_xy/gog-xy.c b/plugins/plot_xy/gog-xy.c
index 4fd9fb3..bea0306 100644
--- a/plugins/plot_xy/gog-xy.c
+++ b/plugins/plot_xy/gog-xy.c
@@ -357,7 +357,7 @@ gog_xy_plot_populate_editor (GogObject *obj,
{
#ifdef GOFFICE_WITH_GTK
GtkBuilder *gui =
- go_gtk_builder_new ("res:go:plot_xy/gog-xy-prefs.ui",
+ go_gtk_builder_load ("res:go:plot_xy/gog-xy-prefs.ui",
GETTEXT_PACKAGE, cc);
if (gui != NULL) {
@@ -740,7 +740,7 @@ gog_xy_color_plot_populate_editor (GogObject *obj,
{
#ifdef GOFFICE_WITH_GTK
GtkBuilder *gui =
- go_gtk_builder_new ("res:go:plot_xy/gog-xy-color-prefs.ui",
+ go_gtk_builder_load ("res:go:plot_xy/gog-xy-color-prefs.ui",
GETTEXT_PACKAGE, cc);
if (gui != NULL) {
@@ -2092,7 +2092,7 @@ gog_xy_series_populate_editor (GogObject *obj,
GogXYSeries *series;
GtkWidget *w;
GtkBuilder *gui =
- go_gtk_builder_new ("res:go:plot_xy/gog-xy-series-prefs.ui",
+ go_gtk_builder_load ("res:go:plot_xy/gog-xy-series-prefs.ui",
GETTEXT_PACKAGE, cc);
(GOG_OBJECT_CLASS(series_parent_klass)->populate_editor) (obj, editor, dalloc, cc);
diff --git a/plugins/smoothing/gog-exp-smooth.c b/plugins/smoothing/gog-exp-smooth.c
index 9bc175a..47af943 100644
--- a/plugins/smoothing/gog-exp-smooth.c
+++ b/plugins/smoothing/gog-exp-smooth.c
@@ -56,7 +56,7 @@ gog_exp_smooth_populate_editor (GogObject *obj,
GogExpSmooth *es = GOG_EXP_SMOOTH (obj);
GogDataset *set = GOG_DATASET (obj);
GtkBuilder *gui =
- go_gtk_builder_new ("res:go:smoothing/gog-exp-smooth.ui",
+ go_gtk_builder_load ("res:go:smoothing/gog-exp-smooth.ui",
GETTEXT_PACKAGE, cc);
GtkWidget *label, *box, *w = go_gtk_builder_get_widget (gui, "steps");
GtkTable *table;
diff --git a/plugins/smoothing/gog-moving-avg.c b/plugins/smoothing/gog-moving-avg.c
index edb97d2..ff4660d 100644
--- a/plugins/smoothing/gog-moving-avg.c
+++ b/plugins/smoothing/gog-moving-avg.c
@@ -97,7 +97,7 @@ gog_moving_avg_populate_editor (GogObject *obj,
{
GogMovingAvg *ma = GOG_MOVING_AVG (obj);
GtkBuilder *gui =
- go_gtk_builder_new ("res:go:smoothing/gog-moving-avg.ui",
+ go_gtk_builder_load ("res:go:smoothing/gog-moving-avg.ui",
GETTEXT_PACKAGE, cc);
GtkWidget *w = go_gtk_builder_get_widget (gui, "span");
gtk_widget_set_tooltip_text (w, _("Number of values from which to calculate an average"));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]