Philipp Hörist pushed to branch master at gajim / gajim
Commits:
5a24ecd0 by wurstsalat at 2020-10-16T22:09:53+02:00
Notifications: Add 'Mark as Read' feature
- - - - -
3 changed files:
- gajim/app_actions.py
- gajim/application.py
- gajim/gtk/notification.py
Changes:
=====================================
gajim/app_actions.py
=====================================
@@ -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):
=====================================
gajim/application.py
=====================================
@@ -490,6 +490,7 @@ class GajimApplication(Gtk.Application):
('-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'),
]
=====================================
gajim/gtk/notification.py
=====================================
@@ -195,11 +195,18 @@ class Notification(EventHelper):
'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'):
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/5a24ecd008632534857f4309474d4dd2b01d3f92
--
View it on GitLab:
https://dev.gajim.org/gajim/gajim/-/commit/5a24ecd008632534857f4309474d4dd2b01d3f92
You're receiving this email because of your account on dev.gajim.org.
_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits