[Xfce4-commits] <xfce4-panel:devel> * Use renamed construct function names. * Make plugin resident when it's using the __xpp_contruct_obj function, so we don't run into troubles with registered GTypes.

Nick Schermer nick at xfce.org
Tue Aug 11 20:24:21 CEST 2009


Updating branch refs/heads/devel
         to a835f0a22cdf40f27935ddd74789e0d8d38ca45f (commit)
       from 2f6a975ffe9f9244b18d2b1aa4011c5eebacdc0f (commit)

commit a835f0a22cdf40f27935ddd74789e0d8d38ca45f
Author: Nick Schermer <nick at xfce.org>
Date:   Sun Oct 5 22:08:22 2008 +0200

    * Use renamed construct function names.
    * Make plugin resident when it's using the __xpp_contruct_obj function,
      so we don't run into troubles with registered GTypes.

 panel/panel-module.c |   11 ++++++++---
 wrapper/main.c       |    5 +++--
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/panel/panel-module.c b/panel/panel-module.c
index 84906a4..47352d6 100644
--- a/panel/panel-module.c
+++ b/panel/panel-module.c
@@ -173,10 +173,15 @@ panel_module_load (GTypeModule *type_module)
       return FALSE;
     }
 
-  /* link the required construct function */
-  if (!g_module_symbol (module->library, "xfce_panel_plugin_construct", (gpointer) &module->construct_func))
+  /* try to link the contruct function */
+  if (g_module_symbol (module->library, "__xpp_construct_obj", (gpointer) &module->construct_func))
     {
-      g_critical ("Plugin '%s' lacks required symbol: %s", panel_module_get_name (module), g_module_error ());
+      /* don't unload the module because it contains gtypes */
+      g_module_make_resident (module->library);
+    }
+  else if (!g_module_symbol (module->library, "__xpp_construct", (gpointer) &module->construct_func))
+    {
+      g_critical ("Plugin '%s' lacks a plugin register function", panel_module_get_name (module));
 
       /* unload */
       panel_module_unload (type_module);
diff --git a/wrapper/main.c b/wrapper/main.c
index 74939fa..0659b69 100644
--- a/wrapper/main.c
+++ b/wrapper/main.c
@@ -334,10 +334,11 @@ main (gint argc, gchar **argv)
   if (G_LIKELY (module))
     {
       /* get the contruct symbol */
-      if (!g_module_symbol (module, "xfce_panel_plugin_construct", (gpointer) &construct_func))
+      if (!g_module_symbol (module, "__xpp_construct_obj", (gpointer) &construct_func)
+          && !g_module_symbol (module, "__xpp_construct", (gpointer) &construct_func))
         {
           /* print error */
-          g_critical ("Plugin '%s' lacks a required symbol: %s.", opt_name, g_module_error ());
+          g_critical ("Plugin '%s' lacks a plugin register function", opt_name);
 
           /* close the module */
           g_module_close (module);



More information about the Xfce4-commits mailing list