3 EAPI int E_EVENT_INIT_DONE = 0;
5 /* local function prototypes */
6 static Eina_Bool _e_init_cb_exe_event_del(void *data __UNUSED__, int type __UNUSED__, void *event);
9 static const char *title = NULL;
10 static const char *version = NULL;
11 static Ecore_Exe *init_exe = NULL;
12 static Ecore_Event_Handler *exe_del_handler = NULL;
13 static Ecore_Ipc_Client *client = NULL;
15 static int undone = 0;
16 static Eina_List *stats = NULL;
18 /* public functions */
22 E_EVENT_INIT_DONE = ecore_event_type_new();
24 ecore_event_handler_add(ECORE_EXE_EVENT_DEL,
25 _e_init_cb_exe_event_del, NULL);
34 /* if not killed, kill init */
36 if (title) eina_stringshare_del(title);
37 if (version) eina_stringshare_del(version);
40 if (exe_del_handler) ecore_event_handler_del(exe_del_handler);
41 exe_del_handler = NULL;
48 char buf[8192], *theme, *tit, *ver;
53 if (!e_config->init_default_theme)
54 s = e_path_find(path_themes, "default.edj");
55 else if (e_config->init_default_theme[0] == '/')
56 s = eina_stringshare_add(e_config->init_default_theme);
58 s = e_path_find(path_themes, e_config->init_default_theme);
60 if (s) theme = strdup(e_util_filename_escape(s));
61 else theme = strdup("XdX");
62 if (s) eina_stringshare_del(s);
64 if (title) tit = strdup(e_util_filename_escape(title));
65 else tit = strdup("XtX");
67 if (version) ver = strdup(e_util_filename_escape(version));
68 else ver = strdup("XvX");
70 snprintf(buf, sizeof(buf),
71 "%s/enlightenment/utils/enlightenment_init \'%s\' \'%i\' \'%s\' \'%s\'",
72 e_prefix_lib_get(), theme,
73 e_config->font_hinting, tit, ver);
74 printf("RUN INIT: %s\n", buf);
78 /* FIXME: add font path to cmd-line */
79 init_exe = ecore_exe_run(buf, NULL);
85 if (init_exe) ecore_exe_terminate(init_exe);
89 e_init_title_set(const char *str)
91 if (title) eina_stringshare_del(title);
92 title = eina_stringshare_add(str);
96 e_init_version_set(const char *str)
98 if (version) eina_stringshare_del(version);
99 version = eina_stringshare_add(str);
103 e_init_status_set(const char *str)
105 if (!init_exe) return;
106 // printf("---STAT %p %s\n", client, str);
109 stats = eina_list_append(stats, eina_stringshare_add(str));
112 // printf("---SEND\n");
113 ecore_ipc_client_send(client, E_IPC_DOMAIN_INIT, 1, 0, 0, 0, (void *)str,
115 ecore_ipc_client_flush(client);
122 if (undone > 0) return;
124 ecore_event_add(E_EVENT_INIT_DONE, NULL, NULL, NULL);
125 // printf("---DONE %p\n", client);
127 ecore_ipc_client_send(client, E_IPC_DOMAIN_INIT, 2, 0, 0, 0, NULL, 0);
128 ecore_ipc_client_flush(client);
138 e_init_client_data(Ecore_Ipc_Event_Client_Data *e)
140 // printf("---new init client\n");
141 if (!client) client = e->client;
147 Ecore_X_Window *initwins;
149 num = e->size / sizeof(Ecore_X_Window);
151 for (i = 0; i < num; i+= 2)
156 EINA_LIST_FOREACH(e_manager_list(), l, man)
158 if (man->root == initwins[i + 0])
160 man->initwin = initwins[i + 1];
161 ecore_x_window_raise(man->initwin);
171 stats = eina_list_remove_list(stats, stats);
172 // printf("---SPOOL %s\n", s);
173 e_init_status_set(s);
174 eina_stringshare_del(s);
177 else if (e->minor == 2)
179 e_config->show_splash = e->ref;
180 e_config_save_queue();
182 if (done) e_init_done();
186 e_init_client_del(Ecore_Ipc_Event_Client_Del *e)
188 // printf("---del init client\n");
189 if (e->client == client)
195 EINA_LIST_FOREACH(e_manager_list(), l, man)
203 e_init_count_get(void)
208 /* local functions */
210 _e_init_cb_exe_event_del(void *data __UNUSED__, int type __UNUSED__, void *event)
212 Ecore_Exe_Event_Del *ev;
215 if (ev->exe == init_exe)
218 // ecore_exe_free(init_exe);
221 return ECORE_CALLBACK_RENEW;