deps: Update gtk-rs to latest release

This commit is contained in:
Tom A. Wagner
2022-01-17 12:00:00 +01:00
parent 96182826e4
commit 4075b66865
5 changed files with 132 additions and 152 deletions

142
Cargo.lock generated
View File

@@ -92,9 +92,9 @@ dependencies = [
[[package]]
name = "cairo-rs"
version = "0.14.7"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9164355c892b026d6257e696dde5f3cb39beb3718297f0f161b562fe2ee3ab86"
checksum = "b869e97a87170f96762f9f178eae8c461147e722ba21dd8814105bf5716bf14a"
dependencies = [
"bitflags",
"cairo-sys-rs",
@@ -105,13 +105,13 @@ dependencies = [
[[package]]
name = "cairo-sys-rs"
version = "0.14.0"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7c9c3928781e8a017ece15eace05230f04b647457d170d2d9641c94a444ff80"
checksum = "3c55d429bef56ac9172d25fecb85dc8068307d17acd74b377866b7a1ef25d3c8"
dependencies = [
"glib-sys",
"libc",
"system-deps 3.2.0",
"system-deps 6.0.0",
]
[[package]]
@@ -301,10 +301,11 @@ dependencies = [
[[package]]
name = "gdk-pixbuf"
version = "0.14.0"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "534192cb8f01daeb8fab2c8d4baa8f9aae5b7a39130525779f5c2608e235b10f"
checksum = "172dfe1d9dfb62936bf7ad3ede2913a1b21b1e3db56990e46e00789201de9070"
dependencies = [
"bitflags",
"gdk-pixbuf-sys",
"gio",
"glib",
@@ -313,22 +314,22 @@ dependencies = [
[[package]]
name = "gdk-pixbuf-sys"
version = "0.14.0"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f097c0704201fbc8f69c1762dc58c6947c8bb188b8ed0bc7e65259f1894fe590"
checksum = "413424d9818621fa3cfc8a3a915cdb89a7c3c507d56761b4ec83a9a98e587171"
dependencies = [
"gio-sys",
"glib-sys",
"gobject-sys",
"libc",
"system-deps 3.2.0",
"system-deps 6.0.0",
]
[[package]]
name = "gdk4"
version = "0.3.0"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4c0f7f98ad25b81ac9462f74a091b0e4c0983ed1e74d19a38230c772b4dcef81"
checksum = "f1023950739cd692fbf559507cad031bf2b0369d68466121f8a1316bc5ae29f0"
dependencies = [
"bitflags",
"cairo-rs",
@@ -342,26 +343,26 @@ dependencies = [
[[package]]
name = "gdk4-sys"
version = "0.3.0"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "262a79666b42e1884577f11a050439a964b95dec55343ac6ace7930e1415fa18"
checksum = "401b6be19db1e0ad2978fde7b46989b82f7595affa09cb56fe6f1302bc4f19e3"
dependencies = [
"cairo-sys-rs",
"gdk-pixbuf-sys",
"gio-sys",
"glib-sys",
"gobject-sys",
"graphene-sys",
"libc",
"pango-sys",
"system-deps 4.0.0",
"pkg-config",
"system-deps 6.0.0",
]
[[package]]
name = "gio"
version = "0.14.6"
version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f3a29d8062af72045518271a2cd98b4e1617ce43f5b4223ad0fb9a0eff8f718c"
checksum = "5e14e0166f772d6295cfda361d227a63194497641a42da81b9e531c9f5a4d77f"
dependencies = [
"bitflags",
"futures-channel",
@@ -376,22 +377,22 @@ dependencies = [
[[package]]
name = "gio-sys"
version = "0.14.0"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c0a41df66e57fcc287c4bcf74fc26b884f31901ea9792ec75607289b456f48fa"
checksum = "04b57719ccaacf2a0d9c79f151be629f3a3ef3991658ee2af0bb66287e4ea86c"
dependencies = [
"glib-sys",
"gobject-sys",
"libc",
"system-deps 3.2.0",
"system-deps 6.0.0",
"winapi",
]
[[package]]
name = "glib"
version = "0.14.5"
version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4a930b7208e6e0ab839eea5f65ac2b82109f729621430d47fe905e2e09d33f4"
checksum = "30a3e6b2e5ef2ecfb10c1e083074a81160b8f6408fcc08195c872e9de37a361b"
dependencies = [
"bitflags",
"futures-channel",
@@ -405,16 +406,17 @@ dependencies = [
"log",
"once_cell",
"smallvec",
"thiserror",
]
[[package]]
name = "glib-macros"
version = "0.14.1"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2aad66361f66796bfc73f530c51ef123970eb895ffba991a234fcf7bea89e518"
checksum = "54c0c7194ee4c597b334e3ce84d22d929405e94497828e1c54da762cbe8e3d93"
dependencies = [
"anyhow",
"heck",
"heck 0.4.0",
"proc-macro-crate",
"proc-macro-error",
"proc-macro2",
@@ -424,12 +426,12 @@ dependencies = [
[[package]]
name = "glib-sys"
version = "0.14.0"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c1d60554a212445e2a858e42a0e48cece1bd57b311a19a9468f70376cf554ae"
checksum = "c668102c6e15e0a7f6b99b59f602c2e806967bb86414f617b77e19b1de5b3fac"
dependencies = [
"libc",
"system-deps 3.2.0",
"system-deps 6.0.0",
]
[[package]]
@@ -440,20 +442,20 @@ checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
[[package]]
name = "gobject-sys"
version = "0.14.0"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa92cae29759dae34ab5921d73fff5ad54b3d794ab842c117e36cafc7994c3f5"
checksum = "6edb1f0b3e4c08e2a0a490d1082ba9e902cdff8ff07091e85c6caec60d17e2ab"
dependencies = [
"glib-sys",
"libc",
"system-deps 3.2.0",
"system-deps 6.0.0",
]
[[package]]
name = "graphene-rs"
version = "0.14.0"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1460a39f06e491e6112f27e71e51435c833ba370723224dd1743dfd1f201f19"
checksum = "7c54f9fbbeefdb62c99f892dfca35f83991e2cb5b46a8dc2a715e58612f85570"
dependencies = [
"glib",
"graphene-sys",
@@ -462,21 +464,21 @@ dependencies = [
[[package]]
name = "graphene-sys"
version = "0.14.0"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e7d23fb7a9547e5f072a7e0cd49cd648fedeb786d122b106217511980cbb8962"
checksum = "03f311acb023cf7af5537f35de028e03706136eead7f25a31e8fd26f5011e0b3"
dependencies = [
"glib-sys",
"libc",
"pkg-config",
"system-deps 3.2.0",
"system-deps 6.0.0",
]
[[package]]
name = "gsk4"
version = "0.3.0"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "20b71f2e2cc699c2e0fbfa22899eeaffd84f9c1dc01e9263deac8664eec22dc0"
checksum = "d3dd7c79a864b8c4606d39fad3fd872688ea20ba8e833a9f38e905a458a29a8c"
dependencies = [
"bitflags",
"cairo-rs",
@@ -490,9 +492,9 @@ dependencies = [
[[package]]
name = "gsk4-sys"
version = "0.3.0"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30468aff80e4faadf22f9ba164ea17511a69a9995d7a13827a13424ef47b2472"
checksum = "6d25ee96f7d1bdb6fa9945425aea95ce60efedf60c994eceb671fd93ad11d541"
dependencies = [
"cairo-sys-rs",
"gdk4-sys",
@@ -501,14 +503,14 @@ dependencies = [
"graphene-sys",
"libc",
"pango-sys",
"system-deps 4.0.0",
"system-deps 6.0.0",
]
[[package]]
name = "gtk4"
version = "0.3.0"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "906f9308d15789d96a736881582181d710ae0937197119df459f3d2b46ef6776"
checksum = "a6fda2b49a25eefc1116f15d06585d333c21fc3ce499ab0a86641fac2fbf40ac"
dependencies = [
"bitflags",
"cairo-rs",
@@ -529,13 +531,11 @@ dependencies = [
[[package]]
name = "gtk4-macros"
version = "0.3.0"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4d0d008cdf23214c697482415dd20f666bdf3cc9f5e803b017223c17c5b59a6e"
checksum = "5b17860e493ada8a40577f0e92bce8249a97c831e39d7811ef21de6281d67f86"
dependencies = [
"anyhow",
"heck",
"itertools",
"proc-macro-crate",
"proc-macro-error",
"proc-macro2",
@@ -545,9 +545,9 @@ dependencies = [
[[package]]
name = "gtk4-sys"
version = "0.3.0"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d06be0a6322aa77dd372f726e97efbcbb192d9a824a414a8874f238effd7747c"
checksum = "ffc1047ea7a0ff2947fbfb703eecfcca6b58912171037a4c55b1577015f079d5"
dependencies = [
"cairo-sys-rs",
"gdk-pixbuf-sys",
@@ -559,7 +559,7 @@ dependencies = [
"gsk4-sys",
"libc",
"pango-sys",
"system-deps 4.0.0",
"system-deps 6.0.0",
]
[[package]]
@@ -571,6 +571,12 @@ dependencies = [
"unicode-segmentation",
]
[[package]]
name = "heck"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
[[package]]
name = "helvum"
version = "0.3.2"
@@ -731,9 +737,9 @@ checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56"
[[package]]
name = "pango"
version = "0.14.3"
version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e1fc88307d9797976ea62722ff2ec5de3fae279c6e20100ed3f49ca1a4bf3f96"
checksum = "79211eff430c29cc38c69e0ab54bc78fa1568121ca9737707eee7f92a8417a94"
dependencies = [
"bitflags",
"glib",
@@ -744,14 +750,14 @@ dependencies = [
[[package]]
name = "pango-sys"
version = "0.14.0"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2367099ca5e761546ba1d501955079f097caa186bb53ce0f718dca99ac1942fe"
checksum = "7022c2fb88cd2d9d55e1a708a8c53a3ae8678234c4a54bf623400aeb7f31fac2"
dependencies = [
"glib-sys",
"gobject-sys",
"libc",
"system-deps 3.2.0",
"system-deps 6.0.0",
]
[[package]]
@@ -812,9 +818,9 @@ dependencies = [
[[package]]
name = "pkg-config"
version = "0.3.20"
version = "0.3.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c9b1041b4387893b91ee6746cddfc28516aff326a3519fb2adf820932c5e6cb"
checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe"
[[package]]
name = "proc-macro-crate"
@@ -988,7 +994,7 @@ version = "0.21.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d06aaeeee809dbc59eb4556183dd927df67db1540de5be8d3ec0b6636358a5ec"
dependencies = [
"heck",
"heck 0.3.3",
"proc-macro2",
"quote",
"syn",
@@ -1013,27 +1019,27 @@ checksum = "480c269f870722b3b08d2f13053ce0c2ab722839f472863c3e2d61ff3a1c2fa6"
dependencies = [
"anyhow",
"cfg-expr 0.8.1",
"heck",
"heck 0.3.3",
"itertools",
"pkg-config",
"strum",
"strum_macros",
"thiserror",
"toml",
"version-compare",
"version-compare 0.0.11",
]
[[package]]
name = "system-deps"
version = "4.0.0"
version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c1889ab44c2a423ba9ba4d64cd04989b25c0280ca7ade813f05368418722a04"
checksum = "7b1487aaddaacbc5d60a2a507ba1617c5ca66c57dd0dd07d0c5efd5b693841d4"
dependencies = [
"cfg-expr 0.9.0",
"heck",
"heck 0.3.3",
"pkg-config",
"toml",
"version-compare",
"version-compare 0.1.0",
]
[[package]]
@@ -1125,6 +1131,12 @@ version = "0.0.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1c18c859eead79d8b95d09e4678566e8d70105c4e7b251f707a03df32442661b"
[[package]]
name = "version-compare"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fe88247b92c1df6b6de80ddc290f3976dbdf2f5f5d3fd049a9fb598c6dd5ca73"
[[package]]
name = "version_check"
version = "0.9.3"

View File

@@ -15,8 +15,8 @@ categories = ["gui", "multimedia"]
[dependencies]
pipewire = "0.4"
gtk = { version = "0.3", package = "gtk4" }
glib = { version = "0.14", features = ["log"] }
gtk = { version = "0.4.1", package = "gtk4" }
glib = { version = "0.15.1", features = ["log"] }
log = "0.4.11"

View File

@@ -25,7 +25,7 @@ use gtk::{
prelude::*,
subclass::prelude::*,
};
use log::{info, warn};
use log::info;
use pipewire::{channel::Sender, spa::Direction};
use crate::{
@@ -56,10 +56,10 @@ mod imp {
impl ObjectImpl for Application {}
impl ApplicationImpl for Application {
fn activate(&self, app: &Self::Type) {
let scrollwindow = gtk::ScrolledWindowBuilder::new()
let scrollwindow = gtk::ScrolledWindow::builder()
.child(&self.graphview)
.build();
let window = gtk::ApplicationWindowBuilder::new()
let window = gtk::ApplicationWindow::builder()
.application(app)
.default_width(1280)
.default_height(720)
@@ -170,7 +170,7 @@ impl Application {
let port = view::Port::new(id, name, direction, media_type);
// Create or delete a link if the widget emits the "port-toggled" signal.
if let Err(e) = port.connect_local(
port.connect_local(
"port_toggled",
false,
clone!(@weak self as app => @default-return None, move |args| {
@@ -182,9 +182,7 @@ impl Application {
None
}),
) {
warn!("Failed to connect to \"port-toggled\" signal: {}", e);
}
);
imp.graphview.add_port(node_id, id, port);
}

View File

@@ -70,7 +70,6 @@ mod imp {
let mut drag_state = drag_state.borrow_mut();
let widget = drag_controller
.widget()
.expect("drag-begin event has no widget")
.dynamic_cast::<Self::Type>()
.expect("drag-begin event is not on the GraphView");
// pick() should at least return the widget itself.
@@ -82,12 +81,8 @@ mod imp {
} else if let Some(target) = target.ancestor(Node::static_type()) {
// The user targeted a Node without targeting a specific Port.
// Drag the Node around the screen.
if let Some((x, y)) = widget.get_node_position(&target) {
Some((target, x, y))
} else {
error!("Failed to obtain position of dragged node, drag aborted.");
None
}
let (x, y) = widget.get_node_position(&target);
Some((target, x, y))
} else {
None
}
@@ -97,7 +92,6 @@ mod imp {
clone!(@strong drag_state => move |drag_controller, x, y| {
let widget = drag_controller
.widget()
.expect("drag-update event has no widget")
.dynamic_cast::<Self::Type>()
.expect("drag-update event is not on the GraphView");
let drag_state = drag_state.borrow();
@@ -125,25 +119,23 @@ mod imp {
let alloc = widget.allocation();
let widget_bounds =
graphene::Rect::new(0.0, 0.0, alloc.width as f32, alloc.height as f32);
graphene::Rect::new(0.0, 0.0, alloc.width() as f32, alloc.height() as f32);
let background_cr = snapshot
.append_cairo(&widget_bounds)
.expect("Failed to get cairo context");
let background_cr = snapshot.append_cairo(&widget_bounds);
// Draw a nice grid on the background.
background_cr.set_source_rgb(0.18, 0.18, 0.18);
background_cr.set_line_width(0.2); // TODO: Set to 1px
let mut y = 0.0;
while y < alloc.height.into() {
while y < alloc.height().into() {
background_cr.move_to(0.0, y);
background_cr.line_to(alloc.width.into(), y);
background_cr.line_to(alloc.width().into(), y);
y += 20.0; // TODO: Change to em;
}
let mut x = 0.0;
while x < alloc.width.into() {
while x < alloc.width().into() {
background_cr.move_to(x, 0.0);
background_cr.line_to(x, alloc.height.into());
background_cr.line_to(x, alloc.height().into());
x += 20.0; // TODO: Change to em;
}
if let Err(e) = background_cr.stroke() {
@@ -157,32 +149,26 @@ mod imp {
.for_each(|node| self.instance().snapshot_child(node, snapshot));
// Draw all links
let link_cr = snapshot
.append_cairo(&graphene::Rect::new(
0.0,
0.0,
alloc.width as f32,
alloc.height as f32,
))
.expect("Failed to get cairo context");
let link_cr = snapshot.append_cairo(&graphene::Rect::new(
0.0,
0.0,
alloc.width() as f32,
alloc.height() as f32,
));
link_cr.set_line_width(2.0);
let gtk::gdk::RGBA {
red,
green,
blue,
alpha,
} = widget
let rgba = widget
.style_context()
.lookup_color("graphview-link")
.unwrap_or(gtk::gdk::RGBA {
red: 0.0,
green: 0.0,
blue: 0.0,
alpha: 0.0,
});
link_cr.set_source_rgba(red.into(), green.into(), blue.into(), alpha.into());
.unwrap_or_else(|| gtk::gdk::RGBA::new(0.0, 0.0, 0.0, 0.0));
link_cr.set_source_rgba(
rgba.red().into(),
rgba.green().into(),
rgba.blue().into(),
rgba.alpha().into(),
);
for (link, active) in self.links.borrow().values() {
if let Some((from_x, from_y, to_x, to_y)) = self.get_link_coordinates(link) {
@@ -239,34 +225,26 @@ mod imp {
// so we manually calculate the needed offsets here.
let from_port = &nodes.get(&link.node_from)?.get_port(link.port_from)?;
let gtk::Allocation {
x: mut fx,
y: mut fy,
width: fw,
height: fh,
} = from_port.allocation();
let from_node = from_port
.ancestor(Node::static_type())
.expect("Port is not a child of a node");
let gtk::Allocation { x: fnx, y: fny, .. } = from_node.allocation();
fx += fnx + fw;
fy += fny + (fh / 2);
let from_x = from_node.allocation().x()
+ from_port.allocation().x()
+ from_port.allocation().width();
let from_y = from_node.allocation().y()
+ from_port.allocation().y()
+ (from_port.allocation().height() / 2);
let to_port = &nodes.get(&link.node_to)?.get_port(link.port_to)?;
let gtk::Allocation {
x: mut tx,
y: mut ty,
height: th,
..
} = to_port.allocation();
let to_node = to_port
.ancestor(Node::static_type())
.expect("Port is not a child of a node");
let gtk::Allocation { x: tnx, y: tny, .. } = to_node.allocation();
tx += tnx;
ty += tny + (th / 2);
let to_x = to_node.allocation().x() + to_port.allocation().x();
let to_y = to_node.allocation().y()
+ to_port.allocation().y()
+ (to_port.allocation().height() / 2);
Some((fx.into(), fy.into(), tx.into(), ty.into()))
Some((from_x.into(), from_y.into(), to_x.into(), to_y.into()))
}
}
}
@@ -299,8 +277,8 @@ impl GraphView {
.nodes
.borrow()
.values()
.filter_map(|node| {
// Map nodes to locations, discard nodes without location
.map(|node| {
// Map nodes to their locations
self.get_node_position(&node.clone().upcast())
})
.filter(|(x2, _)| {
@@ -374,9 +352,7 @@ impl GraphView {
}
/// Get the position of the specified node inside the graphview.
///
/// Returns `None` if the node is not in the graphview.
pub(super) fn get_node_position(&self, node: &gtk::Widget) -> Option<(f32, f32)> {
pub(super) fn get_node_position(&self, node: &gtk::Widget) -> (f32, f32) {
let layout_manager = self
.layout_manager()
.expect("Failed to get layout manager")
@@ -384,13 +360,12 @@ impl GraphView {
.expect("Failed to cast to FixedLayout");
let node = layout_manager
.layout_child(node)?
.layout_child(node)
.dynamic_cast::<gtk::FixedLayoutChild>()
.expect("Could not cast to FixedLayoutChild");
let transform = node
.transform()
.expect("Failed to obtain transform from layout child");
Some(transform.to_translate())
node.transform()
.expect("Failed to obtain transform from layout child")
.to_translate()
}
pub(super) fn move_node(&self, node: &gtk::Widget, x: f32, y: f32) {
@@ -407,7 +382,6 @@ impl GraphView {
layout_manager
.layout_child(node)
.expect("Could not get layout child")
.dynamic_cast::<gtk::FixedLayoutChild>()
.expect("Could not cast to FixedLayoutChild")
.set_transform(&transform);

View File

@@ -30,14 +30,14 @@ use crate::MediaType;
/// A helper struct for linking a output port to an input port.
/// It carries the output ports id.
#[derive(Clone, Debug, glib::GBoxed)]
#[gboxed(type_name = "HelvumForwardLink")]
#[derive(Clone, Debug, glib::Boxed)]
#[boxed_type(name = "HelvumForwardLink")]
struct ForwardLink(u32);
/// A helper struct for linking an input to an output port.
/// It carries the input ports id.
#[derive(Clone, Debug, glib::GBoxed)]
#[gboxed(type_name = "HelvumReversedLink")]
#[derive(Clone, Debug, glib::Boxed)]
#[boxed_type(name = "HelvumReversedLink")]
struct ReversedLink(u32);
mod imp {
@@ -123,7 +123,7 @@ impl Port {
// FIXME: We should protect against different media types, e.g. it should not be possible to drop a video port on an audio port.
// The port will simply provide its pipewire id to the drag target.
let drag_src = gtk::DragSourceBuilder::new()
let drag_src = gtk::DragSource::builder()
.content(&gdk::ContentProvider::for_value(&match direction {
Direction::Input => ReversedLink(id).to_value(),
Direction::Output => ForwardLink(id).to_value(),
@@ -155,9 +155,7 @@ impl Port {
// Get the callback registered in the widget and call it
drop_target
.widget()
.expect("Drop target has no widget")
.emit_by_name("port-toggled", &[&source_id, &this.id()])
.expect("Failed to send signal");
.emit_by_name::<()>("port-toggled", &[&source_id, &this.id()]);
} else {
warn!("Invalid type dropped on ingoing port");
}
@@ -173,9 +171,7 @@ impl Port {
// Get the callback registered in the widget and call it
drop_target
.widget()
.expect("Drop target has no widget")
.emit_by_name("port-toggled", &[&this.id(), &target_id])
.expect("Failed to send signal");
.emit_by_name::<()>("port-toggled", &[&this.id(), &target_id]);
} else {
warn!("Invalid type dropped on outgoing port");
}