check evry module api version
authorHannes Janetzek <hannes.janetzek@gmail.com>
Thu, 8 Apr 2010 11:55:15 +0000 (11:55 +0000)
committerHannes Janetzek <hannes.janetzek@gmail.com>
Thu, 8 Apr 2010 11:55:15 +0000 (11:55 +0000)
SVN revision: 47829

15 files changed:
src/modules/everything/Evry.h
src/modules/everything/actions/evry_plug_border_act.c
src/modules/everything/actions/evry_plug_clipboard.c
src/modules/everything/actions/evry_plug_wallpaper.c
src/modules/everything/e_mod_main.c
src/modules/everything/sources/evry_plug_apps.c
src/modules/everything/sources/evry_plug_aspell.c
src/modules/everything/sources/evry_plug_border.c
src/modules/everything/sources/evry_plug_calc.c
src/modules/everything/sources/evry_plug_config.c
src/modules/everything/sources/evry_plug_dir_browse.c
src/modules/everything/sources/evry_plug_text.c
src/modules/everything/views/evry_plug_preview.c
src/modules/everything/views/evry_plug_view_help.c
src/modules/everything/views/evry_plug_view_thumb.c

index 85a8c28..f60bb6e 100644 (file)
@@ -3,6 +3,9 @@
 
 #include "e.h"
 
+#define EVRY_API_VERSION 1
+
+
 #define EVRY_ACTION_OTHER 0
 #define EVRY_ACTION_FINISHED 1
 #define EVRY_ACTION_CONTINUE 2
