diff options
author | fiaxh <git@lightrise.org> | 2019-09-30 02:11:23 +0200 |
---|---|---|
committer | fiaxh <git@lightrise.org> | 2019-10-01 17:03:24 +0200 |
commit | df3716622a37cded9e3754da77497ca6d2f2baeb (patch) | |
tree | 079e18e51ea54723c5b1209173f8d3f75b54d102 /main/src/ui/unified_window_controller.vala | |
parent | 5d65f047d0fd1a1ed4a3bbe076d5cb4df76e7d5f (diff) | |
download | dino-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.vala | 24 |
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); } |