After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 780685 - Not possible to write a Plugin System in Python because GParameter is not introspectible
Not possible to write a Plugin System in Python because GParameter is not int...
Status: RESOLVED DUPLICATE of bug 660014
Product: libpeas
Classification: Platform
Component: general
git master
Other Linux
: Normal blocker
: ---
Assigned To: libpeas-maint
libpeas-maint
Depends on:
Blocks:
 
 
Reported: 2017-03-29 14:13 UTC by César Fabián Orccón Chipana
Modified: 2017-06-28 15:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Add peas_extension_set_new_with_properties (4.29 KB, patch)
2017-03-29 14:13 UTC, César Fabián Orccón Chipana
none Details | Review
Add peas_extension_set_new_with_properties (4.46 KB, patch)
2017-04-16 20:27 UTC, César Fabián Orccón Chipana
none Details | Review
Add peas_engine_create_extension_with_properties (4.62 KB, patch)
2017-04-21 22:42 UTC, César Fabián Orccón Chipana
none Details | Review
Add peas_extension_set_new_with_properties (4.44 KB, patch)
2017-04-21 22:43 UTC, César Fabián Orccón Chipana
none Details | Review
Add peas_extension_set_new_with_properties (4.44 KB, patch)
2017-04-24 12:44 UTC, César Fabián Orccón Chipana
none Details | Review
Add peas_engine_create_extension_with_properties (5.72 KB, patch)
2017-04-24 12:44 UTC, César Fabián Orccón Chipana
none Details | Review
Add peas_extension_set_new_with_properties (4.45 KB, patch)
2017-04-24 12:59 UTC, César Fabián Orccón Chipana
none Details | Review
Add peas_engine_create_extension_with_properties (4.63 KB, patch)
2017-04-24 12:59 UTC, César Fabián Orccón Chipana
none Details | Review
Add peas_extension_set_new_with_properties and test valid and invalid properties (10.01 KB, patch)
2017-06-19 08:04 UTC, César Fabián Orccón Chipana
none Details | Review
Add peas_engine_create_extension_with_properties and test valid and invalid properties (9.91 KB, patch)
2017-06-19 08:04 UTC, César Fabián Orccón Chipana
none Details | Review

Description César Fabián Orccón Chipana 2017-03-29 14:13:49 UTC
Created attachment 348935 [details] [review]
Add peas_extension_set_new_with_properties

Hi, currently it is not possible to write extensions in Python, because peas_extension_set_newv receives a GParameter and this type is not introspectible.

See https://bugzilla.gnome.org/show_bug.cgi?id=709865

Inspired in the solution proposed in the bug 709865, I propose to add the following new function prototype:

PeasExtensionSet  *peas_extension_set_new_with_properties (PeasEngine *engine, GType exten_type, guint n_properties, const gchar *prop_names[], const GValue     prop_values[]);

In Python, you should use it this way:

self.extension_set = Peas.ExtensionSet.new_with_properties(self.engine, Peas.Activatable, ["object"], [plugin_iface])

- https://github.com/cfoch/cfoch-peas/blob/master/src/simple/main.py#L45

Note:
- GParameter will probably be deprecated according the discussion in 709865. So when that happens, peas_extension_set_newv should be deprecated, too.
Comment 1 Garrett Regier 2017-03-29 20:45:03 UTC

*** This bug has been marked as a duplicate of bug 660014 ***
Comment 2 Garrett Regier 2017-04-01 18:58:42 UTC
Review of attachment 348935 [details] [review]:

Also need to add peas_engine_create_extension_with_properties().

::: libpeas/peas-extension-set.c
@@ +650,3 @@
+ * If @engine is %NULL, then the default engine will be used.
+ *
+ * @prop_values: (array length=n_properties): an array of property values.

Add comment saying that exten_type can now be an abstract base class.

@@ +652,3 @@
+ * See peas_extension_set_new() for more information.
+ *
+ *

Missing Since tag.