@@ -313,6 +316,8 @@ EAPI Evry_Action *evry_action_new(const char *name, const char *type_in1,
 
 EAPI void evry_action_free(Evry_Action *act);
 
+EAPI int evry_api_version_check(int version);
+
 typedef struct _Evry_Event_Item_Changed Evry_Event_Item_Changed;
 
 struct _Evry_Event_Item_Changed
index 1779de2..12a8b4b 100644 (file)
@@ -247,6 +247,9 @@ _exec_border_cleanup(Evry_Action *act)
 static Eina_Bool
 _init(void)
 {
+   if (!evry_api_version_check(EVRY_API_VERSION))
+     return EINA_FALSE;
+
    plugin = evry_plugin_new(NULL, "Window Action", type_action, "BORDER", NULL, 0, NULL, NULL,
                       _begin, _cleanup, _fetch, _action, _item_icon_get, NULL, NULL);
 
index 24d7cc6..1ecd412 100644 (file)
@@ -24,6 +24,9 @@ _check_item(Evry_Action *act __UNUSED__, const Evry_Item *it)
 static Eina_Bool
 _init(void)
 {
+   if (!evry_api_version_check(EVRY_API_VERSION))
+     return EINA_FALSE;
+
    Ecore_X_Window win = ecore_x_window_new(0, 0, 0, 1, 1);
    if (!win) return EINA_FALSE;
 
index b4795f7..9d629fa 100644 (file)
@@ -197,6 +197,9 @@ _action(Evry_Plugin *plugin, const Evry_Item *item)
 static Eina_Bool
 _init(void)
 {
+   if (!evry_api_version_check(EVRY_API_VERSION))
+     return EINA_FALSE;
+
    plugin = evry_plugin_new(NULL, "Wallpaper", type_action, "FILE", "",
                            0, "preferences-desktop-wallpaper", NULL,
                            _begin, _cleanup, _fetch, _action, _icon_get,
index 5d10eee..5ecc476 100644 (file)
@@ -370,6 +370,18 @@ _e_mod_menu_add(void *data __UNUSED__, E_Menu *m)
 }
 
 
+
+
+EAPI int evry_api_version_check(int version)
+{
+   if (EVRY_API_VERSION == version)
+     return 1;
+
+   ERR("module API is %d, required is %d", version, EVRY_API_VERSION);
+
+   return 0;
+}
+
 static int
 _evry_cb_plugin_sort(const void *data1, const void *data2)
 {
@@ -469,6 +481,8 @@ evry_action_free(Evry_Action *act)
    E_FREE(act);
 }
 
+
+/* TODO make int return */
 void
 evry_plugin_register(Evry_Plugin *p, int priority)
 {
@@ -496,6 +510,7 @@ evry_plugin_register(Evry_Plugin *p, int priority)
        pc->priority = priority ? priority : 100;;
 
        confs = eina_list_append(confs, pc);
+       /* return NULL */
      }
 
    /* if (plugin->trigger && !pc->trigger)
index b96ac01..49581ca 100644 (file)
@@ -719,6 +719,9 @@ _new_app_action(Evry_Action *act)
 static Eina_Bool
 _init(void)
 {
+   if (!evry_api_version_check(EVRY_API_VERSION))
+     return EINA_FALSE;
+
    p1 = E_NEW(Plugin, 1);
    evry_plugin_new(EVRY_PLUGIN(p1), "Applications", type_subject, "", "APPLICATION", 0, NULL, NULL,
                   _begin, _cleanup, _fetch, NULL, _icon_get, NULL, NULL);
index 374c9f6..9f0d285 100644 (file)
@@ -321,6 +321,9 @@ _init(void)
 {
    Plugin *p;
 
+   if (!evry_api_version_check(EVRY_API_VERSION))
+     return EINA_FALSE;
+
    p = E_NEW(Plugin, 1);
    evry_plugin_new(EVRY_PLUGIN(p), "Spell Checker", type_subject, "", "TEXT", 1,
                   "accessories-dictionary", TRIGGER,
index f4d6217..c201be8 100644 (file)
@@ -237,6 +237,9 @@ _item_icon_get(Evry_Plugin *p __UNUSED__, const Evry_Item *it, Evas *e)
 static Eina_Bool
 _init(void)
 {
+   if (!evry_api_version_check(EVRY_API_VERSION))
+     return EINA_FALSE;
+
    plugin = evry_plugin_new(NULL, "Windows", type_subject, NULL, "BORDER", 0, NULL, NULL,
                       _begin, _cleanup, _fetch, NULL, _item_icon_get, NULL, NULL);
 
index 1e3b8a9..bf2fc45 100644 (file)
@@ -221,6 +221,9 @@ _cb_del(void *data __UNUSED__, int type __UNUSED__, void *event)
 static Eina_Bool
 _init(void)
 {
+   if (!evry_api_version_check(EVRY_API_VERSION))
+     return EINA_FALSE;
+
    p1 = evry_plugin_new(NULL, "Calculator", type_subject, NULL, "TEXT", 1, "accessories-calculator", "=",
                        _begin, _cleanup, _fetch, _action, NULL, NULL, NULL);
 
index b6a8129..4392815 100644 (file)
@@ -115,6 +115,9 @@ _action(Evry_Action *act)
 static Eina_Bool
 _init(void)
 {
+   if (!evry_api_version_check(EVRY_API_VERSION))
+     return EINA_FALSE;
+
    p = evry_plugin_new(NULL, "Settings", type_subject, NULL, "E_SETTINGS", 0, NULL, NULL,
                       NULL, _cleanup, _fetch, NULL, _item_icon_get, NULL, NULL);
 
index 72aa2b6..1de1bd0 100644 (file)
@@ -466,6 +466,9 @@ _open_term_action(Evry_Action *act)
 static Eina_Bool
 _init(void)
 {
+   if (!evry_api_version_check(EVRY_API_VERSION))
+     return EINA_FALSE;
+
    p1 = evry_plugin_new(NULL, "Files", type_subject, "FILE", "FILE", 0, NULL, NULL,
                        _begin, _cleanup, _fetch, NULL, _icon_get,
                        NULL, NULL);
index 7a45748..74b6e01 100644 (file)
@@ -33,6 +33,9 @@ _fetch(Evry_Plugin *p, const char *input)
 static Eina_Bool
 _init(void)
 {
+   if (!evry_api_version_check(EVRY_API_VERSION))
+     return EINA_FALSE;
+
    p1 = evry_plugin_new(NULL, "Text", type_subject, NULL, "TEXT", 1, "accessories-text-editor", NULL,
                        NULL, _cleanup, _fetch, NULL, NULL, NULL, NULL);
 
index 132edff..1a66718 100644 (file)
@@ -235,6 +235,9 @@ _view_destroy(Evry_View *view)
 static Eina_Bool
 _init(void)
 {
+   if (!evry_api_version_check(EVRY_API_VERSION))
+     return EINA_FALSE;
+
    view = E_NEW(Evry_View, 1);
    view->id = view;
    view->name = "Image Viewer";
index 7c207ae..4c453d5 100644 (file)
@@ -109,6 +109,9 @@ _view_destroy(Evry_View *v)
 static Eina_Bool
 _init(void)
 {
+   if (!evry_api_version_check(EVRY_API_VERSION))
+     return EINA_FALSE;
+
    view = E_NEW(Evry_View, 1);
    view->id = view;
    view->name = "Help";
index 7c55e88..475765f 100644 (file)
@@ -1044,6 +1044,9 @@ _view_destroy(Evry_View *view)
 static Eina_Bool
 _init(void)
 {
+   if (!evry_api_version_check(EVRY_API_VERSION))
+     return EINA_FALSE;
+
    View *v = E_NEW(View, 1);
    
    v->view.id = EVRY_VIEW(v);