[libpeas/proxys: 21/22] [Python] Update the loader's type registration code.



commit 9a9709b166b612aa21b703ef8ea3ee250edf75d3
Author: Steve Frécinaux <code istique net>
Date:   Thu May 20 18:22:05 2010 +0200

    [Python] Update the loader's type registration code.
    
    It wasn't conforming anymore with the latest libpeas way to register
    types in modules.

 loaders/python/peas-plugin-loader-python.c |   20 +++++++++++++++++++-
 loaders/python/peas-plugin-loader-python.h |    3 ++-
 2 files changed, 21 insertions(+), 2 deletions(-)
---
diff --git a/loaders/python/peas-plugin-loader-python.c b/loaders/python/peas-plugin-loader-python.c
index 24698ec..b22b3ac 100644
--- a/loaders/python/peas-plugin-loader-python.c
+++ b/loaders/python/peas-plugin-loader-python.c
@@ -54,7 +54,25 @@ typedef struct {
 static gboolean   peas_plugin_loader_python_add_module_path (PeasPluginLoaderPython *self,
                                                              const gchar            *module_path);
 
-PEAS_PLUGIN_LOADER_REGISTER_TYPE (PeasPluginLoaderPython, peas_plugin_loader_python);
+G_DEFINE_DYNAMIC_TYPE (PeasPluginLoaderPython, peas_plugin_loader_python, PEAS_TYPE_PLUGIN_LOADER);
+
+static GObject *
+create_object (GType the_type)
+{
+  return g_object_new (the_type, NULL);
+}
+
+G_MODULE_EXPORT void
+peas_register_types (PeasObjectModule *module)
+{
+  peas_plugin_loader_python_register_type (G_TYPE_MODULE (module));
+  peas_extension_python_register (G_TYPE_MODULE (module));
+
+  peas_object_module_register_extension (module,
+                                         PEAS_TYPE_PLUGIN_LOADER,
+                                         (PeasCreateFunc) create_object,
+                                         GSIZE_TO_POINTER (PEAS_TYPE_PLUGIN_LOADER_PYTHON));
+}
 
 static PyTypeObject *
 find_python_extension_type (PeasPluginInfo *info,
diff --git a/loaders/python/peas-plugin-loader-python.h b/loaders/python/peas-plugin-loader-python.h
index 7792882..e9990d2 100644
--- a/loaders/python/peas-plugin-loader-python.h
+++ b/loaders/python/peas-plugin-loader-python.h
@@ -24,6 +24,7 @@
 #define __PEAS_PLUGIN_LOADER_PYTHON_H__
 
 #include <libpeas/peas-plugin-loader.h>
+#include <libpeas/peas-object-module.h>
 
 G_BEGIN_DECLS
 
@@ -52,7 +53,7 @@ struct _PeasPluginLoaderPythonClass {
 GType                    peas_plugin_loader_python_get_type  (void) G_GNUC_CONST;
 
 /* All the loaders must implement this function */
-G_MODULE_EXPORT GObject *register_peas_plugin_loader         (GTypeModule *module);
+G_MODULE_EXPORT void     peas_register_types                 (PeasObjectModule *module);
 
 G_END_DECLS
 



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