@@ +659,3 @@
+                                        guint            n_properties,
+                                        const gchar     *prop_names[],
+ * If @engine is %NULL, then the default engine will be used.

Use minimal spacing for alignment between type and parameters, also no [].

@@ +668,3 @@
+
+
+ */

Use g_alloca() + memset

@@ +669,3 @@
+
+  parameters = g_new0 (GParameter, n_properties);
+ */

Incorrect coding style.

@@ +673,3 @@
+
+    /* Init value */
+peas_extension_set_new_with_properties (PeasEngine      *engine,

Remove comment and memset (already done above).

@@ +683,3 @@
+
+  g_return_val_if_fail (engine == NULL || PEAS_IS_ENGINE (engine), NULL);
+{

These belove at the top of the function, also exten_type can now be an abstract base class (see recent commit).

::: libpeas/peas-extension-set.h
@@ +141,3 @@
+                                                           guint            n_properties,
+                                                           const gchar     *prop_names[],
+                                                           const GValue     prop_values[]);

No [].
Comment 3 César Fabián Orccón Chipana 2017-04-16 20:27:33 UTC
Created attachment 349912 [details] [review]
Add peas_extension_set_new_with_properties
Comment 4 Garrett Regier 2017-04-17 04:55:30 UTC
Review of attachment 349912 [details] [review]:

Please fix all of my prior comments. Also, you need to add the same API to PeasEngine.
Comment 5 César Fabián Orccón Chipana 2017-04-21 22:42:55 UTC
Created attachment 350211 [details] [review]
Add peas_engine_create_extension_with_properties
Comment 6 César Fabián Orccón Chipana 2017-04-21 22:43:36 UTC
Created attachment 350212 [details] [review]
Add peas_extension_set_new_with_properties
Comment 7 César Fabián Orccón Chipana 2017-04-24 12:44:23 UTC
Created attachment 350288 [details] [review]
Add peas_extension_set_new_with_properties
Comment 8 César Fabián Orccón Chipana 2017-04-24 12:44:41 UTC
Created attachment 350289 [details] [review]
Add peas_engine_create_extension_with_properties
Comment 9 César Fabián Orccón Chipana 2017-04-24 12:59:15 UTC
Created attachment 350291 [details] [review]
Add peas_extension_set_new_with_properties
Comment 10 César Fabián Orccón Chipana 2017-04-24 12:59:33 UTC
Created attachment 350292 [details] [review]
Add peas_engine_create_extension_with_properties
Comment 11 César Fabián Orccón Chipana 2017-06-19 08:04:38 UTC
Created attachment 354018 [details] [review]
Add peas_extension_set_new_with_properties and test valid and invalid properties
Comment 12 César Fabián Orccón Chipana 2017-06-19 08:04:44 UTC
Created attachment 354019 [details] [review]
Add peas_engine_create_extension_with_properties and test valid and invalid properties
Comment 13 Thibault Saunier 2017-06-28 13:51:37 UTC
Review of attachment 354018 [details] [review]:

I am not familiar with libpeas internals, but it all seems sensible to me.

Would be nice to have a libpeas maintainer review and merge that, Pitivi plugin system is blocked by that! :-)

::: libpeas/peas-utils.h
@@ +28,3 @@
 #define PEAS_UTILS_N_LOADERS    4
 
+gboolean  peas_utils_properties_array_to_parameter_list

I think this should probably be private to the library
Comment 14 César Fabián Orccón Chipana 2017-06-28 15:48:06 UTC
(In reply to Thibault Saunier from comment #13)
> Review of attachment 354018 [details] [review] [review]:
> 
> ::: libpeas/peas-utils.h
> @@ +28,3 @@
>  #define PEAS_UTILS_N_LOADERS    4
>  
> +gboolean  peas_utils_properties_array_to_parameter_list
> 
> I think this should probably be private to the library

I was thinking the same that it should be private but there is a similar function in the same file called 'peas_utils_valist_to_parameter_list' and I think this is private, too.