Use 'state::changed' instead of hardcoded calls to refresh (issue #18)
This commit is contained in:
parent
76ea448b2d
commit
c10a94c0cb
|
@ -160,6 +160,12 @@ local function new_item(data,args)
|
||||||
data.item_style(item,{})
|
data.item_style(item,{})
|
||||||
data._current_item = item
|
data._current_item = item
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Listen to signals
|
||||||
|
item:connect_signal("state::changed",function()
|
||||||
|
item:style()
|
||||||
|
end)
|
||||||
|
|
||||||
return item
|
return item
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@ end
|
||||||
-- Apply icon transformation
|
-- Apply icon transformation
|
||||||
function module.set_icon(self,image)
|
function module.set_icon(self,image)
|
||||||
if self._data.icon_transformation then
|
if self._data.icon_transformation then
|
||||||
|
self._item._original_icon = image
|
||||||
image = self._data.icon_transformation(image,self._data,self._item)
|
image = self._data.icon_transformation(image,self._data,self._item)
|
||||||
end
|
end
|
||||||
wibox.widget.imagebox.set_image(self,image)
|
wibox.widget.imagebox.set_image(self,image)
|
||||||
|
|
|
@ -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
|
if tab._item._internal.text_w and tab._item._internal.text_w.cache then
|
||||||
tab._item._internal.text_w.cache = {}
|
tab._item._internal.text_w.cache = {}
|
||||||
end
|
end
|
||||||
tab._item:style()
|
tab._item:emit_signal("state::changed")
|
||||||
elseif value and (rawget(tab,"_current_key") or math.huge) > key then
|
elseif value and (rawget(tab,"_current_key") or math.huge) > key then
|
||||||
rawset(tab,"_current_key",key)
|
rawset(tab,"_current_key",key)
|
||||||
if tab._item._internal.text_w and tab._item._internal.text_w.cache then
|
if tab._item._internal.text_w and tab._item._internal.text_w.cache then
|
||||||
tab._item._internal.text_w.cache = {}
|
tab._item._internal.text_w.cache = {}
|
||||||
end
|
end
|
||||||
tab._item:style()
|
tab._item:emit_signal("state::changed")
|
||||||
end
|
end
|
||||||
tab._real_table[key] = value
|
tab._real_table[key] = value
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue