e modules no longer require shutdown or save functions; this should clean up module code a little bit

SVN revision: 82552
This commit is contained in:
Mike Blumenkrantz 2013-01-10 11:31:17 +00:00
parent e14c954675
commit 3d6d8f969c
3 changed files with 12 additions and 8 deletions

View File

@ -10,6 +10,7 @@
* config submenu now sets "config" category * config submenu now sets "config" category
* e_menu_category_callback create callback parameter order has been changed * e_menu_category_callback create callback parameter order has been changed
* composite settings dialog is now accessible from Settings menu * composite settings dialog is now accessible from Settings menu
* modules no longer require shutdown or save functions
2013-01-10 Deon Thomas 2013-01-10 Deon Thomas

3
NEWS
View File

@ -24,6 +24,9 @@ Additions:
* Added option for disabling pointer warping when performing directional focus changes using winlist * Added option for disabling pointer warping when performing directional focus changes using winlist
Changes: Changes:
Modules:
* modules no longer require shutdown or save functions
API: API:
* e_menu_category_callback create callback parameter order has been changed * e_menu_category_callback create callback parameter order has been changed

View File

@ -56,8 +56,8 @@ e_module_shutdown(void)
m = _e_modules->data; m = _e_modules->data;
if ((m) && (m->enabled) && !(m->error)) if ((m) && (m->enabled) && !(m->error))
{ {
m->func.save(m); if (m->func.save) m->func.save(m);
m->func.shutdown(m); if (m->func.shutdown) m->func.shutdown(m);
m->enabled = 0; m->enabled = 0;
} }
e_object_del(E_OBJECT(m)); e_object_del(E_OBJECT(m));
@ -185,7 +185,7 @@ e_module_new(const char *name)
m->func.shutdown = dlsym(m->handle, "e_modapi_shutdown"); m->func.shutdown = dlsym(m->handle, "e_modapi_shutdown");
m->func.save = dlsym(m->handle, "e_modapi_save"); m->func.save = dlsym(m->handle, "e_modapi_save");
if ((!m->func.init) || (!m->func.shutdown) || (!m->func.save) || (!m->api)) if ((!m->func.init) || (!m->api))
{ {
snprintf(body, sizeof(body), snprintf(body, sizeof(body),
_("There was an error loading the module named: %s<br>" _("There was an error loading the module named: %s<br>"
@ -276,7 +276,7 @@ e_module_save(E_Module *m)
E_OBJECT_CHECK_RETURN(m, 0); E_OBJECT_CHECK_RETURN(m, 0);
E_OBJECT_TYPE_CHECK_RETURN(m, E_MODULE_TYPE, 0); E_OBJECT_TYPE_CHECK_RETURN(m, E_MODULE_TYPE, 0);
if ((!m->enabled) || (m->error)) return 0; if ((!m->enabled) || (m->error)) return 0;
return m->func.save(m); return m->func.save ? m->func.save(m) : 1;
} }
EAPI const char * EAPI const char *
@ -335,7 +335,7 @@ e_module_disable(E_Module *m)
E_OBJECT_CHECK_RETURN(m, 0); E_OBJECT_CHECK_RETURN(m, 0);
E_OBJECT_TYPE_CHECK_RETURN(m, E_MODULE_TYPE, 0); E_OBJECT_TYPE_CHECK_RETURN(m, E_MODULE_TYPE, 0);
if ((!m->enabled) || (m->error)) return 0; if ((!m->enabled) || (m->error)) return 0;
ret = m->func.shutdown(m); ret = m->func.shutdown ? m->func.shutdown(m) : 1;
m->data = NULL; m->data = NULL;
m->enabled = 0; m->enabled = 0;
EINA_LIST_FOREACH(e_config->modules, l, em) EINA_LIST_FOREACH(e_config->modules, l, em)
@ -377,7 +377,7 @@ e_module_save_all(void)
EINA_LIST_FOREACH(_e_modules, l, m) EINA_LIST_FOREACH(_e_modules, l, m)
if ((m->enabled) && (!m->error)) if ((m->enabled) && (!m->error))
{ {
if (!m->func.save(m)) ret = 0; if (m->func.save && (!m->func.save(m))) ret = 0;
} }
EINA_LIST_FOREACH(_e_modules, l, m) EINA_LIST_FOREACH(_e_modules, l, m)
e_object_unref(E_OBJECT(m)); e_object_unref(E_OBJECT(m));
@ -519,8 +519,8 @@ _e_module_free(E_Module *m)
if ((m->enabled) && (!m->error)) if ((m->enabled) && (!m->error))
{ {
m->func.save(m); if (m->func.save) m->func.save(m);
m->func.shutdown(m); if (m->func.shutdown) m->func.shutdown(m);
} }
if (m->name) eina_stringshare_del(m->name); if (m->name) eina_stringshare_del(m->name);
if (m->dir) eina_stringshare_del(m->dir); if (m->dir) eina_stringshare_del(m->dir);