aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/GuiLua/GuiLua.c
diff options
context:
space:
mode:
authorDavid Walter Seikel2014-05-05 06:37:33 +1000
committerDavid Walter Seikel2014-05-05 06:37:33 +1000
commitdb4fa90cb8a4d21fbfc895fb258a0e22b32ad40e (patch)
treee9345a1793e9731c575049a601ab898e7c4c5127 /src/GuiLua/GuiLua.c
parent_on_done() no longer needed in GuiLUa, it's in winFang. (diff)
downloadSledjHamr-db4fa90cb8a4d21fbfc895fb258a0e22b32ad40e.zip
SledjHamr-db4fa90cb8a4d21fbfc895fb258a0e22b32ad40e.tar.gz
SledjHamr-db4fa90cb8a4d21fbfc895fb258a0e22b32ad40e.tar.bz2
SledjHamr-db4fa90cb8a4d21fbfc895fb258a0e22b32ad40e.tar.xz
Prepare for using GuiLua from extantz, but not going through with it just yet, too tired.
Diffstat (limited to 'src/GuiLua/GuiLua.c')
-rw-r--r--src/GuiLua/GuiLua.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/src/GuiLua/GuiLua.c b/src/GuiLua/GuiLua.c
index c67788e..f14d74d 100644
--- a/src/GuiLua/GuiLua.c
+++ b/src/GuiLua/GuiLua.c
@@ -178,6 +178,7 @@ static void _on_click(void *data, Evas_Object *obj, void *event_info EINA_UNUSED
178 } 178 }
179} 179}
180 180
181// TODO - skang.thingasm() should pass us the winFang pointer it has as the parent module.
181static int widget(lua_State *L) 182static int widget(lua_State *L)
182{ 183{
183 globals *ourGlobals; 184 globals *ourGlobals;
@@ -223,18 +224,13 @@ static int widget(lua_State *L)
223 224
224static int action(lua_State *L) 225static int action(lua_State *L)
225{ 226{
226 globals *ourGlobals;
227 Widget *wid = lua_touserdata(L, 1); 227 Widget *wid = lua_touserdata(L, 1);
228 char *action = "nada"; 228 char *action = "nada";
229 229
230 lua_getfield(L, LUA_REGISTRYINDEX, globName);
231 ourGlobals = lua_touserdata(L, -1);
232 lua_pop(L, 1);
233
234 pull_lua(L, 2, "$", &action); 230 pull_lua(L, 2, "$", &action);
235 if (wid && strcmp(wid->magic, "Widget") == 0) 231 if (wid && strcmp(wid->magic, "Widget") == 0)
236 { 232 {
237 PD("Setting action %s", action); 233printf(">>>>>>>>>> Setting action : %s\n", action);
238 wid->action = strdup(action); 234 wid->action = strdup(action);
239 } 235 }
240 return 0; 236 return 0;
@@ -303,10 +299,7 @@ static int closeWindow(lua_State *L)
303 ourGlobals = lua_touserdata(L, -1); 299 ourGlobals = lua_touserdata(L, -1);
304 lua_pop(L, 1); 300 lua_pop(L, 1);
305 301
306 if (ourGlobals->win) 302 winFangDel(ourGlobals->win);
307 {
308 winFangDel(ourGlobals->win);
309 }
310 303
311 if (ourGlobals->logDom >= 0) 304 if (ourGlobals->logDom >= 0)
312 { 305 {
@@ -386,7 +379,7 @@ int luaopen_GuiLua(lua_State *L)
386} 379}
387 380
388 381
389void GuiLuaDo(int argc, char **argv) 382void GuiLuaDo(int argc, char **argv, Eina_Bool mainloop)
390{ 383{
391 lua_State *L; 384 lua_State *L;
392 lua_Number i; 385 lua_Number i;
@@ -416,12 +409,15 @@ void GuiLuaDo(int argc, char **argv)
416 lua_setfield(L, LUA_GLOBALSINDEX, SKANG); 409 lua_setfield(L, LUA_GLOBALSINDEX, SKANG);
417 410
418 411
419 // Run the main loop via a Lua call. 412 if (mainloop)
420 // This does nothing if no module opened a window. 413 {
421 if (0 != luaL_dostring(L, "skang.loopWindow()")) 414 // Run the main loop via a Lua call.
422 PEm("Error running - skang.loopWindow()"); 415 // This does nothing if no module opened a window.
423 lua_pop(L, closeWindow(L)); 416 if (0 != luaL_dostring(L, "skang.loopWindow()"))
424 lua_close(L); 417 PEm("Error running - skang.loopWindow()");
418 lua_pop(L, closeWindow(L));
419 lua_close(L);
420 }
425 } 421 }
426 else 422 else
427 fprintf(stderr, "Failed to start Lua!\n"); 423 fprintf(stderr, "Failed to start Lua!\n");