aboutsummaryrefslogtreecommitdiff
path: root/main/src
diff options
context:
space:
mode:
authorMarvin W <git@larma.de>2018-11-10 08:05:14 -0600
committerMarvin W <git@larma.de>2018-11-10 08:05:14 -0600
commitdfb75e2cda1eb9edbbdd9ea88c131d9cb31742ed (patch)
treed3c1ae4251844239eb46e57c8eacf03466aed608 /main/src
parent559bbc5ca3ad5d44ea949788005a29fe9d86a232 (diff)
parent65a12021bc7abbf5ddea068ffe9b4715cfc34f0b (diff)
downloaddino-dfb75e2cda1eb9edbbdd9ea88c131d9cb31742ed.tar.gz
dino-dfb75e2cda1eb9edbbdd9ea88c131d9cb31742ed.zip
Merge PR #413 "Improvements to the OMEMO plugin"
Diffstat (limited to 'main/src')
-rw-r--r--main/src/ui/conversation_summary/conversation_view.vala25
1 files changed, 24 insertions, 1 deletions
diff --git a/main/src/ui/conversation_summary/conversation_view.vala b/main/src/ui/conversation_summary/conversation_view.vala
index af6e96c1..83da81aa 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; }
@@ -46,6 +46,8 @@ public class ConversationView : Box, Plugins.ConversationItemCollection {
insert_item.connect(filter_insert_item);
remove_item.connect(do_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_addition_populator(new ChatStatePopulator(stream_interactor));
@@ -134,6 +136,9 @@ public class ConversationView : Box, Plugins.ConversationItemCollection {
foreach (Plugins.ConversationItemPopulator populator in app.plugin_registry.conversation_addition_populators) {
populator.close(conversation);
}
+ foreach (Plugins.NotificationPopulator populator in app.plugin_registry.notification_populators) {
+ populator.close(conversation);
+ }
}
// Clear data structures
@@ -159,6 +164,10 @@ public class ConversationView : Box, Plugins.ConversationItemCollection {
foreach (ContentMetaItem item in items) {
do_insert_item(item);
}
+ Application app = GLib.Application.get_default() as Application;
+ foreach (Plugins.NotificationPopulator populator in app.plugin_registry.notification_populators) {
+ populator.init(conversation, this, Plugins.WidgetType.GTK);
+ }
Idle.add(() => { on_value_notify(); return false; });
}
@@ -203,6 +212,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, () => {