notification: Add an `append_actions` method.
The name is self explanatory, it adds more actions to a notification. One of the use case is adding a snooze/reming_me action. Another one is "mute similar notifications".
This commit is contained in:
parent
e524f93baa
commit
1bd2c1977e
|
@ -669,6 +669,21 @@ function notification.set_actions(self, new_actions)
|
|||
end
|
||||
end
|
||||
|
||||
--- Add more actions to the notification.
|
||||
-- @method append_actions
|
||||
-- @tparam table new_actions
|
||||
|
||||
function notification:append_actions(new_actions)
|
||||
self._private.actions = self._private.actions or {}
|
||||
|
||||
for _, a in ipairs(new_actions or {}) do
|
||||
a:connect_signal("_changed", self._private.action_cb )
|
||||
a:connect_signal("invoked" , self._private.invoked_cb)
|
||||
table.insert(self._private.actions, a)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
--TODO v6: remove this
|
||||
local function convert_actions(actions)
|
||||
gdebug.deprecate(
|
||||
|
|
Loading…
Reference in New Issue