aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/application.vala
diff options
context:
space:
mode:
authorMiquel Lionel <lionel@les-miquelots.net>2023-09-17 13:14:43 +0200
committerMiquel Lionel <lionel@les-miquelots.net>2024-06-20 02:40:59 +0200
commitd820c9029ad43f9315a47f58d1676dcc14f9d971 (patch)
tree666bab06855fed03be31db747df68cac0cc170d4 /main/src/ui/application.vala
parent8be4f02723fc131d9275c1b70831f53ff4630a1a (diff)
downloaddino-d820c9029ad43f9315a47f58d1676dcc14f9d971.tar.gz
dino-d820c9029ad43f9315a47f58d1676dcc14f9d971.zip
Simplify talking to yourself (notes) on the UI
- clicking on the menu will multiple accounts will bring up a modified "start chat" windows
Diffstat (limited to 'main/src/ui/application.vala')
-rw-r--r--main/src/ui/application.vala19
1 files changed, 19 insertions, 0 deletions
diff --git a/main/src/ui/application.vala b/main/src/ui/application.vala
index 2e785224..1c96e9ce 100644
--- a/main/src/ui/application.vala
+++ b/main/src/ui/application.vala
@@ -165,6 +165,25 @@ public class Dino.Ui.Application : Adw.Application, Dino.Application {
add_action(conference_action);
set_accels_for_action("app.add_conference", KEY_COMBINATION_ADD_CONFERENCE);
+ SimpleAction opennotes_action = new SimpleAction("opennotes", null);
+ opennotes_action.activate.connect(() => {
+ Gee.List<Account> accounts = stream_interactor.get_accounts();
+ if (accounts.size == 1){
+ Conversation conversation = stream_interactor.get_module(ConversationManager.IDENTITY).create_conversation(accounts[0].bare_jid, accounts[0], Conversation.Type.CHAT);
+ conversation.pinned = 1;
+ stream_interactor.get_module(ConversationManager.IDENTITY).start_conversation(conversation);
+ return;
+ }
+ if (accounts.size > 1){
+ AddChatDialog add_chat_dialog = new AddChatDialog(stream_interactor, accounts, true);
+ add_chat_dialog.set_transient_for(window);
+ add_chat_dialog.added.connect((conversation) => controller.select_conversation(conversation));
+ add_chat_dialog.present();
+ return;
+ }
+ });
+ add_action(opennotes_action);
+
SimpleAction accept_muc_invite_action = new SimpleAction("open-muc-join", VariantType.INT32);
accept_muc_invite_action.activate.connect((variant) => {
Conversation? conversation = stream_interactor.get_module(ConversationManager.IDENTITY).get_conversation_by_id(variant.get_int32());