summaryrefslogtreecommitdiff
path: root/src/bindings
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@samsung.com>2015-03-03 15:29:50 +0000
committerDaniel Kolesa <d.kolesa@samsung.com>2015-03-03 15:30:35 +0000
commitc9c13bd650aca974631969a636ffc525c359032b (patch)
tree535f1704964044ff7077e8da69f37e6fa334d565 /src/bindings
parent34387cfba426afc434c183479c06c82ed61929d5 (diff)
elua: callback updates in eo bindings
Priority is now supported. Some initial infra for disconnect has been added.
Diffstat (limited to 'src/bindings')
-rw-r--r--src/bindings/luajit/eo.lua12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/bindings/luajit/eo.lua b/src/bindings/luajit/eo.lua
index 707bf8e164..e54a747f4e 100644
--- a/src/bindings/luajit/eo.lua
+++ b/src/bindings/luajit/eo.lua
@@ -106,6 +106,9 @@ ffi.cdef [[
106 Eina_Iterator *eo_children_iterator_new(void); 106 Eina_Iterator *eo_children_iterator_new(void);
107 107
108 const Eo_Class *eo_base_class_get(void); 108 const Eo_Class *eo_base_class_get(void);
109
110 extern const Eo_Event_Description _EO_BASE_EVENT_CALLBACK_ADD;
111 extern const Eo_Event_Description _EO_BASE_EVENT_CALLBACK_DEL;
109]] 112]]
110 113
111local addr_d = ffi.typeof("union { double d; const Eo_Class *p; }") 114local addr_d = ffi.typeof("union { double d; const Eo_Class *p; }")
@@ -125,14 +128,14 @@ local eo
125local classes = {} 128local classes = {}
126local eo_classes = {} 129local eo_classes = {}
127 130
128local connect = function(self, ename, func) 131local connect = function(self, ename, func, priority)
129 local ev = self.__events[ename] 132 local ev = self.__events[ename]
130 if not ev then 133 if not ev then
131 error("invalid event '" .. ename .. "'", 2) 134 error("invalid event '" .. ename .. "'", 2)
132 end 135 end
133 local cl = eo_classes["Eo_Base"] 136 local cl = eo_classes["Eo_Base"]
134 M.__do_start(self, cl) 137 M.__do_start(self, cl)
135 eo.eo_event_callback_priority_add(ev, 0, 138 eo.eo_event_callback_priority_add(ev, priority or 0,
136 function(data, obj, desc, einfo) 139 function(data, obj, desc, einfo)
137 return func(obj, einfo) ~= false 140 return func(obj, einfo) ~= false
138 end, 141 end,
@@ -140,6 +143,10 @@ local connect = function(self, ename, func)
140 M.__do_end() 143 M.__do_end()
141end 144end
142 145
146local disconnect = function(self, ename, func)
147 -- TODO: implement
148end
149
143local init = function() 150local init = function()
144 eo = util.lib_load("eo") 151 eo = util.lib_load("eo")
145 eo.eo_init() 152 eo.eo_init()
@@ -147,6 +154,7 @@ local init = function()
147 local addr = eo_class_addr_get(eocl) 154 local addr = eo_class_addr_get(eocl)
148 classes["Eo_Base"] = util.Object:clone { 155 classes["Eo_Base"] = util.Object:clone {
149 connect = connect, 156 connect = connect,
157 disconnect = disconnect,
150 __events = util.Object:clone {}, 158 __events = util.Object:clone {},
151 __properties = util.Object:clone {} 159 __properties = util.Object:clone {}
152 } 160 }