diff options
author | fiaxh <git@mx.ax.lt> | 2017-12-14 02:01:55 +0100 |
---|---|---|
committer | fiaxh <git@mx.ax.lt> | 2017-12-30 13:10:06 +0100 |
commit | b4bb0912fc328bc44b13e190f59b347eb5d4310a (patch) | |
tree | a18f680f8349eb758dd54fd44321837bcd228545 /main/src/ui/application.vala | |
parent | f25fadde2d6c9492b9cafe2cddbcc7b966942e47 (diff) | |
download | dino-b4bb0912fc328bc44b13e190f59b347eb5d4310a.tar.gz dino-b4bb0912fc328bc44b13e190f59b347eb5d4310a.zip |
Show subscription request in conversation summary
Diffstat (limited to 'main/src/ui/application.vala')
-rw-r--r-- | main/src/ui/application.vala | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/main/src/ui/application.vala b/main/src/ui/application.vala index a506f511..3ebe3cff 100644 --- a/main/src/ui/application.vala +++ b/main/src/ui/application.vala @@ -23,6 +23,8 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application { provider.load_from_resource("/im/dino/Dino/theme.css"); StyleContext.add_provider_for_screen(Gdk.Screen.get_default(), provider, STYLE_PROVIDER_PRIORITY_APPLICATION); + create_actions(); + activate.connect(() => { if (window == null) { create_set_app_menu(); @@ -76,9 +78,27 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application { } } + private void create_actions() { + SimpleAction open_conversation_action = new SimpleAction("open-conversation", VariantType.INT32); + open_conversation_action.activate.connect((variant) => { + Conversation? conversation = stream_interactor.get_module(ConversationManager.IDENTITY).get_conversation_by_id(variant.get_int32()); + if (conversation != null) window.on_conversation_selected(conversation); + window.present(); + }); + add_action(open_conversation_action); + + SimpleAction deny_subscription_action = new SimpleAction("deny-subscription", VariantType.INT32); + deny_subscription_action.activate.connect((variant) => { + Conversation? conversation = stream_interactor.get_module(ConversationManager.IDENTITY).get_conversation_by_id(variant.get_int32()); + if (conversation == null) return; + stream_interactor.get_module(PresenceManager.IDENTITY).deny_subscription(conversation.account, conversation.counterpart); + }); + add_action(deny_subscription_action); + } + private void show_accounts_window() { ManageAccounts.Dialog dialog = new ManageAccounts.Dialog(stream_interactor, db); - dialog.set_transient_for(window); + dialog.set_transient_for(get_active_window()); dialog.account_enabled.connect(add_connection); dialog.account_disabled.connect(remove_connection); dialog.present(); @@ -86,7 +106,7 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application { private void show_settings_window() { SettingsDialog dialog = new SettingsDialog(); - dialog.set_transient_for(window); + dialog.set_transient_for(get_active_window()); dialog.present(); } |