diff --git a/libdino/src/service/blocking_manager.vala b/libdino/src/service/blocking_manager.vala index 183c8a9e..aa07f990 100644 --- a/libdino/src/service/blocking_manager.vala +++ b/libdino/src/service/blocking_manager.vala @@ -27,12 +27,12 @@ public class BlockingManager : StreamInteractionModule, Object { public void block(Account account, Jid jid) { XmppStream stream = stream_interactor.get_stream(account); - stream.get_module(Xmpp.Xep.BlockingCommand.Module.IDENTITY).block(stream, new ArrayList.wrap(new string[] {jid.to_string()})); + stream.get_module(Xmpp.Xep.BlockingCommand.Module.IDENTITY).block(stream, { jid.to_string() }); } public void unblock(Account account, Jid jid) { XmppStream stream = stream_interactor.get_stream(account); - stream.get_module(Xmpp.Xep.BlockingCommand.Module.IDENTITY).unblock(stream, new ArrayList.wrap(new string[] {jid.to_string()})); + stream.get_module(Xmpp.Xep.BlockingCommand.Module.IDENTITY).unblock(stream, { jid.to_string() }); } public bool is_supported(Account account) { diff --git a/main/src/ui/application.vala b/main/src/ui/application.vala index 780c37fd..bed6d01b 100644 --- a/main/src/ui/application.vala +++ b/main/src/ui/application.vala @@ -5,6 +5,12 @@ using Dino.Ui; using Xmpp; public class Dino.Ui.Application : Gtk.Application, Dino.Application { + private const string[] KEY_COMBINATION_QUIT = {"Q", null}; + private const string[] KEY_COMBINATION_ADD_CHAT = {"T", null}; + private const string[] KEY_COMBINATION_ADD_CONFERENCE = {"G", null}; + private const string[] KEY_COMBINATION_LOOP_CONVERSATIONS = {"Tab", null}; + private const string[] KEY_COMBINATION_LOOP_CONVERSATIONS_REV = {"Tab", null}; + private MainWindow window; public MainWindowController controller; @@ -116,7 +122,7 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application { SimpleAction quit_action = new SimpleAction("quit", null); quit_action.activate.connect(quit); add_action(quit_action); - set_accels_for_action("app.quit", new string[]{"Q"}); + set_accels_for_action("app.quit", KEY_COMBINATION_QUIT); SimpleAction open_conversation_action = new SimpleAction("open-conversation", VariantType.INT32); open_conversation_action.activate.connect((variant) => { @@ -142,7 +148,7 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application { add_chat_dialog.present(); }); add_action(contacts_action); - set_accels_for_action("app.add_chat", new string[]{"T"}); + set_accels_for_action("app.add_chat", KEY_COMBINATION_ADD_CHAT); SimpleAction conference_action = new SimpleAction("add_conference", null); conference_action.activate.connect(() => { @@ -151,7 +157,7 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application { add_conference_dialog.present(); }); add_action(conference_action); - set_accels_for_action("app.add_conference", new string[]{"G"}); + set_accels_for_action("app.add_conference", KEY_COMBINATION_ADD_CONFERENCE); SimpleAction accept_muc_invite_action = new SimpleAction("open-muc-join", VariantType.INT32); accept_muc_invite_action.activate.connect((variant) => { @@ -175,12 +181,12 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application { SimpleAction loop_conversations_action = new SimpleAction("loop_conversations", null); loop_conversations_action.activate.connect(() => { window.loop_conversations(false); }); add_action(loop_conversations_action); - set_accels_for_action("app.loop_conversations", new string[]{"Tab"}); + set_accels_for_action("app.loop_conversations", KEY_COMBINATION_LOOP_CONVERSATIONS); SimpleAction loop_conversations_bw_action = new SimpleAction("loop_conversations_bw", null); loop_conversations_bw_action.activate.connect(() => { window.loop_conversations(true); }); add_action(loop_conversations_bw_action); - set_accels_for_action("app.loop_conversations_bw", new string[]{"Tab"}); + set_accels_for_action("app.loop_conversations_bw", KEY_COMBINATION_LOOP_CONVERSATIONS_REV); SimpleAction open_shortcuts_action = new SimpleAction("open_shortcuts", null); open_shortcuts_action.activate.connect((variant) => { diff --git a/xmpp-vala/src/module/xep/0191_blocking_command.vala b/xmpp-vala/src/module/xep/0191_blocking_command.vala index be312581..987f538a 100644 --- a/xmpp-vala/src/module/xep/0191_blocking_command.vala +++ b/xmpp-vala/src/module/xep/0191_blocking_command.vala @@ -15,8 +15,8 @@ public class Module : XmppStreamModule, Iq.Handler { return stream.get_flag(Flag.IDENTITY).blocklist.contains(jid); } - public bool block(XmppStream stream, Gee.List jids) { - if (jids.size == 0) return false; // This would otherwise be a bad-request error. + public bool block(XmppStream stream, string[] jids) { + if (jids.length == 0) return false; // This would otherwise be a bad-request error. StanzaNode block_node = new StanzaNode.build("block", NS_URI).add_self_xmlns(); fill_node_with_items(block_node, jids); @@ -25,8 +25,8 @@ public class Module : XmppStreamModule, Iq.Handler { return true; } - public bool unblock(XmppStream stream, Gee.List jids) { - if (jids.size == 0) return false; // This would otherwise unblock all blocked JIDs. + public bool unblock(XmppStream stream, string[] jids) { + if (jids.length == 0) return false; // This would otherwise unblock all blocked JIDs. StanzaNode unblock_node = new StanzaNode.build("unblock", NS_URI).add_self_xmlns(); fill_node_with_items(unblock_node, jids); @@ -112,7 +112,7 @@ public class Module : XmppStreamModule, Iq.Handler { return jids; } - private void fill_node_with_items(StanzaNode node, Gee.List jids) { + private void fill_node_with_items(StanzaNode node, string[] jids) { foreach (string jid in jids) { StanzaNode item_node = new StanzaNode.build("item", NS_URI).add_self_xmlns(); item_node.set_attribute("jid", jid, NS_URI);