Fix compiler warnings ('passing argument .. from incompatible pointer type') by passing (non)const argument

This commit is contained in:
fiaxh 2021-10-12 17:54:00 +02:00
parent 9285fd07bf
commit b71196ef07
3 changed files with 18 additions and 12 deletions

View file

@ -27,12 +27,12 @@ public class BlockingManager : StreamInteractionModule, Object {
public void block(Account account, Jid jid) { public void block(Account account, Jid jid) {
XmppStream stream = stream_interactor.get_stream(account); XmppStream stream = stream_interactor.get_stream(account);
stream.get_module(Xmpp.Xep.BlockingCommand.Module.IDENTITY).block(stream, new ArrayList<string>.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) { public void unblock(Account account, Jid jid) {
XmppStream stream = stream_interactor.get_stream(account); XmppStream stream = stream_interactor.get_stream(account);
stream.get_module(Xmpp.Xep.BlockingCommand.Module.IDENTITY).unblock(stream, new ArrayList<string>.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) { public bool is_supported(Account account) {

View file

@ -5,6 +5,12 @@ using Dino.Ui;
using Xmpp; using Xmpp;
public class Dino.Ui.Application : Gtk.Application, Dino.Application { public class Dino.Ui.Application : Gtk.Application, Dino.Application {
private const string[] KEY_COMBINATION_QUIT = {"<Ctrl>Q", null};
private const string[] KEY_COMBINATION_ADD_CHAT = {"<Ctrl>T", null};
private const string[] KEY_COMBINATION_ADD_CONFERENCE = {"<Ctrl>G", null};
private const string[] KEY_COMBINATION_LOOP_CONVERSATIONS = {"<Ctrl>Tab", null};
private const string[] KEY_COMBINATION_LOOP_CONVERSATIONS_REV = {"<Ctrl><Shift>Tab", null};
private MainWindow window; private MainWindow window;
public MainWindowController controller; public MainWindowController controller;
@ -116,7 +122,7 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application {
SimpleAction quit_action = new SimpleAction("quit", null); SimpleAction quit_action = new SimpleAction("quit", null);
quit_action.activate.connect(quit); quit_action.activate.connect(quit);
add_action(quit_action); add_action(quit_action);
set_accels_for_action("app.quit", new string[]{"<Ctrl>Q"}); set_accels_for_action("app.quit", KEY_COMBINATION_QUIT);
SimpleAction open_conversation_action = new SimpleAction("open-conversation", VariantType.INT32); SimpleAction open_conversation_action = new SimpleAction("open-conversation", VariantType.INT32);
open_conversation_action.activate.connect((variant) => { open_conversation_action.activate.connect((variant) => {
@ -142,7 +148,7 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application {
add_chat_dialog.present(); add_chat_dialog.present();
}); });
add_action(contacts_action); add_action(contacts_action);
set_accels_for_action("app.add_chat", new string[]{"<Ctrl>T"}); set_accels_for_action("app.add_chat", KEY_COMBINATION_ADD_CHAT);
SimpleAction conference_action = new SimpleAction("add_conference", null); SimpleAction conference_action = new SimpleAction("add_conference", null);
conference_action.activate.connect(() => { conference_action.activate.connect(() => {
@ -151,7 +157,7 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application {
add_conference_dialog.present(); add_conference_dialog.present();
}); });
add_action(conference_action); add_action(conference_action);
set_accels_for_action("app.add_conference", new string[]{"<Ctrl>G"}); set_accels_for_action("app.add_conference", KEY_COMBINATION_ADD_CONFERENCE);
SimpleAction accept_muc_invite_action = new SimpleAction("open-muc-join", VariantType.INT32); SimpleAction accept_muc_invite_action = new SimpleAction("open-muc-join", VariantType.INT32);
accept_muc_invite_action.activate.connect((variant) => { 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); SimpleAction loop_conversations_action = new SimpleAction("loop_conversations", null);
loop_conversations_action.activate.connect(() => { window.loop_conversations(false); }); loop_conversations_action.activate.connect(() => { window.loop_conversations(false); });
add_action(loop_conversations_action); add_action(loop_conversations_action);
set_accels_for_action("app.loop_conversations", new string[]{"<Ctrl>Tab"}); set_accels_for_action("app.loop_conversations", KEY_COMBINATION_LOOP_CONVERSATIONS);
SimpleAction loop_conversations_bw_action = new SimpleAction("loop_conversations_bw", null); SimpleAction loop_conversations_bw_action = new SimpleAction("loop_conversations_bw", null);
loop_conversations_bw_action.activate.connect(() => { window.loop_conversations(true); }); loop_conversations_bw_action.activate.connect(() => { window.loop_conversations(true); });
add_action(loop_conversations_bw_action); add_action(loop_conversations_bw_action);
set_accels_for_action("app.loop_conversations_bw", new string[]{"<Ctrl><Shift>Tab"}); set_accels_for_action("app.loop_conversations_bw", KEY_COMBINATION_LOOP_CONVERSATIONS_REV);
SimpleAction open_shortcuts_action = new SimpleAction("open_shortcuts", null); SimpleAction open_shortcuts_action = new SimpleAction("open_shortcuts", null);
open_shortcuts_action.activate.connect((variant) => { open_shortcuts_action.activate.connect((variant) => {

View file

@ -15,8 +15,8 @@ public class Module : XmppStreamModule, Iq.Handler {
return stream.get_flag(Flag.IDENTITY).blocklist.contains(jid); return stream.get_flag(Flag.IDENTITY).blocklist.contains(jid);
} }
public bool block(XmppStream stream, Gee.List<string> jids) { public bool block(XmppStream stream, string[] jids) {
if (jids.size == 0) return false; // This would otherwise be a bad-request error. 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(); StanzaNode block_node = new StanzaNode.build("block", NS_URI).add_self_xmlns();
fill_node_with_items(block_node, jids); fill_node_with_items(block_node, jids);
@ -25,8 +25,8 @@ public class Module : XmppStreamModule, Iq.Handler {
return true; return true;
} }
public bool unblock(XmppStream stream, Gee.List<string> jids) { public bool unblock(XmppStream stream, string[] jids) {
if (jids.size == 0) return false; // This would otherwise unblock all blocked 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(); StanzaNode unblock_node = new StanzaNode.build("unblock", NS_URI).add_self_xmlns();
fill_node_with_items(unblock_node, jids); fill_node_with_items(unblock_node, jids);
@ -112,7 +112,7 @@ public class Module : XmppStreamModule, Iq.Handler {
return jids; return jids;
} }
private void fill_node_with_items(StanzaNode node, Gee.List<string> jids) { private void fill_node_with_items(StanzaNode node, string[] jids) {
foreach (string jid in jids) { foreach (string jid in jids) {
StanzaNode item_node = new StanzaNode.build("item", NS_URI).add_self_xmlns(); StanzaNode item_node = new StanzaNode.build("item", NS_URI).add_self_xmlns();
item_node.set_attribute("jid", jid, NS_URI); item_node.set_attribute("jid", jid, NS_URI);