Commit 5a24ecd0 authored by Daniel Brötzmann's avatar Daniel Brötzmann Committed by Philipp Hörist

Notifications: Add 'Mark as Read' feature

parent 32a5c0e9
Pipeline #6586 passed with stages
in 2 minutes and 51 seconds
......@@ -247,6 +247,16 @@ def on_open_event(_action, param):
dict_['account'], dict_['jid'], dict_['type_'])
def on_remove_event(_action, param):
dict_ = param.unpack()
account, jid, type_ = dict_['account'], dict_['jid'], dict_['type_']
event = app.events.get_first_event(account, jid, type_)
app.events.remove_events(account, jid, event)
win = app.interface.msg_win_mgr.get_window(jid, account)
if win:
win.redraw_tab(win.get_control(jid, account))
win.show_title()
# Other Actions
def toggle_ipython(_action, _param):
......
......@@ -490,6 +490,7 @@ def _get_account_actions(account):
('-update-motd', a.on_update_motd, 'online', 's'),
('-delete-motd', a.on_delete_motd, 'online', 's'),
('-open-event', a.on_open_event, 'always', 'a{sv}'),
('-remove-event', a.on_remove_event, 'always', 'a{sv}'),
('-import-contacts', a.on_import_contacts, 'online', 's'),
]
......
......@@ -195,11 +195,18 @@ def popup(self, event_type, jid, account, type_='', icon_name=None,
'type_': GLib.Variant('s', type_)}
variant_dict = GLib.Variant('a{sv}', dict_)
action = 'app.{}-open-event'.format(account)
#Button in notification
notification.add_button_with_target(_('Open'), action,
variant_dict)
notification.set_default_action_and_target(action,
variant_dict)
# Notification button
notification.add_button_with_target(
_('Open'), action, variant_dict)
notification.set_default_action_and_target(
action, variant_dict)
if event_type in (
_('New Message'),
_('New Private Message'),
_('New Group Chat Message')):
action = 'app.{}-remove-event'.format(account)
notification.add_button_with_target(
_('Mark as Read'), action, variant_dict)
# Only one notification per JID
if event_type == _('Contact Changed Status'):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment