[fractal] room-history: Update event actions when its source changes



commit 454bb4e5e454e94e15898a7d34744dec163fc38b
Author: Kévin Commaille <zecakeh tedomum fr>
Date:   Thu Sep 15 17:13:00 2022 +0200

    room-history: Update event actions when its source changes

 src/session/content/room_history/item_row.rs | 6 +++---
 src/session/room/event/mod.rs                | 8 ++++----
 2 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/src/session/content/room_history/item_row.rs b/src/session/content/room_history/item_row.rs
index a57c270f1..1511cf5cb 100644
--- a/src/session/content/room_history/item_row.rs
+++ b/src/session/content/room_history/item_row.rs
@@ -222,15 +222,15 @@ impl ItemRow {
 
         if let Some(ref item) = item {
             if let Some(event) = item.downcast_ref::<SupportedEvent>() {
-                self.set_action_group(self.set_event_actions(Some(event.upcast_ref())));
-
                 let notify_handler =
-                    event.connect_pure_event_notify(clone!(@weak self as obj => move |event| {
+                    event.connect_source_notify(clone!(@weak self as obj => move |event| {
                         obj.set_event_widget(event);
+                        obj.set_action_group(obj.set_event_actions(Some(event.upcast_ref())));
                     }));
                 priv_.notify_handler.replace(Some(notify_handler));
 
                 self.set_event_widget(event);
+                self.set_action_group(self.set_event_actions(Some(event.upcast_ref())));
             } else if let Some(divider) = item.downcast_ref::<TimelineDayDivider>() {
                 self.set_popover(None);
                 self.set_action_group(None);
diff --git a/src/session/room/event/mod.rs b/src/session/room/event/mod.rs
index 0ce3daf7b..4d6c305c2 100644
--- a/src/session/room/event/mod.rs
+++ b/src/session/room/event/mod.rs
@@ -98,7 +98,7 @@ mod imp {
                         "Source",
                         "The JSON source of this Event",
                         None,
-                        glib::ParamFlags::READABLE | glib::ParamFlags::EXPLICIT_NOTIFY,
+                        glib::ParamFlags::READABLE,
                     ),
                     glib::ParamSpecObject::new(
                         "room",
@@ -243,7 +243,7 @@ pub trait EventExt: 'static {
         Some(time)
     }
 
-    fn connect_pure_event_notify<F: Fn(&Self) + 'static>(&self, f: F) -> glib::SignalHandlerId;
+    fn connect_source_notify<F: Fn(&Self) + 'static>(&self, f: F) -> glib::SignalHandlerId;
 }
 
 impl<O: IsA<Event>> EventExt for O {
@@ -298,8 +298,8 @@ impl<O: IsA<Event>> EventExt for O {
         imp::event_origin_server_ts(self.upcast_ref())
     }
 
-    fn connect_pure_event_notify<F: Fn(&Self) + 'static>(&self, f: F) -> glib::SignalHandlerId {
-        self.connect_notify_local(Some("pure-event"), move |this, _| {
+    fn connect_source_notify<F: Fn(&Self) + 'static>(&self, f: F) -> glib::SignalHandlerId {
+        self.connect_notify_local(Some("source"), move |this, _| {
             f(this);
         })
     }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]