Commit eda464be authored by Jens Georg's avatar Jens Georg

Add vapi generation from GIR

parent a5c429cb
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
......
......@@ -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
])
......
......@@ -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
*
......
......@@ -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,
......
......@@ -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:
......
......@@ -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
......
......@@ -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.
*
......
......@@ -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.
......
......@@ -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.
**/
......
......@@ -83,6 +83,7 @@ struct _GUPnPService {
struct _GUPnPServiceClass {
GUPnPServiceInfoClass parent_class;
/* <signals> */
void (* action_invoked) (GUPnPService *service,
GUPnPServiceAction *action);
......
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
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
/*
* 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;
}
gssdp-1.0
libsoup-2.4
libxml-2.0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment