summaryrefslogtreecommitdiff
path: root/libpeas/peas-engine.c
diff options
context:
space:
mode:
authorGarrett Regier <garrettregier@gmail.com>2017-03-24 12:41:09 -0700
committerGarrett Regier <garrettregier@gmail.com>2017-03-24 21:27:15 -0700
commit7e7e850d24a930ffdaf04d0feaf6607fe797f30e (patch)
treedbde908fd4a0969afe0ee49fd668a1f74f540009 /libpeas/peas-engine.c
parent743ca63655ac23c24efed5aad33479fa1f4faadf (diff)
downloadlibpeas-7e7e850d24a930ffdaf04d0feaf6607fe797f30e.tar.gz
Allow extensions to be an Abstract Base Class
https://bugzilla.gnome.org/show_bug.cgi?id=767223
Diffstat (limited to 'libpeas/peas-engine.c')
-rw-r--r--libpeas/peas-engine.c33
1 files changed, 26 insertions, 7 deletions
diff --git a/libpeas/peas-engine.c b/libpeas/peas-engine.c
index 3b35145..5713cb0 100644
--- a/libpeas/peas-engine.c
+++ b/libpeas/peas-engine.c
@@ -57,6 +57,9 @@
* plugins and their extensions from within your application.</para>
* </listitem>
* </itemizedlist>
+ *
+ * Since libpeas 1.22, @extension_type can be an Abstract #GType
+ * and not just an Interface #GType.
**/
/* Signals */
@@ -1274,6 +1277,9 @@ peas_engine_unload_plugin (PeasEngine *engine,
* Returns if @info provides an extension for @extension_type.
* If the @info is not loaded than %FALSE will always be returned.
*
+ * Since libpeas 1.22, @extension_type can be an Abstract #GType
+ * and not just an Interface #GType.
+ *
* Returns: if @info provides an extension for @extension_type.
*/
gboolean
@@ -1285,7 +1291,8 @@ peas_engine_provides_extension (PeasEngine *engine,
g_return_val_if_fail (PEAS_IS_ENGINE (engine), FALSE);
g_return_val_if_fail (info != NULL, FALSE);
- g_return_val_if_fail (G_TYPE_IS_INTERFACE (extension_type), FALSE);
+ g_return_val_if_fail (G_TYPE_IS_INTERFACE (extension_type) ||
+ G_TYPE_IS_ABSTRACT (extension_type), FALSE);
if (!peas_plugin_info_is_loaded (info))
return FALSE;
@@ -1303,10 +1310,13 @@ peas_engine_provides_extension (PeasEngine *engine,
* @parameters: (allow-none) (array length=n_parameters):
* an array of #GParameter.
*
- * If the plugin identified by @info implements the @extension_type interface,
+ * If the plugin identified by @info implements the @extension_type,
* then this function will return a new instance of this implementation,
* wrapped in a new #PeasExtension instance. Otherwise, it will return %NULL.
*
+ * Since libpeas 1.22, @extension_type can be an Abstract #GType
+ * and not just an Interface #GType.
+ *
* See peas_engine_create_extension() for more information.
*
* Returns: (transfer full): a new instance of #PeasExtension wrapping
@@ -1324,8 +1334,9 @@ peas_engine_create_extensionv (PeasEngine *engine,
g_return_val_if_fail (PEAS_IS_ENGINE (engine), NULL);
g_return_val_if_fail (info != NULL, NULL);
+ g_return_val_if_fail (G_TYPE_IS_INTERFACE (extension_type) ||
+ G_TYPE_IS_ABSTRACT (extension_type), NULL);
g_return_val_if_fail (peas_plugin_info_is_loaded (info), NULL);
- g_return_val_if_fail (G_TYPE_IS_INTERFACE (extension_type), FALSE);
loader = get_plugin_loader (engine, info->loader_id);
extension = peas_plugin_loader_create_extension (loader, info, extension_type,
@@ -1351,10 +1362,13 @@ peas_engine_create_extensionv (PeasEngine *engine,
* @var_args: the value of the first property, followed optionally by more
* name/value pairs, followed by %NULL.
*
- * If the plugin identified by @info implements the @extension_type interface,
+ * If the plugin identified by @info implements the @extension_type,
* then this function will return a new instance of this implementation,
* wrapped in a new #PeasExtension instance. Otherwise, it will return %NULL.
*
+ * Since libpeas 1.22, @extension_type can be an Abstract #GType
+ * and not just an Interface #GType.
+ *
* See peas_engine_create_extension() for more information.
*
* Returns: a new instance of #PeasExtension wrapping
@@ -1374,7 +1388,8 @@ peas_engine_create_extension_valist (PeasEngine *engine,
g_return_val_if_fail (PEAS_IS_ENGINE (engine), NULL);
g_return_val_if_fail (info != NULL, NULL);
g_return_val_if_fail (peas_plugin_info_is_loaded (info), NULL);
- g_return_val_if_fail (G_TYPE_IS_INTERFACE (extension_type), FALSE);
+ g_return_val_if_fail (G_TYPE_IS_INTERFACE (extension_type) ||
+ G_TYPE_IS_ABSTRACT (extension_type), FALSE);
if (!peas_utils_valist_to_parameter_list (extension_type, first_property,
var_args, &parameters,
@@ -1403,7 +1418,7 @@ peas_engine_create_extension_valist (PeasEngine *engine,
* @...: the value of the first property, followed optionally by more
* name/value pairs, followed by %NULL.
*
- * If the plugin identified by @info implements the @extension_type interface,
+ * If the plugin identified by @info implements the @extension_type,
* then this function will return a new instance of this implementation,
* wrapped in a new #PeasExtension instance. Otherwise, it will return %NULL.
*
@@ -1416,6 +1431,9 @@ peas_engine_create_extension_valist (PeasEngine *engine,
* principle of never giving you the actual object (also because it might as
* well *not* be an actual object).
*
+ * Since libpeas 1.22, @extension_type can be an Abstract #GType
+ * and not just an Interface #GType.
+ *
* Returns: a new instance of #PeasExtension wrapping
* the @extension_type instance, or %NULL.
*/
@@ -1432,7 +1450,8 @@ peas_engine_create_extension (PeasEngine *engine,
g_return_val_if_fail (PEAS_IS_ENGINE (engine), NULL);
g_return_val_if_fail (info != NULL, NULL);
g_return_val_if_fail (peas_plugin_info_is_loaded (info), NULL);
- g_return_val_if_fail (G_TYPE_IS_INTERFACE (extension_type), FALSE);
+ g_return_val_if_fail (G_TYPE_IS_INTERFACE (extension_type) ||
+ G_TYPE_IS_ABSTRACT (extension_type), FALSE);
va_start (var_args, first_property);
exten = peas_engine_create_extension_valist (engine, info, extension_type,