[libpeas/proxys: 14/22] [PeasObjectModule] Do not allow changing the symbol names.



commit f4fe8407a7ee2e713b3c435ff07107a35b1b3df0
Author: Steve Frécinaux <code istique net>
Date:   Wed May 19 19:21:41 2010 +0200

    [PeasObjectModule] Do not allow changing the symbol names.
    
    There is no need to allow the user code to change the symbol names
    since those are forced by libpeas at other places anyway.
    
    We now use "peas_register_types" instead of "register_peas_plugin" and
    "register_peas_plugin_loader".

 configure.ac                                       |    2 +-
 libpeas/peas-engine.c                              |    1 -
 libpeas/peas-object-module.c                       |   33 +------------------
 libpeas/peas-object-module.h                       |    2 -
 loaders/c/peas-plugin-loader-c.c                   |    3 +-
 loaders/c/peas-plugin-loader-c.h                   |    2 +-
 .../helloworld/peasdemo-hello-world-plugin.c       |    2 +-
 .../helloworld/peasdemo-hello-world-plugin.h       |    2 +-
 8 files changed, 7 insertions(+), 40 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 4dfc34a..efec0f4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -278,7 +278,7 @@ AC_SUBST(LT_REVISION)
 AC_SUBST(LT_AGE)
 
 PLUGIN_LIBTOOL_FLAGS="-module -avoid-version"
-LOADER_LIBTOOL_FLAGS="-module -avoid-version -export-symbols-regex register_peas_plugin_loader"
+LOADER_LIBTOOL_FLAGS="-module -avoid-version -export-symbols-regex peas_register_types"
 AC_SUBST(PLUGIN_LIBTOOL_FLAGS)
 AC_SUBST(LOADER_LIBTOOL_FLAGS)
 
