|
4 | 4 | -- @author Anton Lobov <[email protected]>
|
5 | 5 | -- @copyright 2010 Anton Lobov
|
6 | 6 | -- @license GPLv3
|
7 |
| --- @release 0.6 for Awesome-git |
8 |
| ------------------------------------------------------------------------ |
| 7 | +-- @release 0.6.1 (meant to be backwards compatible with older versions) |
| 8 | +------------------------------------------------------------------------ |
9 | 9 |
|
10 | 10 | -- Grab only needed enviroment
|
11 | 11 | local awful = require("awful")
|
12 | 12 | local string = string
|
13 | 13 | local io = io
|
14 | 14 | local table = table
|
15 | 15 | local pairs = pairs
|
16 |
| ---local timer = timer |
| 16 | +local timer = timer |
17 | 17 | local type = type
|
18 |
| ---local image = image |
| 18 | +local image = image |
19 | 19 | local capi = {oocairo = oocairo, timer = timer, dbus = dbus}
|
20 | 20 | local tonumber = tonumber
|
21 | 21 | local print = print
|
@@ -181,29 +181,39 @@ function util.create_timers_table()
|
181 | 181 | -- Parse table with timer data
|
182 | 182 | for _,tmr in pairs(timerdata) do
|
183 | 183 | -- Create timer for the period
|
184 |
| - local t = capi.timer {timeout = tmr[1]} |
| 184 | + local t |
| 185 | + if capi.timer ~= nil then |
| 186 | + t = capi.timer {timeout = tmr[1]} |
| 187 | + else |
| 188 | + t = timer {timeout = tmr[1]} |
| 189 | + end |
185 | 190 | -- Function to call all dispatched functions
|
186 | 191 | local f = function()
|
187 | 192 | for _, func in pairs(tmr[2]) do
|
188 | 193 | func()
|
189 | 194 | end
|
190 | 195 | end
|
191 |
| - t:connect_signal("timeout", f) |
| 196 | + |
| 197 | + if t.add_signal ~= nil then |
| 198 | + t:add_signal("timeout", f) |
| 199 | + else |
| 200 | + t:connect_signal("timeout", f) |
| 201 | + end |
192 | 202 | table.insert(timers, t)
|
193 | 203 | end
|
194 | 204 | end
|
195 | 205 |
|
196 | 206 | function util.update_widget_field(widget, valuess)
|
197 | 207 | -- print(widget.type)
|
198 |
| - --if widget.type == "imagebox" then --imagebox |
199 |
| - if widget.set_image ~= nil then --imagebox |
200 |
| - --widget["image"] = image(valuess) moved to oocairo |
| 208 | + if widget.type == "imagebox" then --imagebox (old API) |
| 209 | + widget["image"] = image(valuess) |
| 210 | + elseif widget.set_image ~= nil then --imagebox (new API) |
201 | 211 | --widget["image"] = capi.oocairo.image_surface_create_from_png(valuess)
|
202 | 212 | --widget:set_image(capi.oocairo.image_surface_create_from_png(valuess))
|
203 | 213 | widget:set_image(valuess)
|
204 |
| - --elseif widget.type == "textbox" then --textbox |
205 |
| - elseif widget.set_markup ~= nil then --textbox |
206 |
| - --widget["text"] = valuess |
| 214 | + elseif widget.type == "textbox" then --textbox (old API) |
| 215 | + widget["text"] = valuess |
| 216 | + elseif widget.set_markup ~= nil then --textbox (new API) |
207 | 217 | widget:set_markup(valuess)
|
208 | 218 | --elseif widget["widget"] ~= nil then
|
209 | 219 | elseif widget.set_value ~= nil then --progressbar
|
|
0 commit comments