Fix+improve conversation selection when joining channel or starting MUC PM
This commit is contained in:
parent
9565140f01
commit
9ef4dddfdc
|
@ -9,8 +9,6 @@ namespace Dino.Ui {
|
||||||
|
|
||||||
public class AddConferenceDialog : Gtk.Dialog {
|
public class AddConferenceDialog : Gtk.Dialog {
|
||||||
|
|
||||||
public signal void conversation_opened(Conversation conversation);
|
|
||||||
|
|
||||||
private Stack stack = new Stack();
|
private Stack stack = new Stack();
|
||||||
private Button cancel_button;
|
private Button cancel_button;
|
||||||
private Button ok_button;
|
private Button ok_button;
|
||||||
|
|
|
@ -146,11 +146,15 @@ protected class ConferenceDetailsFragment : Box {
|
||||||
ok_button.label = _("Joining…");
|
ok_button.label = _("Joining…");
|
||||||
ok_button.sensitive = false;
|
ok_button.sensitive = false;
|
||||||
|
|
||||||
Muc.JoinResult? join_result = yield stream_interactor.get_module(MucManager.IDENTITY).join(account, new Jid(jid), nick, password);
|
Jid parsed_jid = new Jid(jid);
|
||||||
|
Muc.JoinResult? join_result = yield stream_interactor.get_module(MucManager.IDENTITY).join(account, parsed_jid, nick, password);
|
||||||
|
|
||||||
ok_button.label = _("Join");
|
ok_button.label = _("Join");
|
||||||
ok_button.sensitive = true;
|
ok_button.sensitive = true;
|
||||||
if (join_result == null || join_result.nick != null) {
|
if (join_result == null || join_result.nick != null) {
|
||||||
|
Conversation conversation = stream_interactor.get_module(ConversationManager.IDENTITY).create_conversation(parsed_jid, account, Conversation.Type.GROUPCHAT);
|
||||||
|
Application app = GLib.Application.get_default() as Application;
|
||||||
|
app.controller.select_conversation(conversation);
|
||||||
joined();
|
joined();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ using Xmpp;
|
||||||
public class Dino.Ui.Application : Gtk.Application, Dino.Application {
|
public class Dino.Ui.Application : Gtk.Application, Dino.Application {
|
||||||
private Notifications notifications;
|
private Notifications notifications;
|
||||||
private UnifiedWindow window;
|
private UnifiedWindow window;
|
||||||
private UnifiedWindowController controller;
|
public UnifiedWindowController controller;
|
||||||
|
|
||||||
public Database db { get; set; }
|
public Database db { get; set; }
|
||||||
public Dino.Entities.Settings settings { get; set; }
|
public Dino.Entities.Settings settings { get; set; }
|
||||||
|
@ -41,7 +41,7 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application {
|
||||||
controller.set_window(window);
|
controller.set_window(window);
|
||||||
if ((get_flags() & ApplicationFlags.IS_SERVICE) == ApplicationFlags.IS_SERVICE) window.delete_event.connect(window.hide_on_delete);
|
if ((get_flags() & ApplicationFlags.IS_SERVICE) == ApplicationFlags.IS_SERVICE) window.delete_event.connect(window.hide_on_delete);
|
||||||
|
|
||||||
notifications.conversation_selected.connect((conversation) => window.on_conversation_selected(conversation));
|
notifications.conversation_selected.connect((conversation) => controller.select_conversation(conversation));
|
||||||
}
|
}
|
||||||
window.present();
|
window.present();
|
||||||
});
|
});
|
||||||
|
@ -57,13 +57,13 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application {
|
||||||
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);
|
stream_interactor.get_module(ConversationManager.IDENTITY).start_conversation(conversation);
|
||||||
window.on_conversation_selected(conversation);
|
controller.select_conversation(conversation);
|
||||||
} else {
|
} else {
|
||||||
AddChatDialog dialog = new AddChatDialog(stream_interactor, stream_interactor.get_accounts());
|
AddChatDialog dialog = new AddChatDialog(stream_interactor, stream_interactor.get_accounts());
|
||||||
dialog.set_filter(jid);
|
dialog.set_filter(jid);
|
||||||
dialog.set_transient_for(window);
|
dialog.set_transient_for(window);
|
||||||
dialog.added.connect((conversation) => {
|
dialog.added.connect((conversation) => {
|
||||||
window.on_conversation_selected(conversation);
|
controller.select_conversation(conversation);
|
||||||
});
|
});
|
||||||
dialog.present();
|
dialog.present();
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application {
|
||||||
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) => {
|
||||||
Conversation? conversation = stream_interactor.get_module(ConversationManager.IDENTITY).get_conversation_by_id(variant.get_int32());
|
Conversation? conversation = stream_interactor.get_module(ConversationManager.IDENTITY).get_conversation_by_id(variant.get_int32());
|
||||||
if (conversation != null) window.on_conversation_selected(conversation);
|
if (conversation != null) controller.select_conversation(conversation);
|
||||||
window.present();
|
window.present();
|
||||||
});
|
});
|
||||||
add_action(open_conversation_action);
|
add_action(open_conversation_action);
|
||||||
|
@ -109,9 +109,7 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application {
|
||||||
contacts_action.activate.connect(() => {
|
contacts_action.activate.connect(() => {
|
||||||
AddChatDialog add_chat_dialog = new AddChatDialog(stream_interactor, stream_interactor.get_accounts());
|
AddChatDialog add_chat_dialog = new AddChatDialog(stream_interactor, stream_interactor.get_accounts());
|
||||||
add_chat_dialog.set_transient_for(window);
|
add_chat_dialog.set_transient_for(window);
|
||||||
add_chat_dialog.added.connect((conversation) => {
|
add_chat_dialog.added.connect((conversation) => controller.select_conversation(conversation));
|
||||||
window.on_conversation_selected(conversation);
|
|
||||||
});
|
|
||||||
add_chat_dialog.present();
|
add_chat_dialog.present();
|
||||||
});
|
});
|
||||||
add_action(contacts_action);
|
add_action(contacts_action);
|
||||||
|
@ -121,7 +119,6 @@ public class Dino.Ui.Application : Gtk.Application, Dino.Application {
|
||||||
conference_action.activate.connect(() => {
|
conference_action.activate.connect(() => {
|
||||||
AddConferenceDialog add_conference_dialog = new AddConferenceDialog(stream_interactor);
|
AddConferenceDialog add_conference_dialog = new AddConferenceDialog(stream_interactor);
|
||||||
add_conference_dialog.set_transient_for(window);
|
add_conference_dialog.set_transient_for(window);
|
||||||
add_conference_dialog.conversation_opened.connect(conversation => controller.select_conversation(conversation));
|
|
||||||
add_conference_dialog.present();
|
add_conference_dialog.present();
|
||||||
});
|
});
|
||||||
add_action(conference_action);
|
add_action(conference_action);
|
||||||
|
|
|
@ -7,8 +7,6 @@ namespace Dino.Ui {
|
||||||
[GtkTemplate (ui = "/im/dino/Dino/conversation_list_titlebar.ui")]
|
[GtkTemplate (ui = "/im/dino/Dino/conversation_list_titlebar.ui")]
|
||||||
public class ConversationListTitlebar : Gtk.Box {
|
public class ConversationListTitlebar : Gtk.Box {
|
||||||
|
|
||||||
public signal void conversation_opened(Conversation conversation);
|
|
||||||
|
|
||||||
[GtkChild] private MenuButton add_button;
|
[GtkChild] private MenuButton add_button;
|
||||||
[GtkChild] private MenuButton menu_button;
|
[GtkChild] private MenuButton menu_button;
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,6 @@ namespace Dino.Ui {
|
||||||
[GtkTemplate (ui = "/im/dino/Dino/conversation_list_titlebar_csd.ui")]
|
[GtkTemplate (ui = "/im/dino/Dino/conversation_list_titlebar_csd.ui")]
|
||||||
public class ConversationListTitlebarCsd : Gtk.HeaderBar {
|
public class ConversationListTitlebarCsd : Gtk.HeaderBar {
|
||||||
|
|
||||||
public signal void conversation_opened(Conversation conversation);
|
|
||||||
|
|
||||||
[GtkChild] private MenuButton add_button;
|
[GtkChild] private MenuButton add_button;
|
||||||
[GtkChild] private MenuButton menu_button;
|
[GtkChild] private MenuButton menu_button;
|
||||||
|
|
||||||
|
|
|
@ -107,6 +107,9 @@ public class View : Popover {
|
||||||
|
|
||||||
Conversation conversation = stream_interactor.get_module(ConversationManager.IDENTITY).create_conversation(list_row.jid, list_row.conversation.account, Conversation.Type.GROUPCHAT_PM);
|
Conversation conversation = stream_interactor.get_module(ConversationManager.IDENTITY).create_conversation(list_row.jid, list_row.conversation.account, Conversation.Type.GROUPCHAT_PM);
|
||||||
stream_interactor.get_module(ConversationManager.IDENTITY).start_conversation(conversation);
|
stream_interactor.get_module(ConversationManager.IDENTITY).start_conversation(conversation);
|
||||||
|
|
||||||
|
Application app = GLib.Application.get_default() as Application;
|
||||||
|
app.controller.select_conversation(conversation);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void kick_button_clicked() {
|
private void kick_button_clicked() {
|
||||||
|
|
|
@ -36,7 +36,6 @@ public class UnifiedWindow : Gtk.Window {
|
||||||
private Stack right_stack;
|
private Stack right_stack;
|
||||||
|
|
||||||
private StreamInteractor stream_interactor;
|
private StreamInteractor stream_interactor;
|
||||||
private Conversation? conversation;
|
|
||||||
private Database db;
|
private Database db;
|
||||||
private Config config;
|
private Config config;
|
||||||
|
|
||||||
|
@ -67,13 +66,6 @@ public class UnifiedWindow : Gtk.Window {
|
||||||
check_stack();
|
check_stack();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void on_conversation_selected(Conversation conversation, bool do_reset_search = true, bool default_initialize_conversation = true) {
|
|
||||||
if (this.conversation == null || !this.conversation.equals(conversation)) {
|
|
||||||
this.conversation = conversation;
|
|
||||||
conversation_selected(conversation);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void setup_unified() {
|
private void setup_unified() {
|
||||||
Builder builder = new Builder.from_resource("/im/dino/Dino/unified_main_content.ui");
|
Builder builder = new Builder.from_resource("/im/dino/Dino/unified_main_content.ui");
|
||||||
paned = (Paned) builder.get_object("paned");
|
paned = (Paned) builder.get_object("paned");
|
||||||
|
|
|
@ -136,7 +136,7 @@ public class UnifiedWindowController : Object {
|
||||||
|
|
||||||
stream_interactor.get_module(ChatInteraction.IDENTITY).on_conversation_selected(conversation);
|
stream_interactor.get_module(ChatInteraction.IDENTITY).on_conversation_selected(conversation);
|
||||||
conversation.active = true; // only for conversation_selected
|
conversation.active = true; // only for conversation_selected
|
||||||
window.conversation_selector.on_conversation_selected(conversation); // only for conversation_opened
|
window.conversation_selector.on_conversation_selected(conversation); // In case selection was not via ConversationSelector
|
||||||
|
|
||||||
if (do_reset_search) {
|
if (do_reset_search) {
|
||||||
reset_search_entry();
|
reset_search_entry();
|
||||||
|
|
Loading…
Reference in a new issue