Philipp Hörist pushed to branch master at gajim / gajim
Commits:
-
5a24ecd0
by wurstsalat at 2020-10-16T22:09:53+02:00
3 changed files:
Changes:
| ... | ... | @@ -247,6 +247,16 @@ def on_open_event(_action, param): |
| 247 | 247 |
dict_['account'], dict_['jid'], dict_['type_'])
|
| 248 | 248 |
|
| 249 | 249 |
|
| 250 |
+def on_remove_event(_action, param):
|
|
| 251 |
+ dict_ = param.unpack()
|
|
| 252 |
+ account, jid, type_ = dict_['account'], dict_['jid'], dict_['type_']
|
|
| 253 |
+ event = app.events.get_first_event(account, jid, type_)
|
|
| 254 |
+ app.events.remove_events(account, jid, event)
|
|
| 255 |
+ win = app.interface.msg_win_mgr.get_window(jid, account)
|
|
| 256 |
+ if win:
|
|
| 257 |
+ win.redraw_tab(win.get_control(jid, account))
|
|
| 258 |
+ win.show_title()
|
|
| 259 |
+ |
|
| 250 | 260 |
# Other Actions
|
| 251 | 261 |
|
| 252 | 262 |
def toggle_ipython(_action, _param):
|
| ... | ... | @@ -490,6 +490,7 @@ class GajimApplication(Gtk.Application): |
| 490 | 490 |
('-update-motd', a.on_update_motd, 'online', 's'),
|
| 491 | 491 |
('-delete-motd', a.on_delete_motd, 'online', 's'),
|
| 492 | 492 |
('-open-event', a.on_open_event, 'always', 'a{sv}'),
|
| 493 |
+ ('-remove-event', a.on_remove_event, 'always', 'a{sv}'),
|
|
| 493 | 494 |
('-import-contacts', a.on_import_contacts, 'online', 's'),
|
| 494 | 495 |
]
|
| 495 | 496 |
|
| ... | ... | @@ -195,11 +195,18 @@ class Notification(EventHelper): |
| 195 | 195 |
'type_': GLib.Variant('s', type_)}
|
| 196 | 196 |
variant_dict = GLib.Variant('a{sv}', dict_)
|
| 197 | 197 |
action = 'app.{}-open-event'.format(account)
|
| 198 |
- #Button in notification
|
|
| 199 |
- notification.add_button_with_target(_('Open'), action,
|
|
| 200 |
- variant_dict)
|
|
| 201 |
- notification.set_default_action_and_target(action,
|
|
| 202 |
- variant_dict)
|
|
| 198 |
+ # Notification button
|
|
| 199 |
+ notification.add_button_with_target(
|
|
| 200 |
+ _('Open'), action, variant_dict)
|
|
| 201 |
+ notification.set_default_action_and_target(
|
|
| 202 |
+ action, variant_dict)
|
|
| 203 |
+ if event_type in (
|
|
| 204 |
+ _('New Message'),
|
|
| 205 |
+ _('New Private Message'),
|
|
| 206 |
+ _('New Group Chat Message')):
|
|
| 207 |
+ action = 'app.{}-remove-event'.format(account)
|
|
| 208 |
+ notification.add_button_with_target(
|
|
| 209 |
+ _('Mark as Read'), action, variant_dict)
|
|
| 203 | 210 |
|
| 204 | 211 |
# Only one notification per JID
|
| 205 | 212 |
if event_type == _('Contact Changed Status'):
|