[gnome-dictionary] Add GObject introspection support
- From: Juan R. Garcia Blanco <juanrgar src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-dictionary] Add GObject introspection support
- Date: Sat, 3 Jan 2015 21:45:49 +0000 (UTC)
commit 61c76f68f90cf85bd420208f47e1184e7997c859
Author: Juan R. GarcĂa Blanco <juanrgar gmail com>
Date: Fri Dec 26 10:43:43 2014 +0100
Add GObject introspection support
* Original patch by: Stefano Facchini
<stefano facchini gmail com>
* See https://bugzilla.gnome.org/show_bug.cgi?id=666541
configure.ac | 3 +++
libgdict/Makefile.am | 25 +++++++++++++++++++++++++
libgdict/gdict-client-context.c | 11 +++++------
libgdict/gdict-context.c | 6 +++---
libgdict/gdict-database-chooser.c | 6 +++---
libgdict/gdict-defbox.c | 6 +++---
libgdict/gdict-source-chooser.c | 12 ++++++------
libgdict/gdict-source-loader.c | 22 ++++++++++++----------
libgdict/gdict-source.c | 13 +++++++------
libgdict/gdict-speller.c | 2 +-
libgdict/gdict-strategy-chooser.c | 11 ++++++-----
libgdict/gdict-utils.c | 2 +-
12 files changed, 75 insertions(+), 44 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 52164e4..daccc8d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -157,6 +157,9 @@ PKG_CHECK_MODULES(GDICT,
glib-2.0 >= $GLIB_MIN_VERSION
gtk+-3.0 >= $GTK_MIN_VERSION)
+# Introspection
+GOBJECT_INTROSPECTION_CHECK([1.42.0])
+
AC_CONFIG_FILES([
Makefile
libgdict/Makefile
diff --git a/libgdict/Makefile.am b/libgdict/Makefile.am
index ea60bc1..e421c20 100644
--- a/libgdict/Makefile.am
+++ b/libgdict/Makefile.am
@@ -101,6 +101,31 @@ EXTRA_DIST = \
BUILT_SOURCES = $(gdict_built_files)
+# Introspection
+include $(INTROSPECTION_MAKEFILE)
+INTROSPECTION_GIRS =
+INTROSPECTION_SCANNER_ARGS = --warn-all
+
+if HAVE_INTROSPECTION
+INTROSPECTION_GIRS += Gdict-1.0.gir
+
+Gdict-1.0.gir: libgdict-1.0.la
+Gdict_1_0_gir_NAMESPACE = Gdict
+Gdict_1_0_gir_VERSION = 1.0
+Gdict_1_0_gir_INCLUDES = Gtk-3.0
+Gdict_1_0_gir_CFLAGS = $(INCLUDES)
+Gdict_1_0_gir_LIBS = libgdict-1.0.la
+Gdict_1_0_gir_FILES = $(libgdict_1_0_la_SOURCES)
+
+girdir = $(datadir)/gir-1.0
+gir_DATA = $(INTROSPECTION_GIRS)
+
+typelibdir = $(libdir)/girepository-1.0
+typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
+
+CLEANFILES += $(gir_DATA) $(typelib_DATA)
+endif
+
gdict-marshal.h: stamp-gdict-marshal.h
@true
stamp-gdict-marshal.h: gdict-marshal.list $(GLIB_GENMARSHAL) Makefile
diff --git a/libgdict/gdict-client-context.c b/libgdict/gdict-client-context.c
index 6818869..407a6d0 100644
--- a/libgdict/gdict-client-context.c
+++ b/libgdict/gdict-client-context.c
@@ -502,8 +502,8 @@ gdict_client_context_finalize (GObject *object)
/**
* gdict_client_context_new:
- * @hostname: the hostname of a dictionary server, or %NULL for the
- * default server
+ * @hostname: (nullable): the hostname of a dictionary server,
+ * or %NULL for the default server
* @port: port to be used when connecting to the dictionary server,
* or -1 for the default port
*
@@ -511,8 +511,7 @@ gdict_client_context_finalize (GObject *object)
* object to connect and query the dictionary server using the Dictionary
* Protocol as defined by RFC 2229.
*
- * Return value: the newly created #GdictClientContext object. You should
- * free it using g_object_unref().
+ * Return value: (transfer full): the newly created #GdictClientContext object.
*/
GdictContext *
gdict_client_context_new (const gchar *hostname,
@@ -528,7 +527,7 @@ gdict_client_context_new (const gchar *hostname,
/**
* gdict_client_context_set_hostname:
* @context: a #GdictClientContext
- * @hostname: the hostname of a Dictionary server, or %NULL
+ * @hostname: (nullable): the hostname of a Dictionary server, or %NULL
*
* Sets @hostname as the hostname of the dictionary server to be used.
* If @hostname is %NULL, the default dictionary server will be used.
@@ -609,7 +608,7 @@ gdict_client_context_get_port (GdictClientContext *context)
/**
* gdict_client_context_set_client:
* @context: a #GdictClientContext
- * @client: the client name to use, or %NULL
+ * @client: (nullable): the client name to use, or %NULL
*
* Sets @client as the client name to be used when advertising ourselves when
* a connection the the dictionary server has been established.
diff --git a/libgdict/gdict-context.c b/libgdict/gdict-context.c
index dcf7fd6..83783bd 100644
--- a/libgdict/gdict-context.c
+++ b/libgdict/gdict-context.c
@@ -330,9 +330,9 @@ gdict_context_lookup_strategies (GdictContext *context,
/**
* gdict_context_match_word:
* @context: a #GdictContext
- * @database: a database name to search into, or %NULL for the
+ * @database: (nullable): a database name to search into, or %NULL for the
* default database
- * @strategy: a strategy name to use for matching, or %NULL for
+ * @strategy: (nullable): a strategy name to use for matching, or %NULL for
* the default strategy
* @word: the word to match
* @error: return location for a #GError, or %NULL
@@ -374,7 +374,7 @@ gdict_context_match_word (GdictContext *context,
/**
* gdict_context_define_word:
* @context: a #GdictContext
- * @database: a database name to search into, or %NULL for the
+ * @database: (nullable): a database name to search into, or %NULL for the
* default database
* @word: the word to search
* @error: return location for a #GError, or %NULL
diff --git a/libgdict/gdict-database-chooser.c b/libgdict/gdict-database-chooser.c
index d7ab898..5479082 100644
--- a/libgdict/gdict-database-chooser.c
+++ b/libgdict/gdict-database-chooser.c
@@ -547,7 +547,7 @@ gdict_database_chooser_new_with_context (GdictContext *context)
*
* Retrieves the #GdictContext used by @chooser.
*
- * Return value: a #GdictContext or %NULL
+ * Return value: (transfer none): a #GdictContext or %NULL
*
* Since: 0.10
*/
@@ -588,7 +588,7 @@ gdict_database_chooser_set_context (GdictDatabaseChooser *chooser,
*
* Gets the list of available database names.
*
- * Return value: a newly allocated, %NULL terminated string vector
+ * Return value: (transfer full): a newly allocated, %NULL terminated string vector
* containing database names. Use g_strfreev() to deallocate it.
*
* Since: 0.10
@@ -1110,7 +1110,7 @@ gdict_database_chooser_get_current_database (GdictDatabaseChooser *chooser)
* the bottom of @chooser. The @button_text can also be a
* stock ID.
*
- * Return value: the newly packed button.
+ * Return value: (transfer none): the newly packed button.
*
* Since: 0.10
*/
diff --git a/libgdict/gdict-defbox.c b/libgdict/gdict-defbox.c
index 1f373a7..92b8cbd 100644
--- a/libgdict/gdict-defbox.c
+++ b/libgdict/gdict-defbox.c
@@ -1992,7 +1992,7 @@ gdict_defbox_set_context (GdictDefbox *defbox,
*
* Gets the #GdictContext used by @defbox.
*
- * Return value: a #GdictContext.
+ * Return value: (transfer none): a #GdictContext.
*
* Since: 0.1
*/
@@ -2783,7 +2783,7 @@ gdict_defbox_jump_to_definition (GdictDefbox *defbox,
/**
* gdict_defbox_get_text:
* @defbox: a #GdictDefbox
- * @length: return location for the text length or %NULL
+ * @length: (out) (optional): return location for the text length or %NULL
*
* Gets the full contents of @defbox.
*
@@ -2819,7 +2819,7 @@ gdict_defbox_get_text (GdictDefbox *defbox,
/**
* gdict_defbox_set_font_name:
* @defbox: a #GdictDefbox
- * @font_name: a font description, or %NULL
+ * @font_name: (nullable): a font description, or %NULL
*
* Sets @font_name as the font for @defbox. It calls internally
* pango_font_description_from_string() and gtk_widget_modify_font().
diff --git a/libgdict/gdict-source-chooser.c b/libgdict/gdict-source-chooser.c
index 8587174..8198f46 100644
--- a/libgdict/gdict-source-chooser.c
+++ b/libgdict/gdict-source-chooser.c
@@ -444,7 +444,7 @@ gdict_source_chooser_new_with_loader (GdictSourceLoader *loader)
/**
* gdict_source_chooser_set_loader:
* @chooser: a #GdictSourceChooser
- * @loader: a #GdictSourceLoader or %NULL to unset it
+ * @loader: (nullable): a #GdictSourceLoader or %NULL to unset it
*
* Sets the #GdictSourceLoader to be used by the source chooser
* widget.
@@ -483,7 +483,7 @@ gdict_source_chooser_set_loader (GdictSourceChooser *chooser,
*
* Retrieves the #GdictSourceLoader used by @chooser.
*
- * Return value: a #GdictSourceLoader or %NULL is none is set
+ * Return value: (transfer none): a #GdictSourceLoader or %NULL is none is set
*
* Since: 0.12
*/
@@ -743,9 +743,9 @@ gdict_source_chooser_get_current_source (GdictSourceChooser *chooser)
*
* Retrieves the names of the available dictionary sources.
*
- * Return value: a newly allocated, %NULL terminated string vector
- * containing the names of the available sources. Use g_strfreev()
- * when done using it.
+ * Return value: (transfer full): a newly allocated, %NULL terminated
+ * string vector containing the names of the available sources.
+ * Use g_strfreev() when done using it.
*
* Since: 0.12
*/
@@ -883,7 +883,7 @@ gdict_source_chooser_refresh (GdictSourceChooser *chooser)
* the bottom of @chooser. The @button_text can also be a
* stock ID.
*
- * Return value: the newly packed button.
+ * Return value: (transfer none): the newly packed button.
*
* Since: 0.12
*/
diff --git a/libgdict/gdict-source-loader.c b/libgdict/gdict-source-loader.c
index 35299ed..1cb3829 100644
--- a/libgdict/gdict-source-loader.c
+++ b/libgdict/gdict-source-loader.c
@@ -295,8 +295,9 @@ gdict_source_loader_add_search_path (GdictSourceLoader *loader,
* Gets the list of paths used by @loader to search for dictionary source
* files.
*
- * Return value: a list containing the paths. The returned list is owned
- * by the #GdictSourceLoader object and should never be free or modified.
+ * Return value: (transfer none) (element-type utf8): a list containing the paths.
+ * The returned list is owned by the #GdictSourceLoader object and should never
+ * be free or modified.
*
* Since: 1.0
*/
@@ -414,13 +415,15 @@ gdict_source_loader_update_sources (GdictSourceLoader *loader)
/**
* gdict_source_loader_get_names:
* @loader: a #GdictSourceLoader
- * @length: return location for the number of source names, or %NULL
+ * @length: (out) (optional): return location for the number of
+ * source names, or %NULL
*
* Retrieves the list of dictionary source names available into the
* search paths of @loader.
*
- * Return value: a newly allocated, %NULL terminated array of strings. You
- * should free the returned string array with g_strfreev()
+ * Return value: (transfer full): a newly allocated, %NULL terminated
+ * array of strings. You should free the returned string array
+ * with g_strfreev()
*
* Since: 1.0
*/
@@ -463,9 +466,9 @@ gdict_source_loader_get_names (GdictSourceLoader *loader,
* Retrieves the list of dictionary sources available into the search
* paths of @loader, in form of #GdictSource objects.
*
- * Return value: a list of #GdictSource objects. The returned list
- * is owned by the #GdictSourceLoader object, and should never be
- * freed or modified.
+ * Return value: (transfer none) (element-type Gdict.Source): a list of
+ * #GdictSource objects. The returned list is owned by the #GdictSourceLoader
+ * object, and should never be freed or modified.
*
* Since: 1.0
*/
@@ -489,8 +492,7 @@ gdict_source_loader_get_sources (GdictSourceLoader *loader)
* #GdictSource object to create the right #GdictContext for that
* dictionary source.
*
- * Return value: a referenced #GdictSource object. You should de-reference
- * it using g_object_unref() when you finished using it.
+ * Return value: (transfer full): a referenced #GdictSource object.
*
* Since: 1.0
*/
diff --git a/libgdict/gdict-source.c b/libgdict/gdict-source.c
index 1d168d5..af9d96c 100644
--- a/libgdict/gdict-source.c
+++ b/libgdict/gdict-source.c
@@ -712,7 +712,8 @@ gdict_source_load_from_data (GdictSource *source,
/**
* gdict_source_to_data:
* @source: a #GdictSource
- * @length: return loaction for the length of the string, or %NULL
+ * @length: (out) (optional): return loaction for the length
+ * of the string, or %NULL
* @error: return location for a #GError or %NULL
*
* Outputs a dictionary source as a string.
@@ -817,7 +818,7 @@ gdict_source_get_name (GdictSource *source)
/**
* gdict_source_set_description:
* @source: a #GdictSource
- * @description: a UTF-8 encoded description or %NULL
+ * @description: (nullable): a UTF-8 encoded description or %NULL
*
* Sets the description of @source. If @description is %NULL, unsets the
* currently set description.
@@ -879,7 +880,7 @@ gdict_source_get_description (GdictSource *source)
/**
* gdict_source_set_database:
* @source: a #GdictSource
- * @database: a UTF-8 encoded database name or %NULL
+ * @database: (nullable): a UTF-8 encoded database name or %NULL
*
* Sets the default database of @source. If @database is %NULL, unsets the
* currently set database.
@@ -941,7 +942,7 @@ gdict_source_get_database (GdictSource *source)
/**
* gdict_source_set_strategy:
* @source: a #GdictSource
- * @strategy: a UTF-8 encoded strategy or %NULL
+ * @strategy: (nullable): a UTF-8 encoded strategy or %NULL
*
* Sets the description of @source. If @strategy is %NULL, unsets the
* currently set strategy.
@@ -1149,8 +1150,8 @@ gdict_source_get_transport (GdictSource *source)
*
* Gets the #GdictContext bound to @source.
*
- * Return value: a #GdictContext for @source. Use g_object_unref()
- * when you don't need it anymore.
+ * Return value: (transfer full): a #GdictContext for @source.
+ * Use g_object_unref() when you don't need it anymore.
*
* Since: 1.0
*/
diff --git a/libgdict/gdict-speller.c b/libgdict/gdict-speller.c
index 6b7dd63..992ba76 100644
--- a/libgdict/gdict-speller.c
+++ b/libgdict/gdict-speller.c
@@ -492,7 +492,7 @@ gdict_speller_set_context (GdictSpeller *speller,
*
* FIXME
*
- * Return value: a #GdictContext
+ * Return value: (transfer none): a #GdictContext
*
* Since:
*/
diff --git a/libgdict/gdict-strategy-chooser.c b/libgdict/gdict-strategy-chooser.c
index 07ea8c1..3f8c4b3 100644
--- a/libgdict/gdict-strategy-chooser.c
+++ b/libgdict/gdict-strategy-chooser.c
@@ -494,7 +494,7 @@ gdict_strategy_chooser_new_with_context (GdictContext *context)
*
* Retrieves the #GdictContext used by @chooser.
*
- * Return value: a #GdictContext
+ * Return value: (transfer none): a #GdictContext
*
* Since:
*/
@@ -509,7 +509,7 @@ gdict_strategy_chooser_get_context (GdictStrategyChooser *chooser)
/**
* gdict_strategy_chooser_set_context:
* @chooser: a #GdictStrategyChooser
- * @context: a #GdictContext, or %NULL to unset the context
+ * @context: (nullable): a #GdictContext, or %NULL to unset the context
*
* Sets the #GdictContext to be used by @chooser to retrieve the
* list of matching strategies.
@@ -535,8 +535,9 @@ gdict_strategy_chooser_set_context (GdictStrategyChooser *chooser,
*
* Retrieves the list of matching strategies available.
*
- * Return value: a string vector containing the names of the matching
- * strategies. Use g_strfreev() to deallocate the memory when done
+ * Return value: (transfer full): a string vector containing the names
+ * of the matching strategies. Use g_strfreev() to deallocate the memory
+ * when done
*
* Since:0.9
*/
@@ -1060,7 +1061,7 @@ gdict_strategy_chooser_get_current_strategy (GdictStrategyChooser *chooser)
* Creates a new button and packs it into the #GdictStrategyChooser
* "action area".
*
- * Return value: the packed #GtkButton
+ * Return value: (transfer none): the packed #GtkButton
*
* Since: 0.10
*/
diff --git a/libgdict/gdict-utils.c b/libgdict/gdict-utils.c
index e6c0851..5b81d04 100644
--- a/libgdict/gdict-utils.c
+++ b/libgdict/gdict-utils.c
@@ -288,7 +288,7 @@ get_toplevel_window (GtkWidget *widget)
* gdict_show_error_dialog:
* @widget: the widget that emits the error
* @title: the primary error message
- * @message: the secondary error message or %NULL
+ * @message: (nullable): the secondary error message or %NULL
*
* Creates and shows an error dialog bound to @widget.
*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]