Fix compiler warnings ('cast between incompatible function types') by not connecting closures
This commit is contained in:
parent
76e425ed27
commit
bea85c8ab5
|
@ -26,18 +26,11 @@ public class NotificationEvents : StreamInteractionModule, Object {
|
||||||
stream_interactor.get_module(PresenceManager.IDENTITY).received_subscription_request.connect(on_received_subscription_request);
|
stream_interactor.get_module(PresenceManager.IDENTITY).received_subscription_request.connect(on_received_subscription_request);
|
||||||
|
|
||||||
stream_interactor.get_module(MucManager.IDENTITY).invite_received.connect(on_invite_received);
|
stream_interactor.get_module(MucManager.IDENTITY).invite_received.connect(on_invite_received);
|
||||||
stream_interactor.get_module(MucManager.IDENTITY).voice_request_received.connect((account, room_jid, from_jid, nick) => {
|
stream_interactor.get_module(MucManager.IDENTITY).voice_request_received.connect(on_voice_request_received);
|
||||||
Conversation? conversation = stream_interactor.get_module(ConversationManager.IDENTITY).get_conversation(room_jid, account, Conversation.Type.GROUPCHAT);
|
|
||||||
if (conversation == null) return;
|
|
||||||
notifier.notify_voice_request.begin(conversation, from_jid);
|
|
||||||
});
|
|
||||||
|
|
||||||
stream_interactor.get_module(Calls.IDENTITY).call_incoming.connect(on_call_incoming);
|
stream_interactor.get_module(Calls.IDENTITY).call_incoming.connect(on_call_incoming);
|
||||||
stream_interactor.connection_manager.connection_error.connect((account, error) => notifier.notify_connection_error.begin(account, error));
|
stream_interactor.connection_manager.connection_error.connect((account, error) => notifier.notify_connection_error.begin(account, error));
|
||||||
stream_interactor.get_module(ChatInteraction.IDENTITY).focused_in.connect((conversation) => {
|
stream_interactor.get_module(ChatInteraction.IDENTITY).focused_in.connect(on_focused_in);
|
||||||
notifier.retract_content_item_notifications.begin();
|
|
||||||
notifier.retract_conversation_notifications.begin(conversation);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void register_notification_provider(NotificationProvider notification_provider) {
|
public void register_notification_provider(NotificationProvider notification_provider) {
|
||||||
|
@ -100,6 +93,12 @@ public class NotificationEvents : StreamInteractionModule, Object {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void on_voice_request_received(Account account, Jid room_jid, Jid from_jid, string nick) {
|
||||||
|
Conversation? conversation = stream_interactor.get_module(ConversationManager.IDENTITY).get_conversation(room_jid, account, Conversation.Type.GROUPCHAT);
|
||||||
|
if (conversation == null) return;
|
||||||
|
notifier.notify_voice_request.begin(conversation, from_jid);
|
||||||
|
}
|
||||||
|
|
||||||
private void on_received_subscription_request(Jid jid, Account account) {
|
private void on_received_subscription_request(Jid jid, Account account) {
|
||||||
Conversation conversation = stream_interactor.get_module(ConversationManager.IDENTITY).create_conversation(jid, account, Conversation.Type.CHAT);
|
Conversation conversation = stream_interactor.get_module(ConversationManager.IDENTITY).create_conversation(jid, account, Conversation.Type.CHAT);
|
||||||
if (stream_interactor.get_module(ChatInteraction.IDENTITY).is_active_focus(conversation)) return;
|
if (stream_interactor.get_module(ChatInteraction.IDENTITY).is_active_focus(conversation)) return;
|
||||||
|
@ -129,6 +128,11 @@ public class NotificationEvents : StreamInteractionModule, Object {
|
||||||
}
|
}
|
||||||
notifier.notify_muc_invite.begin(account, room_jid, from_jid, inviter_display_name);
|
notifier.notify_muc_invite.begin(account, room_jid, from_jid, inviter_display_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void on_focused_in(Conversation conversation) {
|
||||||
|
notifier.retract_content_item_notifications.begin();
|
||||||
|
notifier.retract_conversation_notifications.begin(conversation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface NotificationProvider : Object {
|
public interface NotificationProvider : Object {
|
||||||
|
|
|
@ -28,16 +28,14 @@ class MenuEntry : Plugins.ConversationTitlebarEntry, Object {
|
||||||
|
|
||||||
class MenuWidget : Button, Plugins.ConversationTitlebarWidget {
|
class MenuWidget : Button, Plugins.ConversationTitlebarWidget {
|
||||||
|
|
||||||
|
private StreamInteractor stream_interactor;
|
||||||
private Conversation? conversation;
|
private Conversation? conversation;
|
||||||
|
|
||||||
public MenuWidget(StreamInteractor stream_interactor) {
|
public MenuWidget(StreamInteractor stream_interactor) {
|
||||||
|
this.stream_interactor = stream_interactor;
|
||||||
image = new Image.from_icon_name("open-menu-symbolic", IconSize.MENU);
|
image = new Image.from_icon_name("open-menu-symbolic", IconSize.MENU);
|
||||||
|
|
||||||
clicked.connect(() => {
|
clicked.connect(on_clicked);
|
||||||
ContactDetails.Dialog contact_details_dialog = new ContactDetails.Dialog(stream_interactor, conversation);
|
|
||||||
contact_details_dialog.set_transient_for((Window) get_toplevel());
|
|
||||||
contact_details_dialog.present();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public new void set_conversation(Conversation conversation) {
|
public new void set_conversation(Conversation conversation) {
|
||||||
|
@ -54,6 +52,12 @@ class MenuWidget : Button, Plugins.ConversationTitlebarWidget {
|
||||||
this.sensitive = false;
|
this.sensitive = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void on_clicked() {
|
||||||
|
ContactDetails.Dialog contact_details_dialog = new ContactDetails.Dialog(stream_interactor, conversation);
|
||||||
|
contact_details_dialog.set_transient_for((Window) get_toplevel());
|
||||||
|
contact_details_dialog.present();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,8 +37,8 @@ public class ConversationViewController : Object {
|
||||||
this.app = GLib.Application.get_default() as Application;
|
this.app = GLib.Application.get_default() as Application;
|
||||||
|
|
||||||
this.chat_input_controller = new ChatInputController(view.chat_input, stream_interactor);
|
this.chat_input_controller = new ChatInputController(view.chat_input, stream_interactor);
|
||||||
chat_input_controller.activate_last_message_correction.connect(() => view.conversation_frame.activate_last_message_correction());
|
chat_input_controller.activate_last_message_correction.connect(view.conversation_frame.activate_last_message_correction);
|
||||||
chat_input_controller.file_picker_selected.connect(() => open_file_picker());
|
chat_input_controller.file_picker_selected.connect(open_file_picker);
|
||||||
chat_input_controller.clipboard_pasted.connect(on_clipboard_paste);
|
chat_input_controller.clipboard_pasted.connect(on_clipboard_paste);
|
||||||
|
|
||||||
view.conversation_frame.init(stream_interactor);
|
view.conversation_frame.init(stream_interactor);
|
||||||
|
|
|
@ -28,56 +28,62 @@ public class GlobalSearch : Overlay {
|
||||||
search_entry.search_changed.connect(() => {
|
search_entry.search_changed.connect(() => {
|
||||||
set_search(search_entry.text);
|
set_search(search_entry.text);
|
||||||
});
|
});
|
||||||
search_entry.notify["text"].connect_after(() => { update_auto_complete(); });
|
search_entry.notify["text"].connect_after(update_auto_complete);
|
||||||
search_entry.notify["cursor-position"].connect_after(() => { update_auto_complete(); });
|
search_entry.notify["cursor-position"].connect_after(update_auto_complete);
|
||||||
|
|
||||||
results_scrolled.vadjustment.notify["value"].connect(() => {
|
results_scrolled.vadjustment.notify["value"].connect(on_scrolled_window_vadjustment_value);
|
||||||
if (results_scrolled.vadjustment.upper - (results_scrolled.vadjustment.value + results_scrolled.vadjustment.page_size) < 100) {
|
results_scrolled.vadjustment.notify["upper"].connect_after(on_scrolled_window_vadjustment_upper);
|
||||||
if (!reloading_mutex.trylock()) return;
|
|
||||||
Gee.List<MessageItem> new_messages = stream_interactor.get_module(SearchProcessor.IDENTITY).match_messages(search, loaded_results);
|
|
||||||
if (new_messages.size == 0) {
|
|
||||||
reloading_mutex.unlock();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
loaded_results += new_messages.size;
|
|
||||||
append_messages(new_messages);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
results_scrolled.vadjustment.notify["upper"].connect_after(() => {
|
|
||||||
reloading_mutex.trylock();
|
|
||||||
reloading_mutex.unlock();
|
|
||||||
});
|
|
||||||
|
|
||||||
event.connect((event) => {
|
event.connect(on_event);
|
||||||
if (auto_complete_overlay.visible) {
|
|
||||||
if (event.type == Gdk.EventType.KEY_PRESS && event.key.keyval == Gdk.Key.Up) {
|
|
||||||
var row = auto_complete_list.get_selected_row();
|
|
||||||
var index = row == null ? -1 : row.get_index() - 1;
|
|
||||||
if (index == -1) index = (int)auto_complete_list.get_children().length() - 1;
|
|
||||||
auto_complete_list.select_row(auto_complete_list.get_row_at_index(index));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (event.type == Gdk.EventType.KEY_PRESS && event.key.keyval == Gdk.Key.Down) {
|
|
||||||
var row = auto_complete_list.get_selected_row();
|
|
||||||
var index = row == null ? 0 : row.get_index() + 1;
|
|
||||||
if (index == auto_complete_list.get_children().length()) index = 0;
|
|
||||||
auto_complete_list.select_row(auto_complete_list.get_row_at_index(index));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (event.type == Gdk.EventType.KEY_PRESS && event.key.keyval == Gdk.Key.Tab ||
|
|
||||||
event.type == Gdk.EventType.KEY_RELEASE && event.key.keyval == Gdk.Key.Return) {
|
|
||||||
auto_complete_list.get_selected_row().activate();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// TODO: Handle cursor movement in results
|
|
||||||
// TODO: Direct all keystrokes to text input
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void on_scrolled_window_vadjustment_value() {
|
||||||
|
if (results_scrolled.vadjustment.upper - (results_scrolled.vadjustment.value + results_scrolled.vadjustment.page_size) < 100) {
|
||||||
|
if (!reloading_mutex.trylock()) return;
|
||||||
|
Gee.List<MessageItem> new_messages = stream_interactor.get_module(SearchProcessor.IDENTITY).match_messages(search, loaded_results);
|
||||||
|
if (new_messages.size == 0) {
|
||||||
|
reloading_mutex.unlock();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
loaded_results += new_messages.size;
|
||||||
|
append_messages(new_messages);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void on_scrolled_window_vadjustment_upper() {
|
||||||
|
reloading_mutex.trylock();
|
||||||
|
reloading_mutex.unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool on_event(Gdk.Event event) {
|
||||||
|
if (auto_complete_overlay.visible) {
|
||||||
|
if (event.type == Gdk.EventType.KEY_PRESS && event.key.keyval == Gdk.Key.Up) {
|
||||||
|
var row = auto_complete_list.get_selected_row();
|
||||||
|
var index = row == null ? -1 : row.get_index() - 1;
|
||||||
|
if (index == -1) index = (int)auto_complete_list.get_children().length() - 1;
|
||||||
|
auto_complete_list.select_row(auto_complete_list.get_row_at_index(index));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (event.type == Gdk.EventType.KEY_PRESS && event.key.keyval == Gdk.Key.Down) {
|
||||||
|
var row = auto_complete_list.get_selected_row();
|
||||||
|
var index = row == null ? 0 : row.get_index() + 1;
|
||||||
|
if (index == auto_complete_list.get_children().length()) index = 0;
|
||||||
|
auto_complete_list.select_row(auto_complete_list.get_row_at_index(index));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (event.type == Gdk.EventType.KEY_PRESS && event.key.keyval == Gdk.Key.Tab ||
|
||||||
|
event.type == Gdk.EventType.KEY_RELEASE && event.key.keyval == Gdk.Key.Return) {
|
||||||
|
auto_complete_list.get_selected_row().activate();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// TODO: Handle cursor movement in results
|
||||||
|
// TODO: Direct all keystrokes to text input
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
private void update_auto_complete() {
|
private void update_auto_complete() {
|
||||||
Gee.List<SearchSuggestion> suggestions = stream_interactor.get_module(SearchProcessor.IDENTITY).suggest_auto_complete(search_entry.text, search_entry.cursor_position);
|
Gee.List<SearchSuggestion> suggestions = stream_interactor.get_module(SearchProcessor.IDENTITY).suggest_auto_complete(search_entry.text, search_entry.cursor_position);
|
||||||
auto_complete_overlay.visible = suggestions.size > 0;
|
auto_complete_overlay.visible = suggestions.size > 0;
|
||||||
|
|
|
@ -11,8 +11,9 @@ public class View : Popover {
|
||||||
private Conversation conversation;
|
private Conversation conversation;
|
||||||
|
|
||||||
private Stack stack = new Stack() { vhomogeneous=false, visible=true };
|
private Stack stack = new Stack() { vhomogeneous=false, visible=true };
|
||||||
|
private Box list_box = new Box(Orientation.VERTICAL, 1) { visible=true };
|
||||||
private List? list = null;
|
private List? list = null;
|
||||||
private ListBox invite_list;
|
private ListBox invite_list = new ListBox() { visible=true };
|
||||||
private Box? jid_menu = null;
|
private Box? jid_menu = null;
|
||||||
|
|
||||||
private Jid? selected_jid;
|
private Jid? selected_jid;
|
||||||
|
@ -21,37 +22,12 @@ public class View : Popover {
|
||||||
this.stream_interactor = stream_interactor;
|
this.stream_interactor = stream_interactor;
|
||||||
this.conversation = conversation;
|
this.conversation = conversation;
|
||||||
|
|
||||||
Box list_box = new Box(Orientation.VERTICAL, 1) { visible=true };
|
|
||||||
|
|
||||||
this.show.connect(() => {
|
this.show.connect(initialize_list);
|
||||||
if (list == null) {
|
|
||||||
list = new List(stream_interactor, conversation) { visible=true };
|
|
||||||
list_box.add(list);
|
|
||||||
list_box.reorder_child(list, 0);
|
|
||||||
|
|
||||||
list.list_box.row_activated.connect((row) => {
|
|
||||||
ListRow list_row = row as ListRow;
|
|
||||||
show_menu(list_row.jid, list_row.name_label.label);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
invite_list = new ListBox() { visible=true };
|
|
||||||
invite_list.add(new ListRow.label("+", _("Invite")) {visible=true});
|
invite_list.add(new ListRow.label("+", _("Invite")) {visible=true});
|
||||||
list_box.add(invite_list);
|
list_box.add(invite_list);
|
||||||
invite_list.row_activated.connect((row) => {
|
invite_list.row_activated.connect(on_invite_clicked);
|
||||||
hide();
|
|
||||||
Gee.List<Account> acc_list = new ArrayList<Account>(Account.equals_func);
|
|
||||||
acc_list.add(conversation.account);
|
|
||||||
SelectContactDialog add_chat_dialog = new SelectContactDialog(stream_interactor, acc_list);
|
|
||||||
add_chat_dialog.set_transient_for((Window) get_toplevel());
|
|
||||||
add_chat_dialog.title = _("Invite to Conference");
|
|
||||||
add_chat_dialog.ok_button.label = _("Invite");
|
|
||||||
add_chat_dialog.selected.connect((account, jid) => {
|
|
||||||
stream_interactor.get_module(MucManager.IDENTITY).invite(conversation.account, conversation.counterpart, jid);
|
|
||||||
});
|
|
||||||
add_chat_dialog.present();
|
|
||||||
});
|
|
||||||
|
|
||||||
stack.add_named(list_box, "list");
|
stack.add_named(list_box, "list");
|
||||||
add(stack);
|
add(stack);
|
||||||
|
@ -67,6 +43,19 @@ public class View : Popover {
|
||||||
invite_list.unselect_all();
|
invite_list.unselect_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void initialize_list() {
|
||||||
|
if (list == null) {
|
||||||
|
list = new List(stream_interactor, conversation) { visible=true };
|
||||||
|
list_box.add(list);
|
||||||
|
list_box.reorder_child(list, 0);
|
||||||
|
|
||||||
|
list.list_box.row_activated.connect((row) => {
|
||||||
|
ListRow list_row = row as ListRow;
|
||||||
|
show_menu(list_row.jid, list_row.name_label.label);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void show_list() {
|
private void show_list() {
|
||||||
if (list != null) list.list_box.unselect_all();
|
if (list != null) list.list_box.unselect_all();
|
||||||
stack.transition_type = StackTransitionType.SLIDE_RIGHT;
|
stack.transition_type = StackTransitionType.SLIDE_RIGHT;
|
||||||
|
@ -146,6 +135,20 @@ public class View : Popover {
|
||||||
|
|
||||||
stream_interactor.get_module(MucManager.IDENTITY).change_role(conversation.account, conversation.counterpart, selected_jid.resourcepart, role);
|
stream_interactor.get_module(MucManager.IDENTITY).change_role(conversation.account, conversation.counterpart, selected_jid.resourcepart, role);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void on_invite_clicked() {
|
||||||
|
hide();
|
||||||
|
Gee.List<Account> acc_list = new ArrayList<Account>(Account.equals_func);
|
||||||
|
acc_list.add(conversation.account);
|
||||||
|
SelectContactDialog add_chat_dialog = new SelectContactDialog(stream_interactor, acc_list);
|
||||||
|
add_chat_dialog.set_transient_for((Window) get_toplevel());
|
||||||
|
add_chat_dialog.title = _("Invite to Conference");
|
||||||
|
add_chat_dialog.ok_button.label = _("Invite");
|
||||||
|
add_chat_dialog.selected.connect((account, jid) => {
|
||||||
|
stream_interactor.get_module(MucManager.IDENTITY).invite(conversation.account, conversation.counterpart, jid);
|
||||||
|
});
|
||||||
|
add_chat_dialog.present();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue