1 #include "e_illume_private.h"
2 #include "e_mod_config.h"
3 #include "e_mod_config_animation.h"
4 #include "e_mod_config_windows.h"
5 #include "e_mod_config_policy.h"
7 /* local function prototypes */
8 static void _e_mod_illume_config_free(void);
9 static void _e_mod_illume_config_new(void);
12 static E_Config_DD *_il_conf_edd = NULL;
13 static E_Config_DD *_il_conf_zone_edd = NULL;
15 /* external variables */
16 E_Illume_Config *_e_illume_cfg = NULL;
19 e_mod_illume_config_init(void)
21 /* create config structure for zones */
22 _il_conf_zone_edd = E_CONFIG_DD_NEW("Illume_Config_Zone", E_Illume_Config_Zone);
25 #define T E_Illume_Config_Zone
26 #define D _il_conf_zone_edd
27 E_CONFIG_VAL(D, T, id, INT);
28 E_CONFIG_VAL(D, T, mode.dual, INT);
29 E_CONFIG_VAL(D, T, mode.side, INT);
31 /* create config structure for module */
32 _il_conf_edd = E_CONFIG_DD_NEW("Illume_Config", E_Illume_Config);
35 #define T E_Illume_Config
36 #define D _il_conf_edd
37 E_CONFIG_VAL(D, T, version, INT);
38 E_CONFIG_VAL(D, T, animation.vkbd.duration, INT);
39 E_CONFIG_VAL(D, T, animation.quickpanel.duration, INT);
40 E_CONFIG_VAL(D, T, policy.name, STR);
41 E_CONFIG_VAL(D, T, policy.vkbd.class, STR);
42 E_CONFIG_VAL(D, T, policy.vkbd.name, STR);
43 E_CONFIG_VAL(D, T, policy.vkbd.title, STR);
44 E_CONFIG_VAL(D, T, policy.vkbd.type, INT);
45 E_CONFIG_VAL(D, T, policy.vkbd.match.class, INT);
46 E_CONFIG_VAL(D, T, policy.vkbd.match.name, INT);
47 E_CONFIG_VAL(D, T, policy.vkbd.match.title, INT);
48 E_CONFIG_VAL(D, T, policy.vkbd.match.type, INT);
49 E_CONFIG_VAL(D, T, policy.indicator.class, STR);
50 E_CONFIG_VAL(D, T, policy.indicator.name, STR);
51 E_CONFIG_VAL(D, T, policy.indicator.title, STR);
52 E_CONFIG_VAL(D, T, policy.indicator.type, INT);
53 E_CONFIG_VAL(D, T, policy.indicator.match.class, INT);
54 E_CONFIG_VAL(D, T, policy.indicator.match.name, INT);
55 E_CONFIG_VAL(D, T, policy.indicator.match.title, INT);
56 E_CONFIG_VAL(D, T, policy.indicator.match.type, INT);
57 E_CONFIG_VAL(D, T, policy.softkey.class, STR);
58 E_CONFIG_VAL(D, T, policy.softkey.name, STR);
59 E_CONFIG_VAL(D, T, policy.softkey.title, STR);
60 E_CONFIG_VAL(D, T, policy.softkey.type, INT);
61 E_CONFIG_VAL(D, T, policy.softkey.match.class, INT);
62 E_CONFIG_VAL(D, T, policy.softkey.match.name, INT);
63 E_CONFIG_VAL(D, T, policy.softkey.match.title, INT);
64 E_CONFIG_VAL(D, T, policy.softkey.match.type, INT);
65 E_CONFIG_VAL(D, T, policy.home.class, STR);
66 E_CONFIG_VAL(D, T, policy.home.name, STR);
67 E_CONFIG_VAL(D, T, policy.home.title, STR);
68 E_CONFIG_VAL(D, T, policy.home.type, INT);
69 E_CONFIG_VAL(D, T, policy.home.match.class, INT);
70 E_CONFIG_VAL(D, T, policy.home.match.name, INT);
71 E_CONFIG_VAL(D, T, policy.home.match.title, INT);
72 E_CONFIG_VAL(D, T, policy.home.match.type, INT);
73 E_CONFIG_LIST(D, T, policy.zones, _il_conf_zone_edd);
75 /* attempt to load existing configuration */
76 _e_illume_cfg = e_config_domain_load("module.illume2", _il_conf_edd);
79 if ((_e_illume_cfg) && ((_e_illume_cfg->version >> 16) < IL_CONFIG_MAJOR))
80 _e_mod_illume_config_free();
82 /* create new config if we need to */
83 if (!_e_illume_cfg) _e_mod_illume_config_new();
85 /* setup category for config panel */
86 e_configure_registry_category_add("illume", 0, _("Illume"), NULL, "preferences-illume");
88 /* add config items to category */
89 e_configure_registry_generic_item_add("illume/policy", 0, _("Policy"),
90 NULL, "preferences-profiles",
91 e_mod_illume_config_policy_show);
92 e_configure_registry_generic_item_add("illume/animation", 0, _("Animation"),
93 NULL, "preferences-transitions",
94 e_mod_illume_config_animation_show);
95 e_configure_registry_generic_item_add("illume/windows", 0, _("Windows"),
96 NULL, "preferences-winlist",
97 e_mod_illume_config_windows_show);
103 e_mod_illume_config_shutdown(void)
105 /* destroy config item entries */
106 e_configure_registry_item_del("illume/windows");
107 e_configure_registry_item_del("illume/animation");
108 e_configure_registry_item_del("illume/policy");
110 /* destroy config category */
111 e_configure_registry_category_del("illume");
113 /* free config structure */
114 _e_mod_illume_config_free();
116 /* free data descriptors */
117 E_CONFIG_DD_FREE(_il_conf_zone_edd);
118 E_CONFIG_DD_FREE(_il_conf_edd);
124 e_mod_illume_config_save(void)
126 return e_config_domain_save("module.illume2", _il_conf_edd, _e_illume_cfg);
129 /* local functions */
131 _e_mod_illume_config_free(void)
133 E_Illume_Config_Zone *cz;
135 /* check for config */
136 if (!_e_illume_cfg) return;
138 /* cleanup any stringshares */
139 if (_e_illume_cfg->policy.name)
140 eina_stringshare_del(_e_illume_cfg->policy.name);
141 _e_illume_cfg->policy.name = NULL;
143 if (_e_illume_cfg->policy.vkbd.class)
144 eina_stringshare_del(_e_illume_cfg->policy.vkbd.class);
145 _e_illume_cfg->policy.vkbd.class = NULL;
146 if (_e_illume_cfg->policy.vkbd.name)
147 eina_stringshare_del(_e_illume_cfg->policy.vkbd.name);
148 _e_illume_cfg->policy.vkbd.name = NULL;
149 if (_e_illume_cfg->policy.vkbd.title)
150 eina_stringshare_del(_e_illume_cfg->policy.vkbd.title);
151 _e_illume_cfg->policy.vkbd.title = NULL;
153 if (_e_illume_cfg->policy.indicator.class)
154 eina_stringshare_del(_e_illume_cfg->policy.indicator.class);
155 _e_illume_cfg->policy.indicator.class = NULL;
156 if (_e_illume_cfg->policy.indicator.name)
157 eina_stringshare_del(_e_illume_cfg->policy.indicator.name);
158 _e_illume_cfg->policy.indicator.name = NULL;
159 if (_e_illume_cfg->policy.indicator.title)
160 eina_stringshare_del(_e_illume_cfg->policy.indicator.title);
161 _e_illume_cfg->policy.indicator.title = NULL;
163 if (_e_illume_cfg->policy.softkey.class)
164 eina_stringshare_del(_e_illume_cfg->policy.softkey.class);
165 _e_illume_cfg->policy.softkey.class = NULL;
166 if (_e_illume_cfg->policy.softkey.name)
167 eina_stringshare_del(_e_illume_cfg->policy.softkey.name);
168 _e_illume_cfg->policy.softkey.name = NULL;
169 if (_e_illume_cfg->policy.softkey.title)
170 eina_stringshare_del(_e_illume_cfg->policy.softkey.title);
171 _e_illume_cfg->policy.softkey.title = NULL;
173 if (_e_illume_cfg->policy.home.class)
174 eina_stringshare_del(_e_illume_cfg->policy.home.class);
175 _e_illume_cfg->policy.home.class = NULL;
176 if (_e_illume_cfg->policy.home.name)
177 eina_stringshare_del(_e_illume_cfg->policy.home.name);
178 _e_illume_cfg->policy.home.name = NULL;
179 if (_e_illume_cfg->policy.home.title)
180 eina_stringshare_del(_e_illume_cfg->policy.home.title);
181 _e_illume_cfg->policy.home.title = NULL;
183 /* free configured zones */
184 EINA_LIST_FREE(_e_illume_cfg->policy.zones, cz)
187 /* free config structure */
188 E_FREE(_e_illume_cfg);
192 _e_mod_illume_config_new(void)
194 E_Illume_Config_Zone *cz;
196 /* create initial config */
197 _e_illume_cfg = E_NEW(E_Illume_Config, 1);
198 _e_illume_cfg->version = 0;
199 _e_illume_cfg->animation.vkbd.duration = 1000;
200 _e_illume_cfg->animation.quickpanel.duration = 1000;
201 _e_illume_cfg->policy.name = eina_stringshare_add("illume");
203 _e_illume_cfg->policy.vkbd.class = eina_stringshare_add("Virtual-Keyboard");
204 _e_illume_cfg->policy.vkbd.name = eina_stringshare_add("Virtual-Keyboard");
205 _e_illume_cfg->policy.vkbd.title = eina_stringshare_add("Virtual Keyboard");
206 _e_illume_cfg->policy.vkbd.type = ECORE_X_WINDOW_TYPE_NORMAL;
207 _e_illume_cfg->policy.vkbd.match.class = 0;
208 _e_illume_cfg->policy.vkbd.match.name = 1;
209 _e_illume_cfg->policy.vkbd.match.title = 1;
210 _e_illume_cfg->policy.vkbd.match.type = 0;
212 _e_illume_cfg->policy.indicator.class =
213 eina_stringshare_add("Illume-Indicator");
214 _e_illume_cfg->policy.indicator.name =
215 eina_stringshare_add("Illume-Indicator");
216 _e_illume_cfg->policy.indicator.title =
217 eina_stringshare_add("Illume Indicator");
218 _e_illume_cfg->policy.indicator.type = ECORE_X_WINDOW_TYPE_DOCK;
219 _e_illume_cfg->policy.indicator.match.class = 0;
220 _e_illume_cfg->policy.indicator.match.name = 1;
221 _e_illume_cfg->policy.indicator.match.title = 1;
222 _e_illume_cfg->policy.indicator.match.type = 0;
224 _e_illume_cfg->policy.softkey.class =
225 eina_stringshare_add("Illume-Softkey");
226 _e_illume_cfg->policy.softkey.name =
227 eina_stringshare_add("Illume-Softkey");
228 _e_illume_cfg->policy.softkey.title =
229 eina_stringshare_add("Illume Softkey");
230 _e_illume_cfg->policy.softkey.type = ECORE_X_WINDOW_TYPE_DOCK;
231 _e_illume_cfg->policy.softkey.match.class = 0;
232 _e_illume_cfg->policy.softkey.match.name = 1;
233 _e_illume_cfg->policy.softkey.match.title = 1;
234 _e_illume_cfg->policy.softkey.match.type = 0;
236 _e_illume_cfg->policy.home.class = eina_stringshare_add("Illume-Home");
237 _e_illume_cfg->policy.home.name = eina_stringshare_add("Illume-Home");
238 _e_illume_cfg->policy.home.title = eina_stringshare_add("Illume Home");
239 _e_illume_cfg->policy.home.type = ECORE_X_WINDOW_TYPE_NORMAL;
240 _e_illume_cfg->policy.home.match.class = 0;
241 _e_illume_cfg->policy.home.match.name = 1;
242 _e_illume_cfg->policy.home.match.title = 1;
243 _e_illume_cfg->policy.home.match.type = 0;
245 /* create config for initial zone */
246 cz = E_NEW(E_Illume_Config_Zone, 1);
251 /* add zone config to main config structure */
252 _e_illume_cfg->policy.zones =
253 eina_list_append(_e_illume_cfg->policy.zones, cz);
255 /* add any new config variables here */
256 /* if ((_e_illume_cfg->version & 0xffff) < 1) */
258 _e_illume_cfg->version = ((IL_CONFIG_MAJOR << 16) | IL_CONFIG_MINOR);