[libpeas] Pass the plugin-info property when creating a C extension.



commit 34b2d4716c30f1e5a953d097c7ff8a6bea625c04
Author: Steve Frécinaux <code istique net>
Date:   Fri Jun 25 01:31:53 2010 +0200

    Pass the plugin-info property when creating a C extension.

 libpeas/peas-extension-base.c    |    1 +
 loaders/c/peas-plugin-loader-c.c |   12 ++++++++----
 2 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/libpeas/peas-extension-base.c b/libpeas/peas-extension-base.c
index 135645e..155b762 100644
--- a/libpeas/peas-extension-base.c
+++ b/libpeas/peas-extension-base.c
@@ -125,6 +125,7 @@ peas_extension_base_class_init (PeasExtensionBaseClass *klass)
                                                        "Information relative to the current plugin",
                                                        PEAS_TYPE_PLUGIN_INFO,
                                                        G_PARAM_READWRITE |
+                                                       G_PARAM_CONSTRUCT_ONLY |
                                                        G_PARAM_STATIC_STRINGS));
 
   g_object_class_install_property (object_class,
diff --git a/loaders/c/peas-plugin-loader-c.c b/loaders/c/peas-plugin-loader-c.c
index d1f9f18..75246b3 100644
--- a/loaders/c/peas-plugin-loader-c.c
+++ b/loaders/c/peas-plugin-loader-c.c
@@ -115,13 +115,20 @@ peas_plugin_loader_c_get_extension (PeasPluginLoader *loader,
 {
   PeasPluginLoaderC *cloader = PEAS_PLUGIN_LOADER_C (loader);
   PeasObjectModule *module;
+  GParameter info_param = { 0 };
   gpointer instance;
 
   module = (PeasObjectModule *) g_hash_table_lookup (cloader->priv->loaded_plugins,
                                                      info);
   g_return_val_if_fail (module != NULL, NULL);
 
-  instance = peas_object_module_create_object (module, exten_type, 0, NULL);
+  info_param.name = "plugin-info";
+  g_value_init (&info_param.value, PEAS_TYPE_PLUGIN_INFO);
+  g_value_set_boxed (&info_param.value, info);
+
+  instance = peas_object_module_create_object (module, exten_type, 1, &info_param);
+
+  g_value_unset (&info_param.value);
 
   if (instance == NULL)
     {
@@ -134,9 +141,6 @@ peas_plugin_loader_c_get_extension (PeasPluginLoader *loader,
   g_return_val_if_fail (G_IS_OBJECT (instance), NULL);
   g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (instance, exten_type), NULL);
 
-  if (PEAS_IS_EXTENSION_BASE (instance))
-    g_object_set (instance, "plugin-info", info, NULL);
-
   return peas_extension_c_new (exten_type, G_OBJECT (instance));
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]