e_devicemgr: make an internal header
[platform/upstream/enlightenment.git] / src / bin / e_devicemgr_conf.c
1 #include "e.h"
2 #include "e_devicemgr_private.h"
3
4 #define E_DEVICEMGR_INPUT_DFLT_BACK_KEYCODE 166
5
6 void
7 _e_devicemgr_conf_value_check(E_Devicemgr_Config_Data* dconfig)
8 {
9    if (!dconfig->conf) dconfig->conf = E_NEW(E_Devicemgr_Conf_Edd, 1);
10    EINA_SAFETY_ON_NULL_RETURN(dconfig->conf);
11
12    dconfig->conf->input.back_keycode = E_DEVICEMGR_INPUT_DFLT_BACK_KEYCODE;
13 }
14
15 void
16 e_devicemgr_conf_init(E_Devicemgr_Config_Data *dconfig)
17 {
18    dconfig->conf_edd = E_CONFIG_DD_NEW("Devicemgr_Config", E_Devicemgr_Conf_Edd);
19 #undef T
20 #undef D
21 #define T E_Devicemgr_Conf_Edd
22 #define D dconfig->conf_edd
23    E_CONFIG_VAL(D, T, input.button_remap_enable, CHAR);
24    E_CONFIG_VAL(D, T, input.virtual_key_device_enable, CHAR);
25    E_CONFIG_VAL(D, T, input.virtual_mouse_device_enable, CHAR);
26    E_CONFIG_VAL(D, T, input.back_keycode, INT);
27
28 #undef T
29 #undef D
30    dconfig->conf = e_config_domain_load("module.devicemgr", dconfig->conf_edd);
31
32    if (!dconfig->conf)
33      {
34         WRN("Failed to find module.devicemgr config file.\n");
35      }
36    _e_devicemgr_conf_value_check(dconfig);
37 }
38
39 void
40 e_devicemgr_conf_fini(E_Devicemgr_Config_Data *dconfig)
41 {
42    if (dconfig->conf)
43      {
44         E_FREE(dconfig->conf);
45      }
46    E_CONFIG_DD_FREE(dconfig->conf_edd);
47 }