room-history: Update event actions when its source changes
This commit is contained in:
parent
0b8d78c7e3
commit
454bb4e5e4
2 changed files with 7 additions and 7 deletions
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue