Tizen 2.1 release
[platform/core/uifw/e17.git] / src / modules / quickaccess / e_mod_main.c
1 #include "e_mod_main.h"
2
3 EINTERN int _e_quick_access_log_dom = -1;
4 static E_Config_DD *conf_edd = NULL;
5 Mod *qa_mod = NULL;
6 Config *qa_config = NULL;
7
8
9 /**
10  * in priority order:
11  *
12  * @todo config (see e_mod_config.c)
13  *
14  * @todo custom border based on E_Quick_Access_Entry_Mode/E_Gadcon_Orient
15  *
16  * @todo show/hide effects:
17  *        - fullscreen
18  *        - centered
19  *        - slide from top, bottom, left or right
20  *
21  * @todo match more than one, doing tabs (my idea is to do another
22  *       tabbing module first, experiment with that, maybe use/reuse
23  *       it here)
24  */
25
26 EAPI E_Module_Api e_modapi = {E_MODULE_API_VERSION, "Quickaccess"};
27
28 //////////////////////////////
29 EAPI void *
30 e_modapi_init(E_Module *m)
31 {
32    char buf[PATH_MAX];
33
34    snprintf(buf, sizeof(buf), "%s/e-module-quickaccess.edj", e_module_dir_get(m));
35    e_configure_registry_category_add("launcher", 80, _("Launcher"), NULL,
36                                      "preferences-extensions");
37    e_configure_registry_item_add("launcher/quickaccess", 1, _("Quickaccess"), NULL,
38                                  buf, e_int_config_qa_module);
39
40    qa_mod = E_NEW(Mod, 1);
41    qa_mod->module = m;
42    m->data = qa_mod;
43    conf_edd = e_qa_config_dd_new();
44    qa_config = e_config_domain_load("module.quickaccess", conf_edd);
45    if (qa_config)
46      {
47         if (!e_util_module_config_check("Quickaccess", qa_config->config_version, MOD_CONFIG_FILE_VERSION))
48           {
49              e_qa_config_free(qa_config);
50              qa_config = NULL;
51           }
52      }
53
54    if (!qa_config) qa_config = e_qa_config_new();
55    qa_config->config_version = MOD_CONFIG_FILE_VERSION;
56
57    _e_quick_access_log_dom = eina_log_domain_register("quickaccess", EINA_COLOR_ORANGE);
58    eina_log_domain_level_set("quickaccess", EINA_LOG_LEVEL_DBG);
59
60    if (!e_qa_init())
61      {
62         e_modapi_shutdown(NULL);
63         return NULL;
64      }
65
66    return m;
67 }
68
69 EAPI int
70 e_modapi_shutdown(E_Module *m __UNUSED__)
71 {
72    e_qa_shutdown();
73
74    conf_edd = e_qa_config_dd_free();
75    eina_log_domain_unregister(_e_quick_access_log_dom);
76    _e_quick_access_log_dom = -1;
77    e_qa_config_free(qa_config);
78    E_FREE(qa_mod);
79    qa_config = NULL;
80    return 1;
81 }
82
83 EAPI int
84 e_modapi_save(E_Module *m __UNUSED__)
85 {
86    e_config_domain_save("module.quickaccess", conf_edd, qa_config);
87    return 1;
88 }
89