From 454bb4e5e454e94e15898a7d34744dec163fc38b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= Date: Thu, 15 Sep 2022 17:13:00 +0200 Subject: [PATCH] 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 a57c270f..1511cf5c 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::() { - 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::() { 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 0ce3daf7..4d6c305c 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(&self, f: F) -> glib::SignalHandlerId; + fn connect_source_notify(&self, f: F) -> glib::SignalHandlerId; } impl> EventExt for O { @@ -298,8 +298,8 @@ impl> EventExt for O { imp::event_origin_server_ts(self.upcast_ref()) } - fn connect_pure_event_notify(&self, f: F) -> glib::SignalHandlerId { - self.connect_notify_local(Some("pure-event"), move |this, _| { + fn connect_source_notify(&self, f: F) -> glib::SignalHandlerId { + self.connect_notify_local(Some("source"), move |this, _| { f(this); }) }