gears.timer: Add start and stop signals (#348)

This makes the timer emit signals for when it is started and stopped. This does
not add a signal for :again(), because that function just calls the other two
functions and thus already emits start and stop.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2015-10-18 15:31:52 +02:00
parent 532ec0cd90
commit b61026310d
1 changed files with 4 additions and 0 deletions

View File

@ -44,6 +44,7 @@ function timer:start()
end)
return true
end)
self:emit_signal("start")
end
--- Stop the timer.
@ -54,6 +55,7 @@ function timer:stop()
end
glib.source_remove(self.data.source_id)
self.data.source_id = nil
self:emit_signal("stop")
end
--- Restart the timer.
@ -92,6 +94,8 @@ timer.new = function(args)
ret:add_signal("property::timeout")
ret:add_signal("timeout")
ret:add_signal("start")
ret:add_signal("stop")
ret.data = { timeout = 0 }
setmetatable(ret, timer_instance_mt)