[gupnp/wip/drop-deprecated-api] all: Drop deprecated API, part 1
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gupnp/wip/drop-deprecated-api] all: Drop deprecated API, part 1
- Date: Tue, 4 Jan 2022 10:49:04 +0000 (UTC)
commit 590d0c7d4433972c97b3d1149f29021ad3250d96
Author: Jens Georg <mail jensge org>
Date: Tue Jan 4 11:41:11 2022 +0100
all: Drop deprecated API, part 1
libgupnp/gupnp-context-manager.c | 18 +-
libgupnp/gupnp-context-manager.h | 6 +-
libgupnp/gupnp-control-point.c | 32 +-
libgupnp/gupnp-service-proxy-action-private.h | 6 -
libgupnp/gupnp-service-proxy-action.c | 26 +-
libgupnp/gupnp-service-proxy.c | 538 --------------------------
libgupnp/gupnp-service-proxy.h | 95 -----
libgupnp/gupnp-white-list.c | 236 -----------
libgupnp/gupnp-white-list.h | 58 ---
libgupnp/gupnp.h | 1 -
libgupnp/meson.build | 2 -
tests/test-bugs.c | 196 ++--------
12 files changed, 52 insertions(+), 1162 deletions(-)
---
diff --git a/libgupnp/gupnp-context-manager.c b/libgupnp/gupnp-context-manager.c
index 5092005..9fdc355 100644
--- a/libgupnp/gupnp-context-manager.c
+++ b/libgupnp/gupnp-context-manager.c
@@ -188,7 +188,7 @@ on_context_unavailable (GUPnPContextManager *manager,
GUPnPControlPoint *cp;
cp = GUPNP_CONTROL_POINT (l->data);
- obj_context = gupnp_control_point_get_context (cp);
+ obj_context = GUPNP_CONTEXT (gssdp_resource_group_get_client (GSSDP_RESOURCE_GROUP
(cp)));
} else if (GUPNP_IS_ROOT_DEVICE (l->data)) {
GUPnPDeviceInfo *info;
@@ -866,22 +866,6 @@ gupnp_context_manager_get_context_filter (GUPnPContextManager *manager)
return priv->context_filter;
}
-/**
- * gupnp_context_manager_get_white_list:
- * @manager: A #GUPnPContextManager
- *
- * Get the #GUPnPContextFilter associated with @manager.
- *
- * Returns: (transfer none): The #GUPnPContextFilter associated with this
- * context manager.
- * Deprecated: 1.4.0: Use [method@GUPnP.ContextManager.get_context_filter] instead.
- */
-GUPnPWhiteList *
-gupnp_context_manager_get_white_list (GUPnPContextManager *manager)
-{
- return gupnp_context_manager_get_context_filter (manager);
-}
-
/**
* gupnp_context_manager_get_socket_family:(attributes org.gtk.Method.get_property=family)
* @manager: A #GUPnPContextManager
diff --git a/libgupnp/gupnp-context-manager.h b/libgupnp/gupnp-context-manager.h
index dadeebc..044e9af 100644
--- a/libgupnp/gupnp-context-manager.h
+++ b/libgupnp/gupnp-context-manager.h
@@ -15,7 +15,7 @@
#include "gupnp-context.h"
#include "gupnp-control-point.h"
#include "gupnp-root-device.h"
-#include "gupnp-white-list.h"
+
#include <glib.h>
G_BEGIN_DECLS
@@ -67,10 +67,6 @@ gupnp_context_manager_get_port (GUPnPContextManager *manager);
GUPnPContextFilter *
gupnp_context_manager_get_context_filter (GUPnPContextManager *manager);
-G_GNUC_DEPRECATED_FOR (gupnp_context_manager_get_context_filter)
-GUPnPWhiteList *
-gupnp_context_manager_get_white_list (GUPnPContextManager *manager);
-
GSocketFamily
gupnp_context_manager_get_socket_family (GUPnPContextManager *manager);
diff --git a/libgupnp/gupnp-control-point.c b/libgupnp/gupnp-control-point.c
index 41d56c6..af0f38c 100644
--- a/libgupnp/gupnp-control-point.c
+++ b/libgupnp/gupnp-control-point.c
@@ -23,7 +23,6 @@
*/
#include <config.h>
-#include <string.h>
#include "gupnp-control-point.h"
#include "gupnp-context-private.h"
@@ -31,6 +30,9 @@
#include "http-headers.h"
#include "xml-util.h"
+#include <string.h>
+#include <libgssdp/gssdp-resource-group.h>
+
#define GUPNP_MAX_DESCRIPTION_DOWNLOAD_RETRIES 4
#define GUPNP_INITIAL_DESCRIPTION_RETRY_TIMEOUT 5
@@ -308,7 +310,7 @@ create_and_report_service_proxy (GUPnPControlPoint *control_point,
priv = gupnp_control_point_get_instance_private (control_point);
factory = gupnp_control_point_get_resource_factory (control_point);
- context = gupnp_control_point_get_context (control_point);
+ context = GUPNP_CONTEXT (gssdp_resource_group_get_client (GSSDP_RESOURCE_GROUP (control_point)));
/* Create proxy */
proxy = gupnp_resource_factory_create_service_proxy (factory,
@@ -347,7 +349,7 @@ create_and_report_device_proxy (GUPnPControlPoint *control_point,
priv = gupnp_control_point_get_instance_private (control_point);
factory = gupnp_control_point_get_resource_factory (control_point);
- context = gupnp_control_point_get_context (control_point);
+ context = GUPNP_CONTEXT (gssdp_resource_group_get_client (GSSDP_RESOURCE_GROUP (control_point)));
proxy = gupnp_resource_factory_create_device_proxy (factory,
context,
@@ -721,7 +723,8 @@ load_description (GUPnPControlPoint *control_point,
GetDescriptionURLData *data;
char *local_description = NULL;
- context = gupnp_control_point_get_context (control_point);
+ context = GUPNP_CONTEXT (gssdp_resource_group_get_client (
+ GSSDP_RESOURCE_GROUP (control_point)));
session = gupnp_context_get_session (context);
@@ -1211,27 +1214,6 @@ gupnp_control_point_new_full (GUPnPContext *context,
NULL);
}
-/**
- * gupnp_control_point_get_context:
- * @control_point: A #GUPnPControlPoint
- *
- * Get the #GUPnPControlPoint associated with @control_point.
- *
- * Returns: (transfer none): The #GUPnPContext.
- * Deprecated: 1.4.0: Use [method@GSSDP.ResourceBrowser.get_client] instead.
- **/
-GUPnPContext *
-gupnp_control_point_get_context (GUPnPControlPoint *control_point)
-{
- GSSDPClient *client;
-
- g_return_val_if_fail (GUPNP_IS_CONTROL_POINT (control_point), NULL);
-
- client = gssdp_resource_browser_get_client
- (GSSDP_RESOURCE_BROWSER (control_point));
-
- return GUPNP_CONTEXT (client);
-}
/**
* gupnp_control_point_list_device_proxies:
diff --git a/libgupnp/gupnp-service-proxy-action-private.h b/libgupnp/gupnp-service-proxy-action-private.h
index 8fc8981..fd7fefe 100644
--- a/libgupnp/gupnp-service-proxy-action-private.h
+++ b/libgupnp/gupnp-service-proxy-action-private.h
@@ -143,12 +143,6 @@ struct _GUPnPServiceProxyAction {
GCancellable *cancellable;
gulong cancellable_connection_id;
- // Support for legacy async calls
- GUPnPServiceProxyActionCallback callback;
- gpointer user_data;
- GError *error; /* If non-NULL, description of error that
- occurred when preparing message */
-
GPtrArray *args;
GHashTable *arg_map;
gboolean pending;
diff --git a/libgupnp/gupnp-service-proxy-action.c b/libgupnp/gupnp-service-proxy-action.c
index aeb90cd..d629a53 100644
--- a/libgupnp/gupnp-service-proxy-action.c
+++ b/libgupnp/gupnp-service-proxy-action.c
@@ -57,8 +57,7 @@ read_out_parameter (const char *arg_name,
/* Checks an action response for errors and returns the parsed
* xmlDoc object. */
static xmlDoc *
-check_action_response (G_GNUC_UNUSED GUPnPServiceProxy *proxy,
- GUPnPServiceProxyAction *action,
+check_action_response (GUPnPServiceProxyAction *action,
xmlNode **params,
GError **error)
{
@@ -245,7 +244,6 @@ action_dispose (GUPnPServiceProxyAction *action)
action->cancellable_connection_id);
}
g_clear_object (&action->cancellable);
- g_clear_error (&action->error);
g_clear_object (&action->msg);
if (action->msg_str != NULL) {
g_string_free (action->msg_str, TRUE);
@@ -590,18 +588,9 @@ gupnp_service_proxy_action_get_result_list (GUPnPServiceProxyAction *action,
g_return_val_if_fail (action, FALSE);
- /* Check for saved error from begin_action() */
- if (action->error) {
- g_propagate_error (error, g_error_copy (action->error));
-
- return FALSE;
- }
-
/* Check response for errors and do initial parsing */
- response = check_action_response (NULL, action, ¶ms, &action->error);
+ response = check_action_response (action, ¶ms, error);
if (response == NULL) {
- g_propagate_error (error, g_error_copy (action->error));
-
return FALSE;
}
@@ -698,18 +687,9 @@ gupnp_service_proxy_action_get_result_hash (GUPnPServiceProxyAction *action,
g_return_val_if_fail (action, FALSE);
- /* Check for saved error from begin_action() */
- if (action->error) {
- g_propagate_error (error, g_error_copy (action->error));
-
- return FALSE;
- }
-
/* Check response for errors and do initial parsing */
- response = check_action_response (NULL, action, ¶ms, &action->error);
+ response = check_action_response (action, ¶ms, error);
if (response == NULL) {
- g_propagate_error (error, g_error_copy (action->error));
-
return FALSE;
}
diff --git a/libgupnp/gupnp-service-proxy.c b/libgupnp/gupnp-service-proxy.c
index 66ba886..23739b1 100644
--- a/libgupnp/gupnp-service-proxy.c
+++ b/libgupnp/gupnp-service-proxy.c
@@ -364,246 +364,6 @@ gupnp_service_proxy_class_init (GUPnPServiceProxyClass *klass)
G_TYPE_POINTER);
}
-/**
- * gupnp_service_proxy_send_action:
- * @proxy: A #GUPnPServiceProxy
- * @action: An action
- * @error: (inout)(optional)(nullable): The location where to store any error, or %NULL
- * @...: tuples of in parameter name, in parameter type, and in parameter
- * value, followed by %NULL, and then tuples of out parameter name,
- * out parameter type, and out parameter value location, terminated with %NULL
- *
- * Sends action @action with parameters @Varargs to the service exposed by
- * @proxy synchronously.
- *
- * If an error occurred, @error will be set. In case of
- * an UPnP error the error code will be the same in @error.
- *
- * Return value: %TRUE if sending the action was successful.
- *
- * Deprecated: 1.2.0: Use gupnp_service_proxy_action_new() and
- * gupnp_service_proxy_call_action()
- **/
-gboolean
-gupnp_service_proxy_send_action (GUPnPServiceProxy *proxy,
- const char *action,
- GError **error,
- ...)
-{
- va_list var_args;
- gboolean ret;
-
- va_start (var_args, error);
- G_GNUC_BEGIN_IGNORE_DEPRECATIONS
- ret = gupnp_service_proxy_send_action_valist (proxy,
- action,
- error,
- var_args);
- G_GNUC_END_IGNORE_DEPRECATIONS
- va_end (var_args);
-
- return ret;
-}
-
-/**
- * gupnp_service_proxy_send_action_valist:
- * @proxy: A #GUPnPServiceProxy
- * @action: An action
- * @error: (inout)(optional)(nullable): The location where to store any error, or %NULL
- * @var_args: va_list of tuples of in parameter name, in parameter type, and in
- * parameter value, followed by %NULL, and then tuples of out parameter name,
- * out parameter type, and out parameter value location
- *
- * See gupnp_service_proxy_send_action().
- *
- * Return value: %TRUE if sending the action was successful.
- *
- * Deprecated: 1.2.0
- **/
-gboolean
-gupnp_service_proxy_send_action_valist (GUPnPServiceProxy *proxy,
- const char *action_name,
- GError **error,
- va_list var_args)
-{
- GList *in_names = NULL, *in_values = NULL;
- GHashTable *out_hash = NULL;
- va_list var_args_copy;
- gboolean result;
- GError *local_error;
- GUPnPServiceProxyAction *handle;
-
- g_return_val_if_fail (GUPNP_IS_SERVICE_PROXY (proxy), FALSE);
- g_return_val_if_fail (action_name, FALSE);
-
-
- VAR_ARGS_TO_IN_LIST (var_args, in_names, in_values);
- G_VA_COPY (var_args_copy, var_args);
- out_hash = g_hash_table_new_full (g_str_hash,
- g_str_equal,
- g_free,
- gvalue_free);
- VAR_ARGS_TO_OUT_HASH_TABLE (var_args, out_hash);
-
- handle = gupnp_service_proxy_action_new_from_list (action_name, in_names, in_values);
-
- if (gupnp_service_proxy_call_action (proxy, handle, NULL, error) == NULL) {
- result = FALSE;
- goto out;
- }
-
- result = gupnp_service_proxy_action_get_result_hash (handle,
- out_hash,
- &local_error);
-
- if (local_error == NULL) {
- OUT_HASH_TABLE_TO_VAR_ARGS (out_hash, var_args_copy);
- } else {
- g_propagate_error (error, local_error);
- }
-out:
- gupnp_service_proxy_action_unref (handle);
- va_end (var_args_copy);
- g_list_free_full (in_names, g_free);
- g_list_free_full (in_values, gvalue_free);
- g_hash_table_unref (out_hash);
-
- return result;
-}
-
-/**
- * gupnp_service_proxy_send_action_list:
- * @proxy: (transfer none): A #GUPnPServiceProxy
- * @action: An action
- * @in_names: (element-type utf8) (transfer none): #GList of 'in' parameter
- * names (as strings)
- * @in_values: (element-type GValue) (transfer none): #GList of values (as
- * #GValue) that line up with @in_names
- * @out_names: (element-type utf8) (transfer none): #GList of 'out' parameter
- * names (as strings)
- * @out_types: (element-type GType) (transfer none): #GList of types (as #GType)
- * that line up with @out_names
- * @out_values: (element-type GValue) (transfer full) (out): #GList of values
- * (as #GValue) that line up with @out_names and @out_types.
- * @error: (inout)(optional)(nullable): The location where to store any error, or %NULL
- *
- * The synchronous variant of [class@GUPnP.ServiceProxy.begin_action_list] and
- * [class@GUPnP.ServiceProxy.end_action_list].
- *
- * Return value: %TRUE if sending the action was successful.
- *
- * Deprecated: 1.2.0: Use gupnp_service_proxy_action_new_from_list() and gupnp_service_proxy_call_action()
- *
- **/
-gboolean
-gupnp_service_proxy_send_action_list (GUPnPServiceProxy *proxy,
- const char *action,
- GList *in_names,
- GList *in_values,
- GList *out_names,
- GList *out_types,
- GList **out_values,
- GError **error)
-{
- GUPnPServiceProxyAction *handle;
- gboolean result = FALSE;
-
- g_return_val_if_fail (GUPNP_IS_SERVICE_PROXY (proxy), FALSE);
- g_return_val_if_fail (action, FALSE);
-
- handle = gupnp_service_proxy_action_new_from_list (action, in_names, in_values);
-
- if (gupnp_service_proxy_call_action (proxy, handle, NULL, error) == NULL) {
- result = FALSE;
-
- goto out;
- }
-
- result = gupnp_service_proxy_action_get_result_list (handle,
- out_names,
- out_types,
- out_values,
- error);
-out:
- gupnp_service_proxy_action_unref (handle);
-
- return result;
-}
-
-static void
-on_legacy_async_callback (GObject *source, GAsyncResult *res, gpointer user_data)
-{
- GError *error = NULL;
- GUPnPServiceProxyAction *action;
-
- gupnp_service_proxy_call_action_finish (GUPNP_SERVICE_PROXY (source), res, &error);
- action = (GUPnPServiceProxyAction *) user_data;
-
- /* Do not perform legacy call-back if action is cancelled, to comply with the old implementation */
- if (action->callback != NULL &&
- !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
- if (error != NULL)
- g_propagate_error (&action->error, error);
- action->callback (action->proxy, action, action->user_data);
- }
-
- g_clear_error (&error);
-}
-
-/**
- * gupnp_service_proxy_begin_action:
- * @proxy: A #GUPnPServiceProxy
- * @action: An action
- * @callback: (scope async): The callback to call when sending the action has succeeded
- * or failed
- * @user_data: User data for @callback
- * @...: tuples of in parameter name, in parameter type, and in parameter
- * value, terminated with %NULL
- *
- * Sends action @action with parameters @Varargs to the service exposed by
- * @proxy asynchronously, calling @callback on completion. From @callback, call
- * gupnp_service_proxy_end_action() to check for errors, to retrieve return
- * values, and to free the #GUPnPServiceProxyAction.
- *
- * Returns: (transfer none): A #GUPnPServiceProxyAction handle. This will be freed when
- * gupnp_service_proxy_cancel_action() or
- * gupnp_service_proxy_end_action_valist().
- *
- * Deprecated: 1.2.0: Use gupnp_service_proxy_action_new() and
- * gupnp_service_proxy_call_action_async()
- **/
-GUPnPServiceProxyAction *
-gupnp_service_proxy_begin_action (GUPnPServiceProxy *proxy,
- const char *action,
- GUPnPServiceProxyActionCallback callback,
- gpointer user_data,
- ...)
-{
- GUPnPServiceProxyAction *ret;
- GList *in_names = NULL;
- GList *in_values = NULL;
- va_list var_args;
-
- va_start (var_args, user_data);
- VAR_ARGS_TO_IN_LIST (var_args, in_names, in_values);
- va_end (var_args);
-
- ret = gupnp_service_proxy_action_new_from_list (action, in_names, in_values);
- g_list_free_full (in_names, g_free);
- g_list_free_full (in_values, gvalue_free);
-
- ret->callback = callback;
- ret->user_data = user_data;
-
- gupnp_service_proxy_call_action_async (proxy,
- ret,
- NULL,
- on_legacy_async_callback,
- ret);
-
- return ret;
-}
-
static void
on_action_cancelled (GCancellable *cancellable, gpointer user_data)
{
@@ -804,304 +564,6 @@ gupnp_service_proxy_action_queue_task (GTask *task)
action->pending = TRUE;
}
-/**
- * gupnp_service_proxy_begin_action_valist:
- * @proxy: A #GUPnPServiceProxy
- * @action: An action
- * @callback: (scope async) : The callback to call when sending the action has succeeded
- * or failed
- * @user_data: User data for @callback
- * @var_args: A va_list of tuples of in parameter name, in parameter type, and
- * in parameter value
- *
- * See gupnp_service_proxy_begin_action().
- *
- * Returns: (transfer none): A #GUPnPServiceProxyAction handle. This will
- * be freed when calling gupnp_service_proxy_cancel_action() or
- * gupnp_service_proxy_end_action_valist().
- *
- * Deprecated: 1.2.0
- **/
-GUPnPServiceProxyAction *
-gupnp_service_proxy_begin_action_valist
- (GUPnPServiceProxy *proxy,
- const char *action,
- GUPnPServiceProxyActionCallback callback,
- gpointer user_data,
- va_list var_args)
-{
- GUPnPServiceProxyAction *ret;
- GList *in_names = NULL;
- GList *in_values = NULL;
-
- VAR_ARGS_TO_IN_LIST (var_args, in_names, in_values);
-
- ret = gupnp_service_proxy_action_new_from_list (action, in_names, in_values);
- g_list_free_full (in_names, g_free);
- g_list_free_full (in_values, gvalue_free);
-
- ret->callback = callback;
- ret->user_data = user_data;
-
- gupnp_service_proxy_call_action_async (proxy,
- ret,
- NULL,
- on_legacy_async_callback,
- ret);
-
- return ret;
-
-}
-
-/**
- * gupnp_service_proxy_begin_action_list:
- * @proxy: (transfer none): A #GUPnPServiceProxy
- * @action: An action
- * @in_names: (element-type utf8) (transfer none): #GList of 'in' parameter
- * names (as strings)
- * @in_values: (element-type GValue) (transfer none): #GList of values (as
- * #GValue) that line up with @in_names
- * @callback: (scope async) : The callback to call when sending the action has succeeded or
- * failed
- * @user_data: User data for @callback
- *
- * A variant of #gupnp_service_proxy_begin_action that takes lists of
- * in-parameter names, types and values.
- *
- * Return value: (transfer none): A #GUPnPServiceProxyAction handle. This will
- * be freed when calling gupnp_service_proxy_cancel_action() or
- * gupnp_service_proxy_end_action_list().
- *
- * Since: 0.14.0
- **/
-GUPnPServiceProxyAction *
-gupnp_service_proxy_begin_action_list
- (GUPnPServiceProxy *proxy,
- const char *action,
- GList *in_names,
- GList *in_values,
- GUPnPServiceProxyActionCallback callback,
- gpointer user_data)
-{
- GUPnPServiceProxyAction *ret;
-
- ret = gupnp_service_proxy_action_new_from_list (action, in_names, in_values);
-
- ret->callback = callback;
- ret->user_data = user_data;
-
- gupnp_service_proxy_call_action_async (proxy,
- ret,
- NULL,
- on_legacy_async_callback,
- ret);
-
- return ret;
-}
-
-/**
- * gupnp_service_proxy_end_action:
- * @proxy: A #GUPnPServiceProxy
- * @action: A #GUPnPServiceProxyAction handle
- * @error: (inout)(optional)(nullable): The location where to store any error, or %NULL
- * @...: tuples of out parameter name, out parameter type, and out parameter
- * value location, terminated with %NULL. The out parameter values should be
- * freed after use
- *
- * Retrieves the result of @action. The out parameters in @Varargs will be
- * filled in, and if an error occurred, @error will be set. In case of
- * an UPnP error the error code will be the same in @error.
- *
- * Return value: %TRUE on success.
- **/
-gboolean
-gupnp_service_proxy_end_action (GUPnPServiceProxy *proxy,
- GUPnPServiceProxyAction *action,
- GError **error,
- ...)
-{
- va_list var_args;
- gboolean ret;
-
- g_return_val_if_fail (GUPNP_IS_SERVICE_PROXY (proxy), FALSE);
- g_return_val_if_fail (action, FALSE);
-
- if (action->error) {
- g_propagate_error (error, action->error);
- gupnp_service_proxy_action_unref (action);
-
- return FALSE;
- }
-
-
- va_start (var_args, error);
- ret = gupnp_service_proxy_action_get_result_valist (action, error, var_args);
- va_end (var_args);
-
- gupnp_service_proxy_action_unref (action);
-
- return ret;
-}
-
-/**
- * gupnp_service_proxy_end_action_valist:
- * @proxy: A #GUPnPServiceProxy
- * @action: A #GUPnPServiceProxyAction handle
- * @error: (inout)(optional)(nullable): The location where to store any error, or %NULL
- * @var_args: A va_list of tuples of out parameter name, out parameter type,
- * and out parameter value location. The out parameter values should be
- * freed after use
- *
- * See gupnp_service_proxy_end_action().
- *
- * Return value: %TRUE on success.
- **/
-gboolean
-gupnp_service_proxy_end_action_valist (GUPnPServiceProxy *proxy,
- GUPnPServiceProxyAction *action,
- GError **error,
- va_list var_args)
-{
- gboolean result;
-
- g_return_val_if_fail (GUPNP_IS_SERVICE_PROXY (proxy), FALSE);
- g_return_val_if_fail (action, FALSE);
-
- if (action->error) {
- g_propagate_error (error, action->error);
- gupnp_service_proxy_action_unref (action);
-
- return FALSE;
- }
-
- result = gupnp_service_proxy_action_get_result_valist (action,
- error,
- var_args);
- gupnp_service_proxy_action_unref (action);
-
- return result;
-}
-
-/**
- * gupnp_service_proxy_end_action_list:
- * @proxy: A #GUPnPServiceProxy
- * @action: A #GUPnPServiceProxyAction handle
- * @error:(inout)(optional)(nullable): The location where to store any error, or %NULL
- * @out_names: (element-type utf8) (transfer none): #GList of 'out' parameter
- * names (as strings)
- * @out_types: (element-type GType) (transfer none): #GList of types (as #GType)
- * that line up with @out_names
- * @out_values: (element-type GValue) (transfer full) (out): #GList of values
- * (as #GValue) that line up with @out_names and @out_types.
- *
- * A variant of #gupnp_service_proxy_end_action that takes lists of
- * out-parameter names, types and place-holders for values.
- *
- * The returned list
- * in @out_values must be freed using #g_list_free and each element in it using
- * #g_value_unset and #g_slice_free.
- *
- * Return value : %TRUE on success.
- *
- **/
-gboolean
-gupnp_service_proxy_end_action_list (GUPnPServiceProxy *proxy,
- GUPnPServiceProxyAction *action,
- GList *out_names,
- GList *out_types,
- GList **out_values,
- GError **error)
-{
- gboolean result;
-
- g_return_val_if_fail (GUPNP_IS_SERVICE_PROXY (proxy), FALSE);
- g_return_val_if_fail (action, FALSE);
-
- /* Check for saved error from begin_action() */
- if (action->error) {
- g_propagate_error (error, action->error);
- gupnp_service_proxy_action_unref (action);
-
- return FALSE;
- }
-
- result = gupnp_service_proxy_action_get_result_list (action,
- out_names,
- out_types,
- out_values,
- error);
- gupnp_service_proxy_action_unref (action);
-
- return result;
-}
-
-/**
- * gupnp_service_proxy_end_action_hash:
- * @proxy: A #GUPnPServiceProxy
- * @action: A #GUPnPServiceProxyAction handle
- * @error:(inout)(optional)(nullable): The location where to store any error, or %NULL
- * @hash: (element-type utf8 GValue) (inout) (transfer none): A #GHashTable of
- * out parameter name and initialised #GValue pairs
- *
- * See gupnp_service_proxy_end_action(); this version takes a #GHashTable for
- * runtime generated parameter lists.
- *
- * Return value: %TRUE on success.
- *
- **/
-gboolean
-gupnp_service_proxy_end_action_hash
- (GUPnPServiceProxy *proxy,
- GUPnPServiceProxyAction *action,
- GHashTable *hash,
- GError **error)
-{
- gboolean result;
-
- g_return_val_if_fail (GUPNP_IS_SERVICE_PROXY (proxy), FALSE);
- g_return_val_if_fail (action, FALSE);
-
- /* Check for saved error from begin_action() */
- if (action->error) {
- g_propagate_error (error, action->error);
- gupnp_service_proxy_action_unref (action);
-
- return FALSE;
- }
-
-
- result = gupnp_service_proxy_action_get_result_hash (action,
- hash,
- error);
- gupnp_service_proxy_action_unref (action);
-
- return result;
-}
-
-/**
- * gupnp_service_proxy_cancel_action:
- * @proxy: A #GUPnPServiceProxy
- * @action: A #GUPnPServiceProxyAction handle
- *
- * Cancels @action, freeing the @action handle.
- *
- * Deprecated: 1.2.0: Use the #GCancellable passed to
- * gupnp_service_proxy_call_action_async() or gupnp_service_proxy_call_action()
- **/
-void
-gupnp_service_proxy_cancel_action (GUPnPServiceProxy *proxy,
- GUPnPServiceProxyAction *action)
-{
- g_return_if_fail (GUPNP_IS_SERVICE_PROXY (proxy));
- g_return_if_fail (action);
-
- if (action->cancellable != NULL) {
- g_cancellable_cancel (action->cancellable);
- }
-
- gupnp_service_proxy_action_unref (action);
-}
-
/**
* gupnp_service_proxy_add_notify: (skip)
* @proxy: A #GUPnPServiceProxy
diff --git a/libgupnp/gupnp-service-proxy.h b/libgupnp/gupnp-service-proxy.h
index 7c4b8e9..ad29553 100644
--- a/libgupnp/gupnp-service-proxy.h
+++ b/libgupnp/gupnp-service-proxy.h
@@ -54,21 +54,6 @@ struct _GUPnPServiceProxyClass {
**/
typedef struct _GUPnPServiceProxyAction GUPnPServiceProxyAction;
-/**
- * GUPnPServiceProxyActionCallback:
- * @proxy: The #GUPnPServiceProxy @action is called from
- * @action: The #GUPnPServiceProxyAction in progress
- * @user_data: User data
- *
- * Callback notifying that @action on @proxy has returned and
- * gupnp_service_proxy_end_action() etc can be called.
- * Deprecated: 1.2.0
- **/
-typedef void (* GUPnPServiceProxyActionCallback) (
- GUPnPServiceProxy *proxy,
- GUPnPServiceProxyAction *action,
- gpointer user_data);
-
/**
* GUPnPServiceProxyNotifyCallback:
* @proxy: The #GUPnPServiceProxy the notification originates from
@@ -84,86 +69,6 @@ typedef void (* GUPnPServiceProxyNotifyCallback) (GUPnPServiceProxy *proxy,
GValue *value,
gpointer user_data);
-G_DEPRECATED gboolean
-gupnp_service_proxy_send_action (GUPnPServiceProxy *proxy,
- const char *action,
- GError **error,
- ...) G_GNUC_NULL_TERMINATED;
-
-G_DEPRECATED gboolean
-gupnp_service_proxy_send_action_valist
- (GUPnPServiceProxy *proxy,
- const char *action,
- GError **error,
- va_list var_args);
-
-G_DEPRECATED gboolean
-gupnp_service_proxy_send_action_list (GUPnPServiceProxy *proxy,
- const char *action,
- GList *in_names,
- GList *in_values,
- GList *out_names,
- GList *out_types,
- GList **out_values,
- GError **error);
-
-G_DEPRECATED GUPnPServiceProxyAction *
-gupnp_service_proxy_begin_action (GUPnPServiceProxy *proxy,
- const char *action,
- GUPnPServiceProxyActionCallback callback,
- gpointer user_data,
- ...) G_GNUC_NULL_TERMINATED;
-
-G_DEPRECATED GUPnPServiceProxyAction *
-gupnp_service_proxy_begin_action_valist
- (GUPnPServiceProxy *proxy,
- const char *action,
- GUPnPServiceProxyActionCallback callback,
- gpointer user_data,
- va_list var_args);
-
-G_DEPRECATED GUPnPServiceProxyAction *
-gupnp_service_proxy_begin_action_list
- (GUPnPServiceProxy *proxy,
- const char *action,
- GList *in_names,
- GList *in_values,
- GUPnPServiceProxyActionCallback callback,
- gpointer user_data);
-
-G_DEPRECATED gboolean
-gupnp_service_proxy_end_action (GUPnPServiceProxy *proxy,
- GUPnPServiceProxyAction *action,
- GError **error,
- ...) G_GNUC_NULL_TERMINATED;
-
-G_DEPRECATED gboolean
-gupnp_service_proxy_end_action_valist
- (GUPnPServiceProxy *proxy,
- GUPnPServiceProxyAction *action,
- GError **error,
- va_list var_args);
-
-G_DEPRECATED gboolean
-gupnp_service_proxy_end_action_list
- (GUPnPServiceProxy *proxy,
- GUPnPServiceProxyAction *action,
- GList *out_names,
- GList *out_types,
- GList **out_values,
- GError **error);
-
-G_DEPRECATED gboolean
-gupnp_service_proxy_end_action_hash
- (GUPnPServiceProxy *proxy,
- GUPnPServiceProxyAction *action,
- GHashTable *hash,
- GError **error);
-
-G_DEPRECATED void
-gupnp_service_proxy_cancel_action (GUPnPServiceProxy *proxy,
- GUPnPServiceProxyAction *action);
-
gboolean
gupnp_service_proxy_add_notify (GUPnPServiceProxy *proxy,
const char *variable,
diff --git a/libgupnp/gupnp.h b/libgupnp/gupnp.h
index 8c85d7d..fcc9e49 100644
--- a/libgupnp/gupnp.h
+++ b/libgupnp/gupnp.h
@@ -23,5 +23,4 @@
#include <libgupnp/gupnp-service.h>
#include <libgupnp/gupnp-types.h>
#include <libgupnp/gupnp-uuid.h>
-#include <libgupnp/gupnp-white-list.h>
#include <libgupnp/gupnp-xml-doc.h>
diff --git a/libgupnp/meson.build b/libgupnp/meson.build
index bb186be..e0a7c3d 100644
--- a/libgupnp/meson.build
+++ b/libgupnp/meson.build
@@ -61,7 +61,6 @@ headers = files(
'gupnp-service-proxy.h',
'gupnp-types.h',
'gupnp-uuid.h',
- 'gupnp-white-list.h',
'gupnp-xml-doc.h'
)
install_headers(headers, subdir : GUPNP_API_NAME / 'libgupnp')
@@ -86,7 +85,6 @@ sources = files(
'gupnp-service-proxy-action.c',
'gupnp-simple-context-manager.c',
'gupnp-types.c',
- 'gupnp-white-list.c',
'gupnp-xml-doc.c',
'gvalue-util.c',
'http-headers.c',
diff --git a/tests/test-bugs.c b/tests/test-bugs.c
index 563e758..271e607 100644
--- a/tests/test-bugs.c
+++ b/tests/test-bugs.c
@@ -87,18 +87,26 @@ test_bgo_696762_on_browse_call (G_GNUC_UNUSED GUPnPService *service,
g_assert (node != NULL);
g_assert_cmpstr ((const char *) node->name, ==, "SortCriteria");
- node = node->next;
gupnp_service_action_return_success (action);
}
static void
-test_bgo_696762_on_browse (G_GNUC_UNUSED GUPnPServiceProxy *proxy,
- G_GNUC_UNUSED GUPnPServiceProxyAction *action,
+test_bgo_696762_on_browse (GObject *object,
+ GAsyncResult *res,
gpointer user_data)
{
- TestServiceProxyData *data = (TestServiceProxyData *) user_data;
+ TestServiceProxyData *data = (TestServiceProxyData *) user_data;
+ GError *error = NULL;
- g_main_loop_quit (data->loop);
+ GUPnPServiceProxyAction *action =
+ gupnp_service_proxy_call_action_finish (
+ GUPNP_SERVICE_PROXY (object),
+ res,
+ &error);
+ g_assert_nonnull (action);
+ g_assert_no_error (error);
+
+ g_main_loop_quit (data->loop);
}
static void
@@ -221,19 +229,33 @@ test_bgo_696762 (void)
test_run_loop (data.loop, g_test_get_path ());
g_assert (data.proxy != NULL);
- G_GNUC_BEGIN_IGNORE_DEPRECATIONS
- gupnp_service_proxy_begin_action (data.proxy,
- "Browse",
- test_bgo_696762_on_browse,
- &data,
- "ObjectID", G_TYPE_STRING, "0",
- "BrowseFlag", G_TYPE_STRING, "BrowseDirectChildren",
- "Filter", G_TYPE_STRING, "res,dc:date,res@size",
- "StartingIndex", G_TYPE_UINT, 0,
- "RequestedCount", G_TYPE_UINT, 0,
- "SortCriteria", G_TYPE_STRING, "",
- NULL);
- G_GNUC_END_IGNORE_DEPRECATIONS
+ GUPnPServiceProxyAction *action;
+ action = gupnp_service_proxy_action_new ("Browse",
+ "ObjectID",
+ G_TYPE_STRING,
+ "0",
+ "BrowseFlag",
+ G_TYPE_STRING,
+ "BrowseDirectChildren",
+ "Filter",
+ G_TYPE_STRING,
+ "res,dc:date,res@size",
+ "StartingIndex",
+ G_TYPE_UINT,
+ 0,
+ "RequestedCount",
+ G_TYPE_UINT,
+ 0,
+ "SortCriteria",
+ G_TYPE_STRING,
+ "",
+ NULL);
+
+ gupnp_service_proxy_call_action_async (data.proxy,
+ action,
+ NULL,
+ test_bgo_696762_on_browse,
+ &data);
test_run_loop (data.loop, g_test_get_path ());
@@ -522,143 +544,6 @@ test_ggo_24 (void)
validate_host_header ("[fe80::01%eth0]", "fe80::acab", 4711));
}
-/*
- * Test that the legacy async _end_action calls still work
- *
- * https://gitlab.gnome.org/GNOME/gupnp/-/issues/58
- */
-
-static void
-test_ggo_58_on_ping (GUPnPServiceProxy *proxy,
- GUPnPServiceProxyAction *action,
- gpointer user_data)
-{
- TestServiceProxyData *data = (TestServiceProxyData *) user_data;
-
- g_main_loop_quit (data->loop);
-}
-
-static void
-test_ggo_58_on_ping_call (GUPnPService *service,
- GUPnPServiceAction *action,
- gpointer user_data)
-{
- gupnp_service_action_return_success (action);
-}
-
-static void
-test_ggo_58 ()
-{
- GUPnPContext *context = NULL;
- GError *error = NULL;
- GUPnPControlPoint *cp = NULL;
- GUPnPRootDevice *rd;
- TestServiceProxyData data = { NULL, NULL };
- GUPnPServiceInfo *info = NULL;
-
- data.loop = g_main_loop_new (NULL, FALSE);
-
- context = create_context (0, &error);
- g_assert_no_error (error);
- g_assert (context != NULL);
-
- cp = gupnp_control_point_new (
- context,
- "urn:test-gupnp-org:service:TestService:1");
-
- gssdp_resource_browser_set_active (GSSDP_RESOURCE_BROWSER (cp), TRUE);
-
- g_signal_connect (G_OBJECT (cp),
- "service-proxy-available",
- G_CALLBACK (test_on_sp_available),
- &data);
-
-
- rd = gupnp_root_device_new (context,
- "TestDevice.xml",
- DATA_PATH,
- &error);
- g_assert_no_error (error);
- g_assert (rd != NULL);
- gupnp_root_device_set_available (rd, TRUE);
- info = gupnp_device_info_get_service (
- GUPNP_DEVICE_INFO (rd),
- "urn:test-gupnp-org:service:TestService:1");
- g_signal_connect (G_OBJECT (info),
- "action-invoked::Ping",
- G_CALLBACK (test_ggo_58_on_ping_call),
- &data);
-
- test_run_loop (data.loop, g_test_get_path());
- g_assert (data.proxy != NULL);
-
- G_GNUC_BEGIN_IGNORE_DEPRECATIONS
- GUPnPServiceProxyAction *action =
- gupnp_service_proxy_begin_action (data.proxy,
- "Ping",
- test_ggo_58_on_ping,
- &data,
- NULL);
-
- test_run_loop (data.loop, g_test_get_path());
-
- gboolean success = gupnp_service_proxy_end_action (data.proxy,
- action,
- &error,
- NULL);
-
- g_assert (success);
- g_assert_no_error (error);
-
- action = gupnp_service_proxy_begin_action (data.proxy,
- "Ping",
- test_ggo_58_on_ping,
- &data,
- NULL);
-
- test_run_loop (data.loop, g_test_get_path());
-
- GHashTable *result_hash = g_hash_table_new (g_str_hash, g_str_equal);
-
- success = gupnp_service_proxy_end_action_hash (data.proxy,
- action,
- result_hash,
- &error);
- g_hash_table_destroy (result_hash);
-
- g_assert (success);
- g_assert_no_error (error);
-
- action = gupnp_service_proxy_begin_action (data.proxy,
- "Ping",
- test_ggo_58_on_ping,
- &data,
- NULL);
-
- test_run_loop (data.loop, g_test_get_path());
-
- GList *result_list = NULL;
- success = gupnp_service_proxy_end_action_list (data.proxy,
- action,
- NULL,
- NULL,
- &result_list,
- &error);
-
- g_assert (success);
- g_assert_no_error (error);
-
- G_GNUC_END_IGNORE_DEPRECATIONS
-
- g_object_unref (info);
- g_object_unref (data.proxy);
- g_object_unref (cp);
- g_object_unref (rd);
- g_object_unref (context);
-
- g_main_loop_unref (data.loop);
-}
-
void
test_ggo_42 ()
{
@@ -695,7 +580,6 @@ main (int argc, char *argv[]) {
g_test_add_func ("/bugs/bgo/722696", test_bgo_722696);
g_test_add_func ("/bugs/bgo/743233", test_bgo_743233);
g_test_add_func ("/bugs/ggo/24", test_ggo_24);
- g_test_add_func ("/bugs/ggo/58", test_ggo_58);
g_test_add_func ("/bugs/ggo/42", test_ggo_42);
return g_test_run ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]