Enlightenment CVS committal

Author  : sebastid
Project : e17
Module  : apps/e

Dir     : e17/apps/e/src/bin


Modified Files:
        e_module.c e_module.h 


Log Message:
Move module api check to module loader.

===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_module.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -3 -r1.36 -r1.37
--- e_module.c  22 Sep 2005 18:17:16 -0000      1.36
+++ e_module.c  23 Sep 2005 17:13:47 -0000      1.37
@@ -28,11 +28,6 @@
 /* local subsystem globals */
 static Evas_List *_e_modules = NULL;
 
-static E_Module_Api _e_module_api =
-{
-   E_MODULE_API_VERSION
-};
-
 /* externally accessible functions */
 int
 e_module_init(void)
@@ -88,7 +83,6 @@
 
    if (!name) return NULL;
    m = E_OBJECT_ALLOC(E_Module, E_MODULE_TYPE, _e_module_free);
-   m->api = &_e_module_api;
    if (name[0] != '/')
      {
        snprintf(buf, sizeof(buf), "%s/%s/module.so", name, MODULE_ARCH);
@@ -119,6 +113,7 @@
        free(m);
        return NULL;
      }
+   m->api = dlsym(m->handle, "e_module_api");
    m->func.init = dlsym(m->handle, "e_modapi_init");
    m->func.shutdown = dlsym(m->handle, "e_modapi_shutdown");
    m->func.save = dlsym(m->handle, "e_modapi_save");
@@ -128,7 +123,8 @@
        (!m->func.shutdown) ||
        (!m->func.save) ||
        (!m->func.info) ||
-       (!m->func.about)
+       (!m->func.about) ||
+       (!m->api)
        )
      {
        e_error_dialog_show(_("Error loading Module"),
@@ -142,6 +138,20 @@
        free(m);
        return NULL;
      }
+   if (m->api->version < E_MODULE_API_VERSION)
+     {
+       char buf[4096];
+       snprintf(buf, sizeof(buf), _("Module API Error<br>Error initializing 
Module: %s<br>"
+                                    "It requires a minimum module API version 
of: %i.<br>"
+                                    "The module API advertized by 
Enlightenment is: %i.<br>"), 
+                                  _(m->api->name), E_MODULE_API_VERSION, 
m->api->version);
+
+       e_module_dialog_show(_("Enlightenment Clock Module"), buf);
+       dlclose(m->handle);
+       free(m);
+       return NULL;
+     }
+
    _e_modules = evas_list_append(_e_modules, m);
    m->name = strdup(name);
    s = ecore_file_get_dir(modpath);
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/e/src/bin/e_module.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- e_module.h  22 Sep 2005 18:17:16 -0000      1.6
+++ e_module.h  23 Sep 2005 17:13:47 -0000      1.7
@@ -17,7 +17,7 @@
 struct _E_Module
 {
    E_Object             e_obj_inherit;
-   
+
    E_Module_Api        *api;
    
    char                *name;
@@ -49,7 +49,8 @@
 
 struct _E_Module_Api
 {
-   int    version;
+   int         version;
+   const char *name;
 };
 
 EAPI int          e_module_init(void);




-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to