Fix presence subscription notification displaying

This commit is contained in:
fiaxh 2018-09-11 14:41:51 +02:00
parent 83bf0631a5
commit bf2c78d1b7

View file

@ -132,14 +132,20 @@ public class ConversationView : Box, Plugins.ConversationItemCollection {
} }
private void initialize_for_conversation_(Conversation? conversation) { private void initialize_for_conversation_(Conversation? conversation) {
// Deinitialize old conversation
Dino.Application app = Dino.Application.get_default(); Dino.Application app = Dino.Application.get_default();
if (this.conversation != null) { if (this.conversation != null) {
foreach (Plugins.ConversationItemPopulator populator in app.plugin_registry.conversation_addition_populators) { foreach (Plugins.ConversationItemPopulator populator in app.plugin_registry.conversation_addition_populators) {
populator.close(conversation); populator.close(conversation);
} }
} }
// Clear data structures
clear_notifications();
this.conversation = conversation; this.conversation = conversation;
// Init for new conversation
foreach (Plugins.ConversationItemPopulator populator in app.plugin_registry.conversation_addition_populators) { foreach (Plugins.ConversationItemPopulator populator in app.plugin_registry.conversation_addition_populators) {
populator.init(conversation, this, Plugins.WidgetType.GTK); populator.init(conversation, this, Plugins.WidgetType.GTK);
} }
@ -378,6 +384,9 @@ public class ConversationView : Box, Plugins.ConversationItemCollection {
item_item_skeletons.clear(); item_item_skeletons.clear();
widgets.clear(); widgets.clear();
main.@foreach((widget) => { widget.destroy(); }); main.@foreach((widget) => { widget.destroy(); });
}
private void clear_notifications() {
notifications.@foreach((widget) => { widget.destroy(); }); notifications.@foreach((widget) => { widget.destroy(); });
notification_revealer.transition_duration = 0; notification_revealer.transition_duration = 0;
notification_revealer.set_reveal_child(false); notification_revealer.set_reveal_child(false);