From 380e5edc5108d549d2faa0b3b5819a7c2ee03bd8 Mon Sep 17 00:00:00 2001 From: Samuel Hand Date: Sun, 12 Aug 2018 12:16:42 +0100 Subject: Change own-notifcation wording and add a default action --- plugins/omemo/src/own_notifications.vala | 5 +++-- plugins/omemo/src/plugin.vala | 12 ++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) (limited to 'plugins') diff --git a/plugins/omemo/src/own_notifications.vala b/plugins/omemo/src/own_notifications.vala index 862ff33a..5c96f8d5 100644 --- a/plugins/omemo/src/own_notifications.vala +++ b/plugins/omemo/src/own_notifications.vala @@ -33,8 +33,9 @@ public class OwnNotifications { } private void display_notification() { - Notification notification = new Notification(_("Trust decision required")); - notification.set_body(_("A new OMEMO device has been added for the account %s").printf("$(account.jid.bare_jid)")); + Notification notification = new Notification(_("OMEMO trust decision required")); + notification.set_default_action_and_target_value("app.own-keys", new Variant.int32(account.id)); + notification.set_body(_("Did you add a new device for account %s").printf(@"$(account.bare_jid.to_string())")); plugin.app.send_notification(account.id.to_string()+"-new-device", notification); } } diff --git a/plugins/omemo/src/plugin.vala b/plugins/omemo/src/plugin.vala index 81cf5c7f..ab22651f 100644 --- a/plugins/omemo/src/plugin.vala +++ b/plugins/omemo/src/plugin.vala @@ -51,6 +51,18 @@ public class Plugin : RootInterface, Object { }); Manager.start(this.app.stream_interactor, db, trust_manager); + SimpleAction own_keys_action = new SimpleAction("own-keys", VariantType.INT32); + own_keys_action.activate.connect((variant) => { + foreach(Dino.Entities.Account account in this.app.stream_interactor.get_accounts()) { + if(account.id == variant.get_int32()) { + ContactDetailsDialog dialog = new ContactDetailsDialog(this, account, account.bare_jid); + dialog.set_transient_for((this.app as Gtk.Application).get_active_window()); + dialog.present(); + } + } + }); + this.app.add_action(own_keys_action); + string locales_dir; if (app.search_path_generator != null) { locales_dir = ((!)app.search_path_generator).get_locale_path(GETTEXT_PACKAGE, LOCALE_INSTALL_DIR); -- cgit v1.2.3-70-g09d2