Skip to content

Commit

Permalink
Don't use signal select for now
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinresol committed Sep 9, 2021
1 parent 2e19020 commit b02b032
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
13 changes: 5 additions & 8 deletions src/why/dbus/client/Interface.hx
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,16 @@ class InterfaceBase {

function __signal<T>(iface:String, member:String, signature:SignatureCode):Signal<T> {
return new Signal(cb -> {
final binding = object.destination.transport.signals.select(
message -> {
return if(
final binding = object.destination.transport.signals.handle(
message ->
if(
(object.path == null || message.path == object.path) &&
message.iface == iface &&
message.member == member &&
message.signature == signature
)
Some(cast message.body);
else
None;
}
).handle(cb);
cb(cast message.body)
);
final registrar = object.destination.sibling('org.freedesktop.DBus').getObject('/org/freedesktop/DBus').getInterface(org.freedesktop.DBus);
final rule = new why.dbus.MatchRule({type: Signal, sender: object.destination.name, path: object.path, iface: iface, member: member}).toString();

Expand Down
14 changes: 6 additions & 8 deletions src/why/dbus/client/Property.hx
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,14 @@ class Property<T> implements ReadWriteProperty<T> {
this.name = name;
this.signature = signature;
this.optional = optional;
this.changed = properties.propertiesChanged.select(v -> {
if(v.v0 == iface) {
switch v.v1.get(name) {
case null: None;
case variant: Some((variant.value:T));
this.changed = new Signal(cb -> properties.propertiesChanged.handle((iface, updated, invalidated) -> {
if(iface == this.iface) {
switch updated.get(name) {
case null: // skip
case variant: cb((variant.value:T));
}
} else {
None;
}
});
}));
}

public function get():Promise<T> {
Expand Down

0 comments on commit b02b032

Please sign in to comment.