[gupnp] Add vapi generation from GIR
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gupnp] Add vapi generation from GIR
- Date: Sat, 6 Oct 2012 13:37:45 +0000 (UTC)
commit eda464be9136e74aac4766a3cf09f9eeadb50d08
Author: Jens Georg <mail jensge org>
Date: Sat Oct 6 15:32:20 2012 +0200
Add vapi generation from GIR
Makefile.am | 2 +-
configure.ac | 11 ++++++++++-
libgupnp/gupnp-context.c | 7 ++++---
libgupnp/gupnp-device-info.c | 28 ++++++++++++----------------
libgupnp/gupnp-service-info.c | 27 ++++++++++++---------------
libgupnp/gupnp-service-introspection.c | 5 +++--
libgupnp/gupnp-service-introspection.h | 4 ++--
libgupnp/gupnp-service-proxy.c | 4 ++--
libgupnp/gupnp-service.c | 8 ++++----
libgupnp/gupnp-service.h | 1 +
vala/GUPnP-1.0.metadata | 28 ++++++++++++++++++++++++++++
vala/Makefile.am | 21 +++++++++++++++++++++
vala/gupnp-1.0-custom.vala | 31 +++++++++++++++++++++++++++++++
vala/gupnp-1.0.deps | 3 +++
14 files changed, 134 insertions(+), 46 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index e92161a..9950837 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,6 @@
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
-SUBDIRS = libgupnp tools examples tests doc
+SUBDIRS = libgupnp tools examples tests doc vala
pkgconfig_DATA= gupnp-1.0.pc
pkgconfigdir = $(libdir)/pkgconfig
diff --git a/configure.ac b/configure.ac
index 790e17d..2d34c40 100644
--- a/configure.ac
+++ b/configure.ac
@@ -127,7 +127,15 @@ if test "x$enable_debug" = "xyes"; then
CFLAGS="$CFLAGS -g -Wall -Werror"
fi
-GOBJECT_INTROSPECTION_CHECK([0.6.4])
+GOBJECT_INTROSPECTION_CHECK([1.33.4])
+
+# vapigen
+AS_IF([test "x$found_introspection" = "xyes"],
+ [
+ VALA_PROG_VAPIGEN([0.14])
+ ]
+)
+AM_CONDITIONAL([HAVE_VAPIGEN], [test "x$VAPIGEN" != "x"])
# Gtk-doc
GTK_DOC_CHECK([1.0])
@@ -141,6 +149,7 @@ tests/Makefile
tests/gtest/Makefile
doc/Makefile
doc/version.xml
+vala/Makefile
gupnp-1.0.pc
gupnp-1.0-uninstalled.pc
])
diff --git a/libgupnp/gupnp-context.c b/libgupnp/gupnp-context.c
index d62a17a..114b1b3 100644
--- a/libgupnp/gupnp-context.c
+++ b/libgupnp/gupnp-context.c
@@ -545,9 +545,10 @@ _gupnp_context_get_server_url (GUPnPContext *context)
/**
* gupnp_context_new:
- * @main_context: Deprecated: 0.17.2: Always set to %NULL. If you want to use
- * a different context, use g_main_context_push_thread_default().
- * @interface: The network interface to use, or %NULL to auto-detect.
+ * @main_context: (allow-none): Deprecated: 0.17.2: Always set to %NULL. If you
+ * want to use a different context, use g_main_context_push_thread_default().
+ * @interface: (allow-none): The network interface to use, or %NULL to
+ * auto-detect.
* @port: Port to run on, or 0 if you don't care what port is used.
* @error: A location to store a #GError, or %NULL
*
diff --git a/libgupnp/gupnp-device-info.c b/libgupnp/gupnp-device-info.c
index a2f4cd5..4f6fe2b 100644
--- a/libgupnp/gupnp-device-info.c
+++ b/libgupnp/gupnp-device-info.c
@@ -101,11 +101,7 @@ gupnp_device_info_set_property (GObject *object,
info->priv->device_type = g_value_dup_string (value);
break;
case PROP_URL_BASE:
- info->priv->url_base = g_value_get_pointer (value);
- if (info->priv->url_base)
- info->priv->url_base =
- soup_uri_copy (info->priv->url_base);
-
+ info->priv->url_base = g_value_dup_boxed (value);
break;
case PROP_DOCUMENT:
info->priv->doc = g_value_dup_object (value);
@@ -151,8 +147,7 @@ gupnp_device_info_get_property (GObject *object,
gupnp_device_info_get_device_type (info));
break;
case PROP_URL_BASE:
- g_value_set_pointer (value,
- info->priv->url_base);
+ g_value_set_boxed (value, info->priv->url_base);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -314,14 +309,15 @@ gupnp_device_info_class_init (GUPnPDeviceInfoClass *klass)
g_object_class_install_property
(object_class,
PROP_URL_BASE,
- g_param_spec_pointer ("url-base",
- "URL base",
- "The URL base",
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_NAME |
- G_PARAM_STATIC_NICK |
- G_PARAM_STATIC_BLURB));
+ g_param_spec_boxed ("url-base",
+ "URL base",
+ "The URL base",
+ SOUP_TYPE_URI,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_NICK |
+ G_PARAM_STATIC_BLURB));
/**
* GUPnPDeviceInfo:document:
@@ -1109,7 +1105,7 @@ gupnp_device_info_list_device_types (GUPnPDeviceInfo *info)
* this function a new object is created. The application must cache any used
* devices if it wishes to keep them around and re-use them.
*
- * Returns: (transfer full): A new #GUPnPDeviceInfo.
+ * Returns: (transfer full)(allow-none): A new #GUPnPDeviceInfo.
**/
GUPnPDeviceInfo *
gupnp_device_info_get_device (GUPnPDeviceInfo *info,
diff --git a/libgupnp/gupnp-service-info.c b/libgupnp/gupnp-service-info.c
index fd3f785..8849a67 100644
--- a/libgupnp/gupnp-service-info.c
+++ b/libgupnp/gupnp-service-info.c
@@ -118,11 +118,7 @@ gupnp_service_info_set_property (GObject *object,
info->priv->service_type = g_value_dup_string (value);
break;
case PROP_URL_BASE:
- info->priv->url_base = g_value_get_pointer (value);
- if (info->priv->url_base)
- info->priv->url_base =
- soup_uri_copy (info->priv->url_base);
-
+ info->priv->url_base = g_value_dup_boxed (value);
break;
case PROP_DOCUMENT:
info->priv->doc = g_value_dup_object (value);
@@ -164,8 +160,8 @@ gupnp_service_info_get_property (GObject *object,
gupnp_service_info_get_service_type (info));
break;
case PROP_URL_BASE:
- g_value_set_pointer (value,
- info->priv->url_base);
+ g_value_set_boxed (value,
+ info->priv->url_base);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -326,14 +322,15 @@ gupnp_service_info_class_init (GUPnPServiceInfoClass *klass)
g_object_class_install_property
(object_class,
PROP_URL_BASE,
- g_param_spec_pointer ("url-base",
- "URL base",
- "The URL base",
- G_PARAM_READWRITE |
- G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_NAME |
- G_PARAM_STATIC_NICK |
- G_PARAM_STATIC_BLURB));
+ g_param_spec_boxed ("url-base",
+ "URL base",
+ "The URL base",
+ SOUP_TYPE_URI,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY |
+ G_PARAM_STATIC_NAME |
+ G_PARAM_STATIC_NICK |
+ G_PARAM_STATIC_BLURB));
/**
* GUPnPServiceInfo:document:
diff --git a/libgupnp/gupnp-service-introspection.c b/libgupnp/gupnp-service-introspection.c
index 2eb3bc3..e3335f3 100644
--- a/libgupnp/gupnp-service-introspection.c
+++ b/libgupnp/gupnp-service-introspection.c
@@ -786,7 +786,7 @@ gupnp_service_introspection_list_action_names
* Returns a #GList of all the actions (of type #GUPnPServiceActionInfo) in
* this service.
*
- * Return value: (element-type GUPnP.ServiceActionInfo*) (transfer none): A
+ * Return value: (element-type GUPnP.ServiceActionInfo) (transfer none): A
* #GList of all the actions or %NULL. Do not modify or free it or its
* contents.
**/
@@ -855,7 +855,8 @@ state_variable_search_func (GUPnPServiceStateVariableInfo *variable,
*
* Returns the state variable by the name @variable_name in this service.
*
- * Return value: the state variable or %NULL. Do not modify or free it.
+ * Return value: (transfer none): the state variable or %NULL. Do not modify or
+ * free it.
**/
const GUPnPServiceStateVariableInfo *
gupnp_service_introspection_get_state_variable
diff --git a/libgupnp/gupnp-service-introspection.h b/libgupnp/gupnp-service-introspection.h
index 76d1dc3..54d9e90 100644
--- a/libgupnp/gupnp-service-introspection.h
+++ b/libgupnp/gupnp-service-introspection.h
@@ -85,7 +85,7 @@ typedef struct {
/**
* GUPnPServiceActionInfo:
* @name: The name of the action argument.
- * @arguments: A GList of all the arguments
+ * @arguments: (type GList) (element-type GUPnP.ServiceActionArgInfo):A GList of all the arguments
* (of type #GUPnPServiceActionArgInfo) of this action.
*
* This structure contains information about a service action.
@@ -109,7 +109,7 @@ typedef struct {
* data types.
* @step: The step value of this state variable. Only applies to numeric
* data types.
- * @allowed_values: The allowed values of this state variable. Only applies to
+ * @allowed_values: (element-type utf8): The allowed values of this state variable. Only applies to
* string data types. Unlike the other fields in this structure, this field
* contains a list of (char *) strings rather than GValues.
*
diff --git a/libgupnp/gupnp-service-proxy.c b/libgupnp/gupnp-service-proxy.c
index dc75ba1..04811ca 100644
--- a/libgupnp/gupnp-service-proxy.c
+++ b/libgupnp/gupnp-service-proxy.c
@@ -348,7 +348,7 @@ gupnp_service_proxy_class_init (GUPnPServiceProxyClass *klass)
/**
* GUPnPServiceProxy::subscription-lost:
* @proxy: The #GUPnPServiceProxy that received the signal
- * @error: A pointer to a #GError describing why the subscription has
+ * @error: (type GError):A pointer to a #GError describing why the subscription has
* been lost
*
* Emitted whenever the subscription to this service has been lost due
@@ -967,7 +967,7 @@ gupnp_service_proxy_begin_action_list
* @callback: (scope async): The callback to call when sending the action has succeeded
* or failed
* @user_data: User data for @callback
- * @hash: A #GHashTable of in parameter name and #GValue pairs
+ * @hash: (element-type utf8 GValue): A #GHashTable of in parameter name and #GValue pairs
*
* See gupnp_service_proxy_begin_action(); this version takes a #GHashTable
* for runtime generated parameter lists.
diff --git a/libgupnp/gupnp-service.c b/libgupnp/gupnp-service.c
index 76c3e9d..2eb2a43 100644
--- a/libgupnp/gupnp-service.c
+++ b/libgupnp/gupnp-service.c
@@ -458,7 +458,7 @@ gupnp_service_action_get_values (GUPnPServiceAction *action,
* gupnp_service_action_get_value: (skip)
* @action: A #GUPnPServiceAction
* @argument: The name of the argument to retrieve
- * @value: The #GValue to store the value of the argument, initialized
+ * @value: (inout):The #GValue to store the value of the argument, initialized
* to the correct type.
*
* Retrieves the value of @argument into @value.
@@ -1669,7 +1669,7 @@ gupnp_service_class_init (GUPnPServiceClass *klass)
* GUPnPService::query-variable:
* @service: The #GUPnPService that received the signal
* @variable: The variable that is being queried
- * @value: The location of the #GValue of the variable
+ * @value: (type GValue)(inout):The location of the #GValue of the variable
*
* Emitted whenever @service needs to know the value of @variable.
* Handler should fill @value with the value of @variable.
@@ -1692,8 +1692,8 @@ gupnp_service_class_init (GUPnPServiceClass *klass)
/**
* GUPnPService::notify-failed:
* @service: The #GUPnPService that received the signal
- * @callback_url: The callback URL
- * @reason: A pointer to a #GError describing why the notify failed
+ * @callback_url: (type GList)(element-type SoupURI):A #GList of callback URLs
+ * @reason: (type GError): A pointer to a #GError describing why the notify failed
*
* Emitted whenever notification of a client fails.
**/
diff --git a/libgupnp/gupnp-service.h b/libgupnp/gupnp-service.h
index d81e4b9..ae73c89 100644
--- a/libgupnp/gupnp-service.h
+++ b/libgupnp/gupnp-service.h
@@ -83,6 +83,7 @@ struct _GUPnPService {
struct _GUPnPServiceClass {
GUPnPServiceInfoClass parent_class;
+ /* <signals> */
void (* action_invoked) (GUPnPService *service,
GUPnPServiceAction *action);
diff --git a/vala/GUPnP-1.0.metadata b/vala/GUPnP-1.0.metadata
new file mode 100644
index 0000000..f6d6061
--- /dev/null
+++ b/vala/GUPnP-1.0.metadata
@@ -0,0 +1,28 @@
+GUPnP cheader_filename="libgupnp/gupnp.h"
+DeviceInfo
+ .get_device nullable=true
+ .get_service nullable=true
+ .element skip
+ .document skip
+Service
+ .notify skip=false
+ .signals_autoconnect skip
+ .notify_failed#signal virtual
+ServiceAction
+ .get skip=false
+ .get_value skip=false
+ .set skip=false
+ServiceInfo
+ .document skip
+ .element skip
+ .get_introspection nullable=true
+ServiceIntrospection
+ .get_action nullable=true unowned=true
+ .get_state_variable nullable=true unowned=true
+ .scpd skip
+ServiceProxy
+ .begin_action skip=false
+ .end_action_hash skip
+ .end_action_list skip
+ .send_action_hash skip
+ .send_action_list skip
diff --git a/vala/Makefile.am b/vala/Makefile.am
new file mode 100644
index 0000000..e8822d3
--- /dev/null
+++ b/vala/Makefile.am
@@ -0,0 +1,21 @@
+if HAVE_INTROSPECTION
+if HAVE_VAPIGEN
+gupnp-1.0.vapi: gupnp-1.0.stamp
+ @true
+
+gupnp-1.0.stamp: $(top_builddir)/libgupnp/GUPnP-1.0.gir \
+ $(srcdir)/GUPnP-1.0.metadata \
+ $(srcdir)/gupnp-1.0-custom.vala
+ $(AM_V_GEN)$(VAPIGEN) --metadatadir=$(srcdir) \
+ --pkg=libsoup-2.4 \
+ --library=gupnp-1.0 --pkg=gio-2.0 --pkg=libxml-2.0 \
+ $(top_builddir)/libgupnp/GUPnP-1.0.gir \
+ $(srcdir)/gupnp-1.0-custom.vala && \
+ echo timestmap > $(@F)
+
+vapidir = $(datadir)/vala/vapi
+vapi_DATA = gupnp-1.0.vapi $(srcdir)/gupnp-1.0.deps
+CLEANFILES = gupnp-1.0.vapi gupnp-1.0.stamp
+EXTRA_DIST = gupnp-1.0.deps GUPnP-1.0.metadata gupnp-1.0-custom.vala
+endif
+endif
diff --git a/vala/gupnp-1.0-custom.vala b/vala/gupnp-1.0-custom.vala
new file mode 100644
index 0000000..386fa80
--- /dev/null
+++ b/vala/gupnp-1.0-custom.vala
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2012 Jens Georg <mail jensge org>
+ *
+ * Author: Jens Georg <mail jensge org>
+ *
+ * This file is part of GUPnP.
+ *
+ * GUPnP is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * GUPnP 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 Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+public class GUPnP.ServiceProxy : GUPnP.ServiceInfo {
+ public bool send_action (string action, ...) throws GLib.Error;
+ public bool end_action (GUPnP.ServiceProxyAction action, ...) throws GLib.Error;
+ public bool end_action_hash (GUPnP.ServiceProxyAction action, [CCode (pos=-0.9)] GLib.HashTable<string, weak GLib.Value*> hash) throws GLib.Error;
+ public bool end_action_list (GUPnP.ServiceProxyAction action, [CCode (pos=-0.9)] GLib.List<string> out_names, [CCode (pos=-0.8)] GLib.List<GLib.Type?> out_types, [CCode (pos=-0.7)] out GLib.List<weak GLib.Value*> out_values) throws GLib.Error;
+
+ public bool send_action_hash (string action, [CCode (pos=-0.9)] GLib.HashTable<string, GLib.Value?> in_hash, [CCode (pos=-0.8)] GLib.HashTable<string, weak GLib.Value*> out_hash) throws GLib.Error;
+ public bool send_action_list (string action, [CCode (pos=-0.9)] GLib.List<string> in_names, [CCode (pos=-0.8)] GLib.List<weak GLib.Value?> in_values, [CCode (pos=-0.7)] GLib.List<string> out_names, [CCode (pos=-0.6)] GLib.List<GLib.Type?> out_types, [CCode (pos=-0.5)] out GLib.List<weak GLib.Value*> out_values) throws GLib.Error;
+}
diff --git a/vala/gupnp-1.0.deps b/vala/gupnp-1.0.deps
new file mode 100644
index 0000000..52e8225
--- /dev/null
+++ b/vala/gupnp-1.0.deps
@@ -0,0 +1,3 @@
+gssdp-1.0
+libsoup-2.4
+libxml-2.0
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]