aboutsummaryrefslogtreecommitdiff
path: root/main/src/ui/unified_window_controller.vala
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2019-09-30 02:11:23 +0200
committerfiaxh <git@lightrise.org>2019-10-01 17:03:24 +0200
commitdf3716622a37cded9e3754da77497ca6d2f2baeb (patch)
tree079e18e51ea54723c5b1209173f8d3f75b54d102 /main/src/ui/unified_window_controller.vala
parent5d65f047d0fd1a1ed4a3bbe076d5cb4df76e7d5f (diff)
downloaddino-df3716622a37cded9e3754da77497ca6d2f2baeb.tar.gz
dino-df3716622a37cded9e3754da77497ca6d2f2baeb.zip
Rework no-open-conversation placeholder
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);
}