1 #include "e_illume_private.h"
2 #include "e_mod_main.h"
4 /* NB: Initially I had done this rewrite with eina_logging enabled, but it
5 * degraded performance so much that it was just not worth it. So now this
6 * module just uses printfs on the console to report things */
8 /* external variables */
9 const char *_e_illume_mod_dir = NULL;
10 E_Illume_Keyboard *_e_illume_kbd = NULL;
11 Eina_List *_e_illume_qps = NULL;
13 EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Illume2" };
16 e_modapi_init(E_Module *m)
19 Ecore_X_Window *zones;
22 /* check if illume is loaded and bail out if it is.
23 * Illume1 and illume2 both cannot be loaded @ the same time */
24 if (e_module_find("illume")) return NULL;
26 /* set module priority so we load first */
27 e_module_priority_set(m, 100);
29 /* set module directory variable */
30 _e_illume_mod_dir = eina_stringshare_add(m->dir);
32 /* try to initialize the config subsystem */
33 if (!e_mod_illume_config_init())
35 /* clear module directory variable */
36 if (_e_illume_mod_dir) eina_stringshare_del(_e_illume_mod_dir);
37 _e_illume_mod_dir = NULL;
42 /* try to initialize the policy subsystem */
43 if (!e_mod_policy_init())
45 /* shutdown the config subsystem */
46 e_mod_illume_config_shutdown();
48 /* clear module directory variable */
49 if (_e_illume_mod_dir) eina_stringshare_del(_e_illume_mod_dir);
50 _e_illume_mod_dir = NULL;
55 /* initialize the keyboard subsystem */
58 /* initialize the quickpanel subsystem */
59 e_mod_quickpanel_init();
61 /* create a new vkbd & hide it initially */
62 _e_illume_kbd = e_mod_kbd_new();
65 /* loop zones and get count */
66 zcount = eina_list_count(e_comp->zones);
68 /* allocate enough zones */
69 zones = calloc(zcount, sizeof(Ecore_X_Window));
72 /* free the keyboard */
73 E_FREE(_e_illume_kbd);
75 /* shutdown quickpanel & kbd sub-systems */
76 e_mod_quickpanel_shutdown();
79 /* shutdown the config subsystem */
80 e_mod_illume_config_shutdown();
82 /* clear module directory variable */
83 if (_e_illume_mod_dir) eina_stringshare_del(_e_illume_mod_dir);
84 _e_illume_mod_dir = NULL;
91 /* loop the zones and create quickpanels for each one */
92 EINA_LIST_FOREACH(e_comp->zones, zl, zone)
94 E_Illume_Quickpanel *qp;
96 /* set zone window in list of zones */
97 zones[zcount] = zone->black_win;
99 /* increment zone count */
102 /* try to create a new quickpanel for this zone */
103 if (!(qp = e_mod_quickpanel_new(zone))) continue;
105 /* append new qp to list */
106 _e_illume_qps = eina_list_append(_e_illume_qps, qp);
108 /* set the zone list on this root. This is needed for some
109 * elm apps like elm_indicator so that they know how many
110 * indicators to create at startup */
111 ecore_x_e_illume_zone_list_set(comp->man->root, zones, zcount);
113 /* free zones variable */
120 e_modapi_shutdown(E_Module *m __UNUSED__)
122 E_Illume_Quickpanel *qp;
124 /* delete the quickpanels */
125 EINA_LIST_FREE(_e_illume_qps, qp)
126 e_object_del(E_OBJECT(qp));
128 /* shutdown the quickpanel subsystem */
129 e_mod_quickpanel_shutdown();
131 /* delete the keyboard object */
132 if (_e_illume_kbd) e_object_del(E_OBJECT(_e_illume_kbd));
133 _e_illume_kbd = NULL;
135 /* shutdown the keyboard subsystem */
136 e_mod_kbd_shutdown();
138 /* shutdown the policy subsystem */
139 e_mod_policy_shutdown();
141 /* shutdown the config subsystem */
142 e_mod_illume_config_shutdown();
144 /* clear module directory variable */
145 if (_e_illume_mod_dir) eina_stringshare_del(_e_illume_mod_dir);
146 _e_illume_mod_dir = NULL;
152 e_modapi_save(E_Module *m __UNUSED__)
154 return e_mod_illume_config_save();