diff options
Diffstat (limited to 'main/src/ui/conversation_summary')
-rw-r--r-- | main/src/ui/conversation_summary/conversation_view.vala | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/main/src/ui/conversation_summary/conversation_view.vala b/main/src/ui/conversation_summary/conversation_view.vala index fac53b7d..b4a34f3b 100644 --- a/main/src/ui/conversation_summary/conversation_view.vala +++ b/main/src/ui/conversation_summary/conversation_view.vala @@ -7,7 +7,7 @@ using Dino.Entities; namespace Dino.Ui.ConversationSummary { [GtkTemplate (ui = "/im/dino/Dino/conversation_summary/view.ui")] -public class ConversationView : Box, Plugins.ConversationItemCollection { +public class ConversationView : Box, Plugins.ConversationItemCollection, Plugins.NotificationCollection { public Conversation? conversation { get; private set; } @@ -44,6 +44,8 @@ public class ConversationView : Box, Plugins.ConversationItemCollection { insert_item.connect(on_insert_item); remove_item.connect(on_remove_item); + add_meta_notification.connect(on_add_meta_notification); + remove_meta_notification.connect(on_remove_meta_notification); Application app = GLib.Application.get_default() as Application; app.plugin_registry.register_conversation_item_populator(new ChatStatePopulator(stream_interactor)); @@ -81,6 +83,9 @@ public class ConversationView : Box, Plugins.ConversationItemCollection { foreach (Plugins.ConversationItemPopulator populator in app.plugin_registry.conversation_item_populators) { populator.close(conversation); } + foreach (Plugins.NotificationPopulator populator in app.plugin_registry.notification_populators) { + populator.close(conversation); + } } this.conversation = conversation; stack.set_visible_child_name("void"); @@ -93,6 +98,9 @@ public class ConversationView : Box, Plugins.ConversationItemCollection { foreach (Plugins.ConversationItemPopulator populator in app.plugin_registry.conversation_item_populators) { populator.init(conversation, this, Plugins.WidgetType.GTK); } + foreach (Plugins.NotificationPopulator populator in app.plugin_registry.notification_populators) { + populator.init(conversation, this, Plugins.WidgetType.GTK); + } message_item_populator.init(conversation, this); message_item_populator.populate_latest(conversation, 40); Idle.add(() => { on_value_notify(); return false; }); @@ -126,6 +134,20 @@ public class ConversationView : Box, Plugins.ConversationItemCollection { } } + public void on_add_meta_notification(Plugins.MetaConversationNotification notification) { + Widget? widget = (Widget) notification.get_widget(Plugins.WidgetType.GTK); + if (widget != null) { + add_notification(widget); + } + } + + public void on_remove_meta_notification(Plugins.MetaConversationNotification notification){ + Widget? widget = (Widget) notification.get_widget(Plugins.WidgetType.GTK); + if (widget != null) { + remove_notification(widget); + } + } + public void add_notification(Widget widget) { notifications.add(widget); Timeout.add(20, () => { |