diff --git a/libpeas/peas-engine.c b/libpeas/peas-engine.c
index 69eefef..4b3279a 100644
--- a/libpeas/peas-engine.c
+++ b/libpeas/peas-engine.c
@@ -519,7 +519,6 @@ load_plugin_loader (PeasEngine  *engine,
   /* For now all modules are resident */
   module = peas_object_module_new (loader_basename,
                                    loader_dirname,
-                                   "register_peas_plugin_loader",
                                    TRUE);
 
   g_free (loader_dirname);
diff --git a/libpeas/peas-object-module.c b/libpeas/peas-object-module.c
index 5281e43..7ebaf09 100644
--- a/libpeas/peas-object-module.c
+++ b/libpeas/peas-object-module.c
@@ -36,7 +36,6 @@ enum {
   PROP_0,
   PROP_MODULE_NAME,
   PROP_PATH,
-  PROP_TYPE_REGISTRATION,
   PROP_RESIDENT
 };
 
@@ -47,7 +46,6 @@ struct _PeasObjectModulePrivate {
 
   gchar *path;
   gchar *module_name;
-  gchar *type_registration;
 
   gboolean resident;
 };
@@ -81,7 +79,7 @@ peas_object_module_load (GTypeModule *gmodule)
 
   /* extract symbols from the lib */
   if (!g_module_symbol (module->priv->library,
-                        module->priv->type_registration,
+                        "peas_register_types",
                         (void *) &module->priv->register_func))
     {
       g_warning ("%s: %s", module->priv->module_name, g_module_error ());
@@ -94,8 +92,7 @@ peas_object_module_load (GTypeModule *gmodule)
    * returned TRUE */
   if (module->priv->register_func == NULL)
     {
-      g_warning ("Symbol '%s' should not be NULL",
-                 module->priv->type_registration);
+      g_warning ("Symbol 'peas_register_types' should not be NULL");
       g_module_close (module->priv->library);
 
       return FALSE;
@@ -133,7 +130,6 @@ peas_object_module_finalize (GObject *object)
 
   g_free (module->priv->path);
   g_free (module->priv->module_name);
-  g_free (module->priv->type_registration);
 
   G_OBJECT_CLASS (peas_object_module_parent_class)->finalize (object);
 }
@@ -154,9 +150,6 @@ peas_object_module_get_property (GObject    *object,
     case PROP_PATH:
       g_value_set_string (value, module->priv->path);
       break;
-    case PROP_TYPE_REGISTRATION:
-      g_value_set_string (value, module->priv->type_registration);
-      break;
     case PROP_RESIDENT:
       g_value_set_boolean (value, module->priv->resident);
       break;
@@ -183,9 +176,6 @@ peas_object_module_set_property (GObject      *object,
     case PROP_PATH:
       module->priv->path = g_value_dup_string (value);
       break;
-    case PROP_TYPE_REGISTRATION:
-      module->priv->type_registration = g_value_dup_string (value);
-      break;
     case PROP_RESIDENT:
       module->priv->resident = g_value_get_boolean (value);
       break;
@@ -226,15 +216,6 @@ peas_object_module_class_init (PeasObjectModuleClass *klass)
                                                         G_PARAM_CONSTRUCT_ONLY));
 
   g_object_class_install_property (object_class,
-                                   PROP_TYPE_REGISTRATION,
-                                   g_param_spec_string ("type-registration",
-                                                        "Type Registration",
-                                                        "The name of the type registration function",
-                                                        NULL,
-                                                        G_PARAM_READWRITE |
-                                                        G_PARAM_CONSTRUCT_ONLY));
-
-  g_object_class_install_property (object_class,
                                    PROP_RESIDENT,
                                    g_param_spec_boolean ("resident",
                                                          "Resident",
@@ -249,13 +230,11 @@ peas_object_module_class_init (PeasObjectModuleClass *klass)
 PeasObjectModule *
 peas_object_module_new (const gchar *module_name,
                         const gchar *path,
-                        const gchar *type_registration,
                         gboolean     resident)
 {
   return (PeasObjectModule *) g_object_new (PEAS_TYPE_OBJECT_MODULE,
                                             "module-name", module_name,
                                             "path", path,
-                                            "type-registration", type_registration,
                                             "resident", resident,
                                             NULL);
 }
@@ -284,14 +263,6 @@ peas_object_module_get_module_name (PeasObjectModule *module)
   return module->priv->module_name;
 }
 
-const gchar *
-peas_object_module_get_type_registration (PeasObjectModule *module)
-{
-  g_return_val_if_fail (PEAS_IS_OBJECT_MODULE (module), NULL);
-
-  return module->priv->type_registration;
-}
-
 GModule *
 peas_object_module_get_library (PeasObjectModule *module)
 {
diff --git a/libpeas/peas-object-module.h b/libpeas/peas-object-module.h
index 12f8d65..a68d6ab 100644
--- a/libpeas/peas-object-module.h
+++ b/libpeas/peas-object-module.h
@@ -57,14 +57,12 @@ struct _PeasObjectModuleClass {
 GType               peas_object_module_get_type               (void) G_GNUC_CONST;
 PeasObjectModule   *peas_object_module_new                    (const gchar      *module_name,
                                                                const gchar      *path,
-                                                               const gchar      *type_registration,
                                                                gboolean          resident);
 
 GObject            *peas_object_module_new_object             (PeasObjectModule *module);
 
 const gchar        *peas_object_module_get_path               (PeasObjectModule *module);
 const gchar        *peas_object_module_get_module_name        (PeasObjectModule *module);
-const gchar        *peas_object_module_get_type_registration  (PeasObjectModule *module);
 
 GModule            *peas_object_module_get_library            (PeasObjectModule *module);
 
diff --git a/loaders/c/peas-plugin-loader-c.c b/loaders/c/peas-plugin-loader-c.c
index 00654b2..ad4a75a 100644
--- a/loaders/c/peas-plugin-loader-c.c
+++ b/loaders/c/peas-plugin-loader-c.c
@@ -34,7 +34,7 @@ struct _PeasPluginLoaderCPrivate
 G_DEFINE_DYNAMIC_TYPE (PeasPluginLoaderC, peas_plugin_loader_c, PEAS_TYPE_PLUGIN_LOADER);
 
 G_MODULE_EXPORT GObject *
-register_peas_plugin_loader (GTypeModule   *type_module)
+peas_register_types (GTypeModule *type_module)
 {
         peas_plugin_loader_c_register_type (type_module);
         peas_extension_c_register (type_module);
@@ -65,7 +65,6 @@ peas_plugin_loader_c_load (PeasPluginLoader * loader,
       /* For now we force all modules to be resident */
       module = peas_object_module_new (module_name,
                                        peas_plugin_info_get_module_dir (info),
-                                       "register_peas_plugin",
                                        TRUE);
 
       /* Infos are available for all the lifetime of the loader.
diff --git a/loaders/c/peas-plugin-loader-c.h b/loaders/c/peas-plugin-loader-c.h
index 6108ccf..4c22500 100644
--- a/loaders/c/peas-plugin-loader-c.h
+++ b/loaders/c/peas-plugin-loader-c.h
@@ -50,7 +50,7 @@ struct _PeasPluginLoaderCClass {
 GType                    peas_plugin_loader_c_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 GObject *peas_register_types           (GTypeModule *module);
 
 G_END_DECLS
 
diff --git a/peas-demo/plugins/helloworld/peasdemo-hello-world-plugin.c b/peas-demo/plugins/helloworld/peasdemo-hello-world-plugin.c
index a974996..eca2f91 100644
--- a/peas-demo/plugins/helloworld/peasdemo-hello-world-plugin.c
+++ b/peas-demo/plugins/helloworld/peasdemo-hello-world-plugin.c
@@ -158,7 +158,7 @@ peasdemo_hello_world_plugin_class_finalize (PeasDemoHelloWorldPluginClass *klass
 }
 
 G_MODULE_EXPORT GObject *
-register_peas_plugin (GTypeModule   *type_module)
+peas_register_types (GTypeModule *type_module)
 {
         peasdemo_hello_world_plugin_register_type (type_module);
 
diff --git a/peas-demo/plugins/helloworld/peasdemo-hello-world-plugin.h b/peas-demo/plugins/helloworld/peasdemo-hello-world-plugin.h
index 7810570..534dcf9 100644
--- a/peas-demo/plugins/helloworld/peasdemo-hello-world-plugin.h
+++ b/peas-demo/plugins/helloworld/peasdemo-hello-world-plugin.h
@@ -27,7 +27,7 @@ struct _PeasDemoHelloWorldPluginClass {
 };
 
 GType                       peasdemo_hello_world_plugin_get_type  (void) G_GNUC_CONST;
-G_MODULE_EXPORT GObject    *register_peas_plugin                  (GTypeModule *module);
+G_MODULE_EXPORT GObject    *peas_register_types                   (GTypeModule *module);
 G_MODULE_EXPORT GObject    *create_PeasUIConfigurable ();
 G_MODULE_EXPORT GObject    *create_PeasActivatable ();
 



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