Update dependencies

This commit is contained in:
Tom A. Wagner
2023-08-17 20:14:23 +02:00
parent 7145c83ae1
commit bf5c7e4636
7 changed files with 264 additions and 329 deletions

520
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -3,7 +3,7 @@ name = "helvum"
version = "0.4.0"
authors = ["Tom A. Wagner <tom.a.wagner@protonmail.com>"]
edition = "2021"
rust-version = "1.56"
rust-version = "1.70"
license = "GPL-3.0-only"
description = "A GTK patchbay for pipewire"
repository = "https://gitlab.freedesktop.org/pipewire/helvum"
@@ -14,9 +14,9 @@ categories = ["gui", "multimedia"]
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
pipewire = "0.6"
gtk = { version = "0.6", package = "gtk4" }
glib = { version = "0.17", features = ["log"] }
pipewire = "0.7"
gtk = { version = "0.7", package = "gtk4" }
glib = { version = "0.18", features = ["log"] }
log = "0.4.11"

View File

@@ -46,24 +46,13 @@ mod imp {
type ParentType = glib::Object;
}
impl ObjectImpl for GraphManager {
fn properties() -> &'static [glib::ParamSpec] {
Self::derived_properties()
}
fn property(&self, id: usize, pspec: &glib::ParamSpec) -> glib::Value {
Self::derived_property(self, id, pspec)
}
fn set_property(&self, id: usize, value: &glib::Value, pspec: &glib::ParamSpec) {
Self::derived_set_property(self, id, value, pspec)
}
}
#[glib::derived_properties]
impl ObjectImpl for GraphManager {}
impl GraphManager {
pub fn attach_receiver(&self, receiver: glib::Receiver<crate::PipewireMessage>) {
receiver.attach(None, glib::clone!(
@weak self as imp => @default-return Continue(true),
@weak self as imp => @default-return glib::ControlFlow::Continue,
move |msg| {
match msg {
PipewireMessage::NodeAdded{ id, name, node_type } => imp.add_node(id, name.as_str(), node_type),
@@ -74,7 +63,7 @@ mod imp {
PipewireMessage::PortRemoved { id, node_id } => imp.remove_port(id, node_id),
PipewireMessage::LinkRemoved { id } => imp.remove_link(id)
};
Continue(true)
glib::ControlFlow::Continue
}
));
}

View File

@@ -19,7 +19,6 @@ mod graph_manager;
mod pipewire_connection;
mod ui;
use glib::PRIORITY_DEFAULT;
use gtk::prelude::*;
use pipewire::spa::Direction;
@@ -111,7 +110,8 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
let _guard = ctx.acquire().unwrap();
// Start the pipewire thread with channels in both directions.
let (gtk_sender, gtk_receiver) = glib::MainContext::channel(PRIORITY_DEFAULT);
let (gtk_sender, gtk_receiver) = glib::MainContext::channel(glib::Priority::DEFAULT);
let (pw_sender, pw_receiver) = pipewire::channel::channel();
let pw_thread =
std::thread::spawn(move || pipewire_connection::thread_main(gtk_sender, pw_receiver));

View File

@@ -357,7 +357,7 @@ mod imp {
drop.read_value_async(
Port::static_type(),
glib::PRIORITY_DEFAULT,
glib::Priority::DEFAULT,
Option::<&gio::Cancellable>::None,
clone!(@weak self as imp => move|value| {
let Ok(value) = value else {
@@ -407,9 +407,9 @@ mod imp {
.unwrap();
widget.set_zoom_factor(widget.zoom_factor() + (0.1 * -delta_y), None);
gtk::Inhibit(true)
glib::Propagation::Stop
} else {
gtk::Inhibit(false)
glib::Propagation::Proceed
}
});
self.obj().add_controller(scroll_controller);
@@ -576,6 +576,7 @@ mod imp {
let (output_anchor, input_anchor) = match port.direction() {
Direction::Output => (&port_anchor, &other_anchor),
Direction::Input => (&other_anchor, &port_anchor),
_ => unreachable!(),
};
self.draw_link(link_cr, output_anchor, input_anchor, false);

View File

@@ -82,24 +82,13 @@ mod imp {
}
}
#[glib::derived_properties]
impl ObjectImpl for Node {
fn constructed(&self) {
self.parent_constructed();
self.grid.set_parent(&*self.obj());
}
fn properties() -> &'static [glib::ParamSpec] {
Self::derived_properties()
}
fn property(&self, id: usize, pspec: &glib::ParamSpec) -> glib::Value {
Self::derived_property(self, id, pspec)
}
fn set_property(&self, id: usize, value: &glib::Value, pspec: &glib::ParamSpec) {
Self::derived_set_property(self, id, value, pspec)
}
fn dispose(&self) {
self.grid.unparent();
}
@@ -133,6 +122,7 @@ impl Node {
imp.grid.attach(&port, 1, imp.num_ports_out.get() + 1, 1, 1);
imp.num_ports_out.set(imp.num_ports_out.get() + 1);
}
_ => unreachable!(),
}
imp.ports.borrow_mut().insert(port);
@@ -144,6 +134,7 @@ impl Node {
match port.direction() {
Direction::Input => imp.num_ports_in.set(imp.num_ports_in.get() - 1),
Direction::Output => imp.num_ports_in.set(imp.num_ports_out.get() - 1),
_ => unreachable!(),
}
port.unparent();

View File

@@ -63,6 +63,7 @@ mod imp {
}
}
#[glib::derived_properties]
impl ObjectImpl for Port {
fn constructed(&self) {
self.parent_constructed();
@@ -80,18 +81,6 @@ mod imp {
self.label.unparent()
}
fn properties() -> &'static [glib::ParamSpec] {
Self::derived_properties()
}
fn property(&self, id: usize, pspec: &glib::ParamSpec) -> glib::Value {
Self::derived_property(self, id, pspec)
}
fn set_property(&self, id: usize, value: &glib::Value, pspec: &glib::ParamSpec) {
Self::derived_set_property(self, id, value, pspec)
}
fn signals() -> &'static [Signal] {
static SIGNALS: Lazy<Vec<Signal>> = Lazy::new(|| {
vec![Signal::builder("port-toggled")
@@ -182,6 +171,7 @@ mod imp {
let (output_port, input_port) = match port.direction() {
Direction::Output => (&port, &other_port),
Direction::Input => (&other_port, &port),
_ => unreachable!(),
};
port.emit_by_name::<()>(
@@ -229,8 +219,9 @@ impl Port {
res
}
pub fn direction(&self) -> &Direction {
self.imp()
pub fn direction(&self) -> Direction {
*self
.imp()
.direction
.get()
.expect("Port direction is not set")
@@ -247,6 +238,7 @@ impl Port {
match self.direction() {
Direction::Output => self.width() as f32 + padding_right + border_right,
Direction::Input => 0.0 - padding_left - border_left,
_ => unreachable!(),
},
self.height() as f32 / 2.0,
)