aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/unified_window_controller.vala
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/ui/unified_window_controller.vala')
-rw-r--r--main/src/ui/unified_window_controller.vala24
1 files changed, 23 insertions, 1 deletions
diff --git a/main/src/ui/unified_window_controller.vala b/main/src/ui/unified_window_controller.vala
index 2fd8eb0d..6ac941cc 100644
--- a/main/src/ui/unified_window_controller.vala
+++ b/main/src/ui/unified_window_controller.vala
@@ -43,6 +43,8 @@ public class UnifiedWindowController : Object {
update_conversation_topic(subject);
}
});
+ stream_interactor.get_module(ConversationManager.IDENTITY).conversation_deactivated.connect(check_unset_conversation);
+ stream_interactor.account_removed.connect(check_unset_conversation);
app.plugin_registry.register_contact_titlebar_entry(new MenuEntry(stream_interactor));
app.plugin_registry.register_contact_titlebar_entry(search_menu_entry);
@@ -120,7 +122,7 @@ public class UnifiedWindowController : Object {
restore_window_size();
}
- public void select_conversation(Conversation conversation, bool do_reset_search = true, bool default_initialize_conversation = true) {
+ public void select_conversation(Conversation? conversation, bool do_reset_search = true, bool default_initialize_conversation = true) {
this.conversation = conversation;
update_conversation_display_name();
@@ -147,6 +149,26 @@ public class UnifiedWindowController : Object {
}
}
+ private void check_unset_conversation() {
+ if (stream_interactor.get_module(ConversationManager.IDENTITY).get_active_conversations().size == 0) {
+ unset_conversation();
+ }
+ }
+
+ private void unset_conversation() {
+ this.conversation = null;
+
+ conversation_display_name = null;
+ conversation_topic = null;
+
+ foreach(var e in this.app.plugin_registry.conversation_titlebar_entries) {
+ Plugins.ConversationTitlebarWidget widget = e.get_widget(Plugins.WidgetType.GTK);
+ if (widget != null) {
+ widget.unset_conversation();
+ }
+ }
+ }
+
private void update_conversation_display_name() {
conversation_display_name = Util.get_conversation_display_name(stream_interactor, conversation);
}