Use 'state::changed' instead of hardcoded calls to refresh (issue #18)

This commit is contained in:
Emmanuel Lepage Vallee 2014-03-16 23:46:23 -04:00
parent 76ea448b2d
commit c10a94c0cb
3 changed files with 9 additions and 2 deletions

View File

@ -160,6 +160,12 @@ local function new_item(data,args)
data.item_style(item,{})
data._current_item = item
end
-- Listen to signals
item:connect_signal("state::changed",function()
item:style()
end)
return item
end

View File

@ -40,6 +40,7 @@ end
-- Apply icon transformation
function module.set_icon(self,image)
if self._data.icon_transformation then
self._item._original_icon = image
image = self._data.icon_transformation(image,self._data,self._item)
end
wibox.widget.imagebox.set_image(self,image)

View File

@ -23,13 +23,13 @@ local function change_data(tab, key,value)
if tab._item._internal.text_w and tab._item._internal.text_w.cache then
tab._item._internal.text_w.cache = {}
end
tab._item:style()
tab._item:emit_signal("state::changed")
elseif value and (rawget(tab,"_current_key") or math.huge) > key then
rawset(tab,"_current_key",key)
if tab._item._internal.text_w and tab._item._internal.text_w.cache then
tab._item._internal.text_w.cache = {}
end
tab._item:style()
tab._item:emit_signal("state::changed")
end
tab._real_table[key] = value
end