Don't move opened conversation to the top of the list, scroll along with selected conversation

fixes #544
This commit is contained in:
fiaxh 2019-04-18 22:38:16 +02:00
parent a960740c3e
commit cbe0ff2c1d
7 changed files with 8 additions and 7 deletions

View file

@ -95,8 +95,8 @@ public class ConversationManager : StreamInteractionModule, Object {
return ret; return ret;
} }
public void start_conversation(Conversation conversation, bool push_front = false) { public void start_conversation(Conversation conversation) {
if (push_front) { if (conversation.last_active == null) {
conversation.last_active = new DateTime.now_utc(); conversation.last_active = new DateTime.now_utc();
if (conversation.active) conversation_activated(conversation); if (conversation.active) conversation_activated(conversation);
} }

View file

@ -141,7 +141,7 @@ public class AddConferenceDialog : Gtk.Dialog {
private void on_joined(Account account, Jid jid, string nick) { private void on_joined(Account account, Jid jid, string nick) {
if (account.equals(details_fragment.account) && jid.equals_bare(new Jid(details_fragment.jid))) { if (account.equals(details_fragment.account) && jid.equals_bare(new Jid(details_fragment.jid))) {
Conversation conversation = stream_interactor.get_module(ConversationManager.IDENTITY).create_conversation(jid, account, Conversation.Type.GROUPCHAT); Conversation conversation = stream_interactor.get_module(ConversationManager.IDENTITY).create_conversation(jid, account, Conversation.Type.GROUPCHAT);
stream_interactor.get_module(ConversationManager.IDENTITY).start_conversation(conversation, true); stream_interactor.get_module(ConversationManager.IDENTITY).start_conversation(conversation);
conversation_opened(conversation); conversation_opened(conversation);
close(); close();
} }

View file

@ -86,7 +86,7 @@ public class AddChatDialog : SelectContactDialog {
ok_button.label = _("Start"); ok_button.label = _("Start");
selected.connect((account, jid) => { selected.connect((account, jid) => {
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);
stream_interactor.get_module(ConversationManager.IDENTITY).start_conversation(conversation, true); stream_interactor.get_module(ConversationManager.IDENTITY).start_conversation(conversation);
added(conversation); added(conversation);
}); });
} }

View file

@ -66,7 +66,7 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application {
Gee.List<Account> accounts = stream_interactor.get_accounts(); Gee.List<Account> accounts = stream_interactor.get_accounts();
if (accounts.size == 1) { if (accounts.size == 1) {
Conversation conversation = stream_interactor.get_module(ConversationManager.IDENTITY).create_conversation(new Jid(jid), accounts[0], Conversation.Type.CHAT); Conversation conversation = stream_interactor.get_module(ConversationManager.IDENTITY).create_conversation(new Jid(jid), accounts[0], Conversation.Type.CHAT);
stream_interactor.get_module(ConversationManager.IDENTITY).start_conversation(conversation, true); stream_interactor.get_module(ConversationManager.IDENTITY).start_conversation(conversation);
window.on_conversation_selected(conversation); window.on_conversation_selected(conversation);
} else { } else {
AddChatDialog dialog = new AddChatDialog(stream_interactor, stream_interactor.get_accounts()); AddChatDialog dialog = new AddChatDialog(stream_interactor, stream_interactor.get_accounts());

View file

@ -68,6 +68,7 @@ public class ConversationSelector : ListBox {
if (!rows.has_key(conversation)) { if (!rows.has_key(conversation)) {
add_conversation(conversation); add_conversation(conversation);
} }
rows[conversation].grab_focus();
this.select_row(rows[conversation]); this.select_row(rows[conversation]);
} }

View file

@ -16,7 +16,7 @@ public class SubscriptionNotitication : Object {
stream_interactor.get_module(PresenceManager.IDENTITY).received_subscription_request.connect((jid, account) => { stream_interactor.get_module(PresenceManager.IDENTITY).received_subscription_request.connect((jid, account) => {
Conversation relevant_conversation = stream_interactor.get_module(ConversationManager.IDENTITY).create_conversation(jid, account, Conversation.Type.CHAT); Conversation relevant_conversation = stream_interactor.get_module(ConversationManager.IDENTITY).create_conversation(jid, account, Conversation.Type.CHAT);
stream_interactor.get_module(ConversationManager.IDENTITY).start_conversation(relevant_conversation, true); stream_interactor.get_module(ConversationManager.IDENTITY).start_conversation(relevant_conversation);
if (conversation != null && account.equals(conversation.account) && jid.equals(conversation.counterpart)) { if (conversation != null && account.equals(conversation.account) && jid.equals(conversation.counterpart)) {
show_notification(); show_notification();
} }

View file

@ -106,7 +106,7 @@ public class View : Popover {
if (list_row == null) return; if (list_row == null) return;
Conversation conversation = stream_interactor.get_module(ConversationManager.IDENTITY).create_conversation(list_row.jid, list_row.account, Conversation.Type.GROUPCHAT_PM); Conversation conversation = stream_interactor.get_module(ConversationManager.IDENTITY).create_conversation(list_row.jid, list_row.account, Conversation.Type.GROUPCHAT_PM);
stream_interactor.get_module(ConversationManager.IDENTITY).start_conversation(conversation, true); stream_interactor.get_module(ConversationManager.IDENTITY).start_conversation(conversation);
} }
private void kick_button_clicked() { private void kick_button_clicked() {