arcnmx / wireplumber.rs

wireplumber rust bindings
https://arcnmx.github.io/wireplumber.rs/main/wireplumber/
MIT License
21 stars 3 forks source link

manually implement wp_link_get_state #7

Closed arcnmx closed 1 year ago

arcnmx commented 1 year ago

I'm not sure how to tell gir that the error argument should be treated as an error, so...

@Ryuukyu313 does this work for you?

diff --git a/src/view/graph_view.rs b/src/view/graph_view.rs
index aa089ce..ca9bb2b 100644
--- a/src/view/graph_view.rs
+++ b/src/view/graph_view.rs
@@ -433,8 +433,7 @@ mod imp {
                     link_cr.move_to(from_x, from_y);

                     // Use dashed line for inactive links, full line otherwise.
-                    // FIXME: This can use the .state method when https://github.com/arcnmx/wireplumber.rs/issues/6 is fixed
-                    if link.property::<wp::pw::LinkState>("state") == wp::pw::LinkState::Active {
+                    if link.state() == wp::pw::LinkState::Active {
                         link_cr.set_dash(&[], 0.0);
                     } else {
                         link_cr.set_dash(&[10.0, 5.0], 0.0);

It does draw solid lines as expected, and the state_result api works (but isn't entirely ideal)

fixes #6