diff options
author | Christian Hergert <chergert@redhat.com> | 2023-03-16 17:46:14 -0700 |
---|---|---|
committer | Christian Hergert <chergert@redhat.com> | 2023-03-22 16:44:35 -0700 |
commit | 864773417d74265d4e137e15d4004413fa6171df (patch) | |
tree | 2bfe943af947b1e62c810a3a712c9ab63bebee80 /libpeas | |
parent | 9789800fc8a1620d8e0a2bf07cb5672fca94585b (diff) | |
download | libpeas-864773417d74265d4e137e15d4004413fa6171df.tar.gz |
janitorial: remove peas_extension_call() and variants
These are deprecated and can be removed from future versions.
Diffstat (limited to 'libpeas')
-rw-r--r-- | libpeas/peas-extension.c | 187 | ||||
-rw-r--r-- | libpeas/peas-extension.h | 37 |
2 files changed, 4 insertions, 220 deletions
diff --git a/libpeas/peas-extension.c b/libpeas/peas-extension.c index 0fb8c8d..7fd19f0 100644 --- a/libpeas/peas-extension.c +++ b/libpeas/peas-extension.c @@ -24,7 +24,6 @@ #include "config.h" #include "peas-extension.h" -#include "peas-introspection.h" /** * PeasExtension: @@ -63,52 +62,7 @@ peas_extension_get_type (void) return G_TYPE_OBJECT; } -static -G_DEFINE_QUARK (peas-extension-type, extension_type) - -static GICallableInfo * -get_method_info (PeasExtension *exten, - const gchar *method_name, - GType *gtype) -{ - guint i; - GType exten_type; - GType *interfaces; - GICallableInfo *method_info; - - /* Must prioritize the initial GType */ - exten_type = peas_extension_get_extension_type (exten); - method_info = peas_gi_get_method_info (exten_type, method_name); - - if (method_info != NULL) - { - if (gtype != NULL) - *gtype = exten_type; - - return method_info; - } - - interfaces = g_type_interfaces (G_TYPE_FROM_INSTANCE (exten), NULL); - - for (i = 0; interfaces[i] != G_TYPE_INVALID; ++i) - { - method_info = peas_gi_get_method_info (interfaces[i], method_name); - - if (method_info != NULL) - { - if (gtype != NULL) - *gtype = interfaces[i]; - - break; - } - } - - if (method_info == NULL) - g_warning ("Could not find the GType for method '%s'", method_name); - - g_free (interfaces); - return method_info; -} +static G_DEFINE_QUARK (peas-extension-type, extension_type) /** * peas_extension_get_extension_type: @@ -126,142 +80,3 @@ peas_extension_get_extension_type (PeasExtension *exten) return GPOINTER_TO_SIZE (g_object_get_qdata (G_OBJECT (exten), extension_type_quark ())); } - -/** - * peas_extension_call: (skip) - * @exten: A #PeasExtension. - * @method_name: the name of the method that should be called. - * @...: arguments for the method. - * - * Call a method of the object behind @extension. - * - * The arguments provided to this functions should be of the same type as - * those defined in the #GInterface or #GObjectClass used as a base for the - * proxied extension. They should be provided in the same order, and if its - * return type is not void, then a pointer to a variable of that type should - * be passed as the last argument. - * - * For instance, if the method prototype is: - * |[ gint (*my_method) (MyClass *instance, const gchar *str, SomeObject *obj); ]| - * you should call peas_extension_call() this way: - * |[ peas_extension_call (extension, "my_method", "some_str", obj, &gint_var); ]| - * - * This function will not do anything if the introspection data for the proxied - * object's class has not been loaded previously through g_irepository_require(). - * - * Returns: %TRUE on successful call. - * - * Deprecated: 1.2: Use the object directly instead. - */ -gboolean -peas_extension_call (PeasExtension *exten, - const gchar *method_name, - ...) -{ - va_list args; - gboolean result; - - g_return_val_if_fail (PEAS_IS_EXTENSION (exten), FALSE); - g_return_val_if_fail (method_name != NULL, FALSE); - - va_start (args, method_name); - result = peas_extension_call_valist (exten, method_name, args); - va_end (args); - - return result; -} - -/** - * peas_extension_call_valist: (skip) - * @exten: A #PeasExtension. - * @method_name: the name of the method that should be called. - * @args: the arguments for the method. - * - * Call a method of the object behind @extension, using @args as arguments. - * - * See peas_extension_call() for more information. - * - * Returns: %TRUE on successful call. - * - * Deprecated: 1.2: Use the object directly instead. - */ -gboolean -peas_extension_call_valist (PeasExtension *exten, - const gchar *method_name, - va_list args) -{ - GICallableInfo *callable_info; - GITypeInfo retval_info; - GIArgument *gargs; - GIArgument retval; - gpointer retval_ptr; - gboolean ret; - gint n_args; - - g_return_val_if_fail (PEAS_IS_EXTENSION (exten), FALSE); - g_return_val_if_fail (method_name != NULL, FALSE); - - callable_info = get_method_info (exten, method_name, NULL); - - /* Already warned */ - if (callable_info == NULL) - return FALSE; - - n_args = g_callable_info_get_n_args (callable_info); - g_return_val_if_fail (n_args >= 0, FALSE); - gargs = g_newa (GIArgument, n_args); - peas_gi_valist_to_arguments (callable_info, args, gargs, &retval_ptr); - - ret = peas_extension_callv (exten, method_name, gargs, &retval); - - if (retval_ptr != NULL) - { - g_callable_info_load_return_type (callable_info, &retval_info); - peas_gi_argument_to_pointer (&retval_info, &retval, retval_ptr); - } - - g_base_info_unref ((GIBaseInfo *) callable_info); - - return ret; -} - -/** - * peas_extension_callv: (skip) - * @exten: A #PeasExtension. - * @method_name: the name of the method that should be called. - * @args: the arguments for the method. - * @return_value: the return falue for the method. - * - * Call a method of the object behind @extension, using @args as arguments. - * - * See peas_extension_call() for more information. - * - * Returns: %TRUE on successful call. - * - * Deprecated: 1.2: Use the object directly instead. - */ -gboolean -peas_extension_callv (PeasExtension *exten, - const gchar *method_name, - GIArgument *args, - GIArgument *return_value) -{ - GICallableInfo *method_info; - GType gtype; - gboolean success; - - g_return_val_if_fail (PEAS_IS_EXTENSION (exten), FALSE); - g_return_val_if_fail (method_name != NULL, FALSE); - - method_info = get_method_info (exten, method_name, >ype); - - /* Already warned */ - if (method_info == NULL) - return FALSE; - - success = peas_gi_method_call (G_OBJECT (exten), method_info, gtype, - method_name, args, return_value); - - g_base_info_unref (method_info); - return success; -} diff --git a/libpeas/peas-extension.h b/libpeas/peas-extension.h index 6449880..367f5c2 100644 --- a/libpeas/peas-extension.h +++ b/libpeas/peas-extension.h @@ -28,7 +28,6 @@ #endif #include <glib-object.h> -#include <girepository.h> #include "peas-version-macros.h" @@ -37,9 +36,9 @@ G_BEGIN_DECLS /* * Type checking and casting macros */ -#define PEAS_TYPE_EXTENSION (G_TYPE_OBJECT) -#define PEAS_EXTENSION(obj) (G_OBJECT(obj)) -#define PEAS_IS_EXTENSION(obj) (G_IS_OBJECT(obj)) +#define PEAS_TYPE_EXTENSION (G_TYPE_OBJECT) +#define PEAS_EXTENSION(obj) (G_OBJECT(obj)) +#define PEAS_IS_EXTENSION(obj) (G_IS_OBJECT(obj)) /** * PeasExtension: @@ -48,34 +47,4 @@ G_BEGIN_DECLS */ typedef GObject PeasExtension; -/* - * All the public methods of PeasExtension are deprecated and should not be - * used. Due to gi-scanner's touchiness, we also hide these legacy API from - * GI to avoid hairy issues. - */ -#ifndef __GI_SCANNER__ -#ifndef PEAS_DISABLE_DEPRECATED -PEAS_AVAILABLE_IN_ALL -GType peas_extension_get_type (void) G_GNUC_CONST; - -PEAS_AVAILABLE_IN_ALL -GType peas_extension_get_extension_type - (PeasExtension *exten); - -PEAS_AVAILABLE_IN_ALL -gboolean peas_extension_call (PeasExtension *exten, - const gchar *method_name, - ...); -PEAS_AVAILABLE_IN_ALL -gboolean peas_extension_call_valist (PeasExtension *exten, - const gchar *method_name, - va_list args); -PEAS_AVAILABLE_IN_ALL -gboolean peas_extension_callv (PeasExtension *exten, - const gchar *method_name, - GIArgument *args, - GIArgument *return_value); -#endif -#endif - G_END_DECLS |