summaryrefslogtreecommitdiff
path: root/xfconf
diff options
context:
space:
mode:
authorOlivier Duchateau <duchateau.olivier@gmail.com>2019-02-15 20:47:43 +0100
committerRomain Bouvier <skunnyk@alteroot.org>2019-06-24 09:56:13 +0200
commit8d4284058bd7acd951f112ac6d3fd42c02eefe7f (patch)
treedaed096405db84394df019ce4279beca311853c5 /xfconf
parentb4bed38222aa0c389b6ded430bcdfade27e77f73 (diff)
downloadxfconf-8d4284058bd7acd951f112ac6d3fd42c02eefe7f.tar.gz
Add support for GObject introspection and vala
- Fix bug #15135
Diffstat (limited to 'xfconf')
-rw-r--r--xfconf/Makefile.am51
-rw-r--r--xfconf/libxfconf-0.deps3
-rw-r--r--xfconf/xfconf-cache.c17
-rw-r--r--xfconf/xfconf-channel.c31
-rw-r--r--xfconf/xfconf.c2
5 files changed, 78 insertions, 26 deletions
diff --git a/xfconf/Makefile.am b/xfconf/Makefile.am
index 7cf962d..473daae 100644
--- a/xfconf/Makefile.am
+++ b/xfconf/Makefile.am
@@ -59,6 +59,57 @@ EXTRA_DIST = \
# required for gtk-doc
dist-hook: all
+-include $(INTROSPECTION_MAKEFILE)
+INTROSPECTION_GIRS =
+INTROSPECTION_SCANNER_ENV = CC="$(CC)"
+INTROSPECTION_SCANNER_ARGS = \
+ --add-include-path=$(srcdir) \
+ --warn-all \
+ -DLIBXFCONF_COMPILATION \
+ --symbol-prefix=xfconf_g_ \
+ --symbol-prefix=xfconf_ \
+ --c-include=xfconf/xfconf.h
+INTROSPECTION_COMPILER_ARGS = \
+ --includedir=$(srcdir) \
+ --includedir=.
+
+if HAVE_INTROSPECTION
+introspection_sources = $(filter-out %private.h %cache.h, $(libxfconf_0_la_SOURCES))
+
+Xfconf-0.gir: libxfconf-0.la Makefile
+Xfconf_0_gir_INCLUDES = GObject-2.0 GLib-2.0 Gio-2.0
+Xfconf_0_gir_CFLAGS = $(AM_CPPFLAGS)
+Xfconf_0_gir_LIBS = libxfconf-0.la
+Xfconf_0_gir_FILES = $(introspection_sources)
+Xfconf_0_gir_EXPORT_PACKAGES = libxfconf-0
+INTROSPECTION_GIRS += Xfconf-0.gir
+
+girdir = $(datadir)/gir-1.0
+gir_DATA = $(INTROSPECTION_GIRS)
+
+typelibdir = $(libdir)/girepository-1.0
+typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
+
+DISTCLEANFILES = $(gir_DATA) $(typelib_DATA)
+endif
+
+if ENABLE_VAPIGEN
+-include $(VAPIGEN_MAKEFILE)
+
+libxfconf-0.vapi: Xfconf-0.gir libxfconf-0.deps
+
+VAPIGEN_VAPIS = libxfconf-0.vapi
+VAPIGEN_GIRDIRS = $(prefix)/share/gir-1.0
+
+libxfconf_0_vapi_DEPS = gobject-2.0 glib-2.0 gio-2.0
+libxfconf_0_vapi_FILES = Xfconf-0.gir
+
+vapidir = $(datadir)/vala/vapi
+vapi_DATA = $(VAPIGEN_VAPIS) $(VAPIGEN_VAPIS:.vapi=.deps)
+
+DISTCLEANFILES = libxfconf-0.deps
+endif
+
if HAVE_GNUC_VISIBILITY
TESTS = abicheck.sh
endif
diff --git a/xfconf/libxfconf-0.deps b/xfconf/libxfconf-0.deps
new file mode 100644
index 0000000..333a927
--- /dev/null
+++ b/xfconf/libxfconf-0.deps
@@ -0,0 +1,3 @@
+gobject-2.0
+glib-2.0
+gio-2.0
diff --git a/xfconf/xfconf-cache.c b/xfconf/xfconf-cache.c
index d74f05e..ca012f6 100644
--- a/xfconf/xfconf-cache.c
+++ b/xfconf/xfconf-cache.c
@@ -144,7 +144,16 @@ xfconf_cache_item_free(XfconfCacheItem *item)
/******************* XfconfCacheOldItem *******************/
-
+/**
+ * XfconfCacheOldItem:
+ * @property:
+ * @item: a #XfconfCacheItem object
+ * @cancellable:
+ * @pending_calls_count:
+ * @variant: Used in xfconf_cache_old_item_end_call to end an already
+ * started call
+ * @cache: Pointer to the cache object
+ */
typedef struct
{
gchar *property;
@@ -154,14 +163,8 @@ typedef struct
gint pending_calls_count;
- /**
- * Variant to be send on the wire
- * Used in xfconf_cache_old_item_end_call
- * to end an already started call
- **/
GVariant *variant;
- /* Pointer to the cache object */
XfconfCache *cache;
} XfconfCacheOldItem;
diff --git a/xfconf/xfconf-channel.c b/xfconf/xfconf-channel.c
index ce45f05..8e8767d 100644
--- a/xfconf/xfconf-channel.c
+++ b/xfconf/xfconf-channel.c
@@ -520,10 +520,10 @@ xfconf_transform_array(GPtrArray *arr_src,
*
* The reference count of the returned channel is owned by libxfconf.
*
- * Returns: An #XfconfChannel singleton.
+ * Returns: (transfer full): An #XfconfChannel singleton.
*
* Since: 4.5.91
- **/
+ */
XfconfChannel *
xfconf_channel_get(const gchar *channel_name)
{
@@ -710,9 +710,9 @@ xfconf_channel_reset_property(XfconfChannel *channel,
* retrieved. To retrieve all properties in the channel,
* specify "/" or %NULL for @property_base.
*
- * Returns: A newly-allocated #GHashTable, which should be freed with
+ * Returns: (element-type utf8 GValue) (transfer container): A newly-allocated #GHashTable, which should be freed with
* g_hash_table_destroy() when no longer needed.
- **/
+ */
GHashTable *
xfconf_channel_get_properties(XfconfChannel *channel,
const gchar *property_base)
@@ -792,10 +792,10 @@ xfconf_channel_get_string(XfconfChannel *channel,
*
* Retrieves the string list value associated with @property on @channel.
*
- * Returns: A newly-allocated string list which should be freed with
+ * Returns: (transfer full) (element-type utf8) (array zero-terminated=1): A newly-allocated string list which should be freed with
* g_strfreev() when no longer needed. If @property is not in
* @channel, %NULL is returned.
- **/
+ */
gchar **
xfconf_channel_get_string_list(XfconfChannel *channel,
const gchar *property)
@@ -1483,8 +1483,8 @@ out:
* a #GPtrArray, which can be freed with xfconf_array_free()
* when no longer needed.
*
- * Returns: A newly-allocated #GPtrArray on success, or %NULL
- * on failure.
+ * Returns: (transfer container) (element-type GValue) (nullable): A newly-allocated #GPtrArray on success,
+ * or %NULL on failure.
**/
GPtrArray *
xfconf_channel_get_arrayv(XfconfChannel *channel,
@@ -1507,10 +1507,7 @@ xfconf_channel_get_arrayv(XfconfChannel *channel,
return NULL;
}
- /**
- * Arr is owned by the Gvalue in the cache
- * do not free it.
- **/
+ /* Do not free it, it is owned by the GValue in cache */
arr = g_value_get_boxed(&val);
if(!arr->len) {
g_ptr_array_free(arr, TRUE);
@@ -1664,7 +1661,7 @@ out:
* xfconf_channel_set_arrayv:
* @channel: An #XfconfChannel.
* @property: A property string.
- * @values: A #GPtrArray of #GValue<!-- -->s.
+ * @values: (element-type GValue): A #GPtrArray of #GValue<!-- -->s.
*
* Sets an array property on @channel, using the values in the
* provided @values array.
@@ -2238,11 +2235,9 @@ out:
*
* Lists all channels known in the Xfconf configuration store.
*
- * Returns: A newly-allocated array of strings. Free with
- * g_strfreev() when no longer needed.
- **/
-/* this really belongs in xfconf.c, but i don't feel like including
- * xfconf-dbus-bindings.h twice, or copying the ERROR macros */
+ * Returns: (transfer none) (array zero-terminated=1) (type utf8): A newly-allocated array of strings.
+ * Free with g_strfreev() when no longer needed.
+ */
gchar **
xfconf_list_channels(void)
{
diff --git a/xfconf/xfconf.c b/xfconf/xfconf.c
index fb2934d..228bdc3 100644
--- a/xfconf/xfconf.c
+++ b/xfconf/xfconf.c
@@ -224,7 +224,7 @@ xfconf_array_new(gint n_preallocs)
/**
* xfconf_array_free:
- * @arr: A #GPtrArray of #GValue<!-- -->s.
+ * @arr: (element-type GValue): A #GPtrArray of #GValue<!-- -->s.
*
* Properly frees a #GPtrArray structure containing a list of
* #GValue<!-- -->s. This will also cause the contents of the