aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/ClientHamr/GuiLua/GuiLua.c
diff options
context:
space:
mode:
authorDavid Walter Seikel2014-04-16 20:57:20 +1000
committerDavid Walter Seikel2014-04-16 20:57:20 +1000
commitff7a21e30c8483f5614dc793e3caecb5e3b89d02 (patch)
treebbb2f17ce12565e37b2206f5cf0a9938f399fd0f /ClientHamr/GuiLua/GuiLua.c
parentMinor clean ups. (diff)
downloadSledjHamr-ff7a21e30c8483f5614dc793e3caecb5e3b89d02.zip
SledjHamr-ff7a21e30c8483f5614dc793e3caecb5e3b89d02.tar.gz
SledjHamr-ff7a21e30c8483f5614dc793e3caecb5e3b89d02.tar.bz2
SledjHamr-ff7a21e30c8483f5614dc793e3caecb5e3b89d02.tar.xz
Convert GuiLua and skang to Elementary.
Diffstat (limited to 'ClientHamr/GuiLua/GuiLua.c')
-rw-r--r--ClientHamr/GuiLua/GuiLua.c86
1 files changed, 22 insertions, 64 deletions
diff --git a/ClientHamr/GuiLua/GuiLua.c b/ClientHamr/GuiLua/GuiLua.c
index 47f63d5..985d0c6 100644
--- a/ClientHamr/GuiLua/GuiLua.c
+++ b/ClientHamr/GuiLua/GuiLua.c
@@ -204,18 +204,6 @@ void loggingStartup(globals *ourGlobals)
204 eina_log_level_set(EINA_LOG_LEVEL_DBG); 204 eina_log_level_set(EINA_LOG_LEVEL_DBG);
205 eina_log_domain_level_set("GuiLua", EINA_LOG_LEVEL_DBG); 205 eina_log_domain_level_set("GuiLua", EINA_LOG_LEVEL_DBG);
206 eina_log_print_cb_set(_ggg_log_print_cb, stderr); 206 eina_log_print_cb_set(_ggg_log_print_cb, stderr);
207
208 // Shut up the excess debugging shit from EFL.
209 eina_log_domain_level_set("eo", EINA_LOG_LEVEL_WARN);
210 eina_log_domain_level_set("eet", EINA_LOG_LEVEL_WARN);
211 eina_log_domain_level_set("ecore", EINA_LOG_LEVEL_WARN);
212 eina_log_domain_level_set("ecore_audio", EINA_LOG_LEVEL_WARN);
213 eina_log_domain_level_set("ecore_evas", EINA_LOG_LEVEL_WARN);
214 eina_log_domain_level_set("ecore_input_evas", EINA_LOG_LEVEL_WARN);
215 eina_log_domain_level_set("ecore_system_upower", EINA_LOG_LEVEL_WARN);
216 eina_log_domain_level_set("ecore_x", EINA_LOG_LEVEL_WARN);
217 eina_log_domain_level_set("evas_main", EINA_LOG_LEVEL_WARN);
218 eina_log_domain_level_set("eldbus", EINA_LOG_LEVEL_WARN);
219} 207}
220 208
221char *getDateTime(struct tm **nowOut, char *dateOut, time_t *timeOut) 209char *getDateTime(struct tm **nowOut, char *dateOut, time_t *timeOut)
@@ -242,9 +230,11 @@ char *getDateTime(struct tm **nowOut, char *dateOut, time_t *timeOut)
242} 230}
243 231
244 232
245static void _on_delete(Ecore_Evas *ee /*__UNUSED__*/) 233static void _on_done(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
246{ 234{
247 ecore_main_loop_quit(); 235// globals *ourGlobals = data;
236
237 elm_exit();
248} 238}
249 239
250static int openWindow(lua_State *L) 240static int openWindow(lua_State *L)
@@ -255,36 +245,16 @@ static int openWindow(lua_State *L)
255 ourGlobals = lua_touserdata(L, -1); 245 ourGlobals = lua_touserdata(L, -1);
256 lua_pop(L, 1); 246 lua_pop(L, 1);
257 247
258 if ((ourGlobals->eina = eina_init())) 248 loggingStartup(ourGlobals);
259 { 249 PI("GuiLua running as an application.\n");
260 loggingStartup(ourGlobals);
261
262 PI("GuiLua running as an application.\n");
263 250
264 if ((ourGlobals->ecore_evas = ecore_evas_init())) 251 if ((ourGlobals->win = elm_win_util_standard_add("GuiLua", "GuiLua test harness")))
265 { 252 {
266 if ((ourGlobals->edje = edje_init())) 253 evas_object_smart_callback_add(ourGlobals->win, "delete,request", _on_done, ourGlobals);
267 { 254 evas_object_resize(ourGlobals->win, WIDTH, HEIGHT);
268 /* this will give you a window with an Evas canvas under the first engine available */ 255 evas_object_move(ourGlobals->win, 0, 0);
269 ourGlobals->ee = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, NULL); 256 evas_object_show(ourGlobals->win);
270 if (ourGlobals->ee)
271 {
272 ourGlobals->canvas = ecore_evas_get(ourGlobals->ee);
273 ecore_evas_title_set(ourGlobals->ee, "GuiLua test harness");
274 ecore_evas_show(ourGlobals->ee);
275 ecore_evas_callback_delete_request_set(ourGlobals->ee, _on_delete);
276 }
277 else
278 PC("You got to have at least one evas engine built and linked up to ecore-evas for this to run properly.");
279 }
280 else
281 PC("Failed to init edje!");
282 }
283 else
284 PC("Failed to init ecore_evas!");
285 } 257 }
286 else
287 fprintf(stderr, "Failed to init eina!\n");
288 258
289 return 0; 259 return 0;
290} 260}
@@ -297,8 +267,8 @@ static int loopWindow(lua_State *L)
297 ourGlobals = lua_touserdata(L, -1); 267 ourGlobals = lua_touserdata(L, -1);
298 lua_pop(L, 1); 268 lua_pop(L, 1);
299 269
300 if (ourGlobals->canvas) 270 if (ourGlobals->win)
301 ecore_main_loop_begin(); 271 elm_run();
302 272
303 return 0; 273 return 0;
304} 274}
@@ -311,29 +281,17 @@ static int closeWindow(lua_State *L)
311 ourGlobals = lua_touserdata(L, -1); 281 ourGlobals = lua_touserdata(L, -1);
312 lua_pop(L, 1); 282 lua_pop(L, 1);
313 283
314 if (ourGlobals->eina) 284 if (ourGlobals->win)
285 evas_object_del(ourGlobals->win);
286
287 if (ourGlobals->logDom >= 0)
315 { 288 {
316 if (ourGlobals->ecore_evas) 289 eina_log_domain_unregister(ourGlobals->logDom);
317 { 290 ourGlobals->logDom = -1;
318 if (ourGlobals->edje)
319 {
320 if (ourGlobals->ee)
321 {
322 ecore_evas_free(ourGlobals->ee);
323 ourGlobals->ee = NULL;
324 }
325 ourGlobals->edje = edje_shutdown();
326 }
327 ourGlobals->ecore_evas = ecore_evas_shutdown();
328 }
329 if (ourGlobals->logDom >= 0)
330 {
331 eina_log_domain_unregister(ourGlobals->logDom);
332 ourGlobals->logDom = -1;
333 }
334 ourGlobals->eina = eina_shutdown();
335 } 291 }
336 292
293 elm_shutdown();
294
337 return 0; 295 return 0;
338} 296}
339 297