[goffice] Add introspection support. [#670161]



commit 1544d70db7306fb55e5d19f1bb730eb830245c27
Author: Jean Brefort <jean brefort normalesup org>
Date:   Thu Mar 8 14:38:15 2012 +0100

    Add introspection support. [#670161]

 ChangeLog                             |   11 ++++++++
 NEWS                                  |    3 ++
 configure.in                          |   23 +++++++++++++++++
 goffice/Makefile.am                   |   43 +++++++++++++++++++++++++++++++++
 goffice/app/go-plugin-loader-module.h |    5 ++-
 goffice/canvas/goc-component.c        |    7 +++++
 goffice/utils/go-font.c               |    2 +-
 goffice/utils/go-format.c             |    4 +-
 goffice/utils/go-glib-extras.c        |   22 +++++++++-------
 goffice/utils/go-style.h              |    6 ++--
 10 files changed, 108 insertions(+), 18 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index de1a7fb..ea77201 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2012-03-08  Jean Brefort  <jean brefort normalesup org>
+
+	* configure.in: add introspection support. [#670161]
+	* goffice/Makefile.am: ditto.
+	* goffice/app/go-plugin-loader-module.h: ditto.
+	* goffice/canvas/goc-component.c: fixed introspection warnings.
+	* goffice/utils/go-font.c: ditto.
+	* goffice/utils/go-format.c: ditto.
+	* goffice/utils/go-glib-extras.c: ditto.
+	* goffice/utils/go-style.h: reversed some previous unneeded changes.
+
 2012-03-07  Morten Welinder  <terra gnome org>
 
 	* goffice/utils/go-format.c (cb_attrs_as_string): Tweak handling
diff --git a/NEWS b/NEWS
index b45833e..c2ba06f 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,8 @@
 goffice 0.9.3:
 
+Jean:
+	* Add introspection support. [#670161]
+
 Morten:
 	* Fix GOImage fallback for non-GUI case.
 	* Tweak bold attribute for rich text.
diff --git a/configure.in b/configure.in
index c8b7b2f..baddfab 100644
--- a/configure.in
+++ b/configure.in
@@ -602,6 +602,29 @@ AC_SUBST(EXTRA_LIBS)
 AC_SUBST(EXTRA_INCLUDES)
 AC_SUBST(EXTRA_DEPS)
 
+# GObject Introspection
+have_introspection=false
+PKG_CHECK_MODULES(INTROSPECTION, gobject-introspection-1.0 >= 1.31.10, have_introspection=true, have_introspection=false)
+AM_CONDITIONAL(HAVE_INTROSPECTION, $have_introspection)
+
+G_IR_SCANNER=
+G_IR_COMPILER=
+G_IR_GENERATE=
+GIRDIR=
+TYPELIBDIR=
+if $have_introspection; then
+   G_IR_SCANNER=`$PKG_CONFIG --variable=g_ir_scanner gobject-introspection-1.0`
+   G_IR_COMPILER=`$PKG_CONFIG --variable=g_ir_compiler gobject-introspection-1.0`
+   G_IR_GENERATE=`$PKG_CONFIG --variable=g_ir_generate gobject-introspection-1.0`
+   GIRDIR=`$PKG_CONFIG --variable=girdir gobject-introspection-1.0`
+   TYPELIBDIR="$($PKG_CONFIG --variable=typelibdir gobject-introspection-1.0)"
+fi
+AC_SUBST(G_IR_SCANNER)
+AC_SUBST(G_IR_COMPILER)
+AC_SUBST(G_IR_GENERATE)
+AC_SUBST(GIRDIR)
+AC_SUBST(TYPELIBDIR)
+
 dnl ******************
 dnl * Config defaults
 dnl ******************
diff --git a/goffice/Makefile.am b/goffice/Makefile.am
index e8ada78..3c09408 100644
--- a/goffice/Makefile.am
+++ b/goffice/Makefile.am
@@ -129,3 +129,46 @@ embedded-stuff.c: $(top_srcdir)/tools/embedder $(embedded_stuff)
 		COMPRESS $(embedded_stuff_compress) \
 		NOCOMPRESS $(embedded_stuff_raw) \
 		>$(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: $(G_IR_SCANNER)
+	$(AM_V_GEN) $(G_IR_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 $@ \
+	    --pkg libgoffice- GOFFICE_API_VER@ \
+	    -I$(top_srcdir) \
+	    `cat $(srcdir)/list_of_sources`
+
+if HAVE_INTROSPECTION
+
+girdir = $(GIRDIR)
+gir_DATA = $(BUILT_GIRSOURCES)
+
+typelibsdir = $(TYPELIBDIR)
+typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib)
+
+%.typelib: %.gir $(G_IR_COMPILER)
+	$(AM_V_GEN) LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}. $(G_IR_COMPILER) --includedir=$(srcdir) --includedir=. $(G_IR_COMPILER_OPTS) $< -o $(builddir)/$(@F)
+
+endif # HAVE_INTROSPECTION
diff --git a/goffice/app/go-plugin-loader-module.h b/goffice/app/go-plugin-loader-module.h
index 588aefb..9eace2e 100644
--- a/goffice/app/go-plugin-loader-module.h
+++ b/goffice/app/go-plugin-loader-module.h
@@ -13,14 +13,15 @@ G_BEGIN_DECLS
 #define GO_PLUGIN_LOADER_MODULE_CLASS(k)	(G_TYPE_CHECK_CLASS_CAST ((k), GO_TYPE_PLUGIN_LOADER_MODULE, GOPluginLoaderModuleClass))
 #define GO_IS_PLUGIN_LOADER_MODULE_CLASS(k)	(G_TYPE_CHECK_CLASS_TYPE ((k), GO_TYPE_PLUGIN_LOADER_MODULE))
 
+typedef void (*GOPluginMethod) (GOPlugin *plugin, GOCmdContext *cc);
 typedef struct {
 	GObject	base;
 
 	gchar *module_file_name;
 	GModule *handle;
 
-	void (*plugin_init)	(GOPlugin *plugin, GOCmdContext *cc);
-	void (*plugin_shutdown) (GOPlugin *plugin, GOCmdContext *cc);
+	GOPluginMethod plugin_init;
+	GOPluginMethod plugin_shutdown;
 } GOPluginLoaderModule;
 typedef GObjectClass GOPluginLoaderModuleClass;
 
diff --git a/goffice/canvas/goc-component.c b/goffice/canvas/goc-component.c
index 9e305d2..d1965ba 100644
--- a/goffice/canvas/goc-component.c
+++ b/goffice/canvas/goc-component.c
@@ -312,6 +312,13 @@ GSF_CLASS (GocComponent, goc_component,
 	   goc_component_class_init, NULL,
 	   GOC_TYPE_ITEM)
 
+/**
+ * goc_component_get_object:
+ * @component: #GocComponent
+ *
+ * Returns: (transfer none): the embedded object.
+ */
+
 GOComponent * goc_component_get_object (GocComponent *component)
 {
 	g_return_val_if_fail (GOC_IS_COMPONENT (component), NULL);
diff --git a/goffice/utils/go-font.c b/goffice/utils/go-font.c
index 04f4717..89e801a 100644
--- a/goffice/utils/go-font.c
+++ b/goffice/utils/go-font.c
@@ -45,7 +45,7 @@ go_font_free (GOFont *font)
 
 /**
  * go_font_new_by_desc:
- * @desc : #PangoFontDescription
+ * @desc: #PangoFontDescription
  *
  * NOTE : Absorbs @desc.
  * Returns: a ref to a font that matches @desc.
diff --git a/goffice/utils/go-format.c b/goffice/utils/go-format.c
index 9622613..6288f42 100644
--- a/goffice/utils/go-format.c
+++ b/goffice/utils/go-format.c
@@ -5018,7 +5018,7 @@ _go_number_format_shutdown (void)
 
 /**
  * go_format_str_localize:
- * @str : A *valid* format string
+ * @str: A *valid* format string
  *
  * Localizes the given format string, i.e., changes decimal dots to the
  * locale's notion of that and performs other such transformations.
@@ -5134,7 +5134,7 @@ go_format_str_localize (char const *str)
 
 /**
  * go_format_str_delocalize:
- * @str : A *valid* localized format string
+ * @str: A *valid* localized format string
  *
  * De-localizes the given format string, i.e., changes locale's decimal
  * separators to dots and performs other such transformations.
diff --git a/goffice/utils/go-glib-extras.c b/goffice/utils/go-glib-extras.c
index 8f8605e..0273944 100644
--- a/goffice/utils/go-glib-extras.c
+++ b/goffice/utils/go-glib-extras.c
@@ -74,11 +74,11 @@ go_ptr_array_insert (GPtrArray *array, gpointer value, int index)
 /**
  * go_slist_create:
  * @item1: optionally %NULL
- * @Varargs : %NULL terminated list of additional items
+ * @Varargs: %NULL terminated list of additional items
  *
  * Creates a GList from NULL-terminated list of arguments.
- *
- * Returns: created list.
+ * As the arguments are just copied to the list, the caller owns them.
+ * Returns: (transfer container): created list.
  **/
 GSList *
 go_slist_create (gpointer item1, ...)
@@ -98,9 +98,11 @@ go_slist_create (gpointer item1, ...)
 
 /**
  * go_slist_map:
- * @list        : list of some items
- * @map_func    : mapping function
+ * @list: list of some items
+ * @map_func: mapping function
  *
+ * The ownership of the list elements depends on map_func.
+ * Returns: (transfer container): the mapped list
  **/
 GSList *
 go_slist_map (GSList const *list, GOMapFunc map_func)
@@ -740,7 +742,7 @@ go_guess_encoding (const char *raw, size_t len, const char *user_guess,
 static char *go_real_name = NULL;
 
 /**
- * go_get_real_name :
+ * go_get_real_name:
  *
  * Returns: a utf8 encoded string with the current user name.
  * 	Caller should _NOT_ free the result.
@@ -768,8 +770,8 @@ go_get_real_name (void)
 }
 
 /**
- * go_destroy_password :
- * @passwd : The buffer to clear
+ * go_destroy_password:
+ * @passwd: The buffer to clear
  *
  * Overwrite a string holding a password.  This is a separate routine to
  * ensure that the compiler does not try to outsmart us.
@@ -785,8 +787,8 @@ go_destroy_password (char *passwd)
 
 /**
  * go_object_toggle:
- * @object : #GObject
- * @property_name : name
+ * @object: #GObject
+ * @property_name: name
  *
  * Toggle a boolean object property.
  **/
diff --git a/goffice/utils/go-style.h b/goffice/utils/go-style.h
index 4b26330..66a57e6 100644
--- a/goffice/utils/go-style.h
+++ b/goffice/utils/go-style.h
@@ -90,7 +90,7 @@ struct _GOStyle {
 	GOStyleFlag	disable_theming;
 
 	GOStyleLine	line;
-	struct _GOStyle_Fill {
+	struct {
 		GOStyleFill	type;
 		gboolean	auto_type;
 		gboolean	auto_fore, auto_back;	/* share between pattern and gradient */
@@ -108,12 +108,12 @@ struct _GOStyle {
 		} image;
 	} fill;
 	GOStyleMark marker;
-	struct _GOStyle_Font {
+	struct {
 		GOColor		 color;
 		GOFont const 	*font;
 		gboolean 	 auto_scale;
 	} font;
-	struct _GOStyle_Text {
+	struct {
 		double		 angle;
 		gboolean	 auto_angle;
 	} text_layout;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]