app: port to gtk4 version 0.4.1

This commit is contained in:
Stéphane Cerveau 2022-01-17 14:39:26 +01:00
parent fdfd739831
commit 21e5e4b4cb
8 changed files with 193 additions and 139 deletions

238
Cargo.lock generated
View file

@ -89,26 +89,26 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
[[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 1.3.2",
"cairo-sys-rs",
"glib",
"glib 0.15.2",
"libc",
"thiserror",
]
[[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",
"glib-sys 0.15.1",
"libc",
"system-deps 3.2.0",
"system-deps 6.0.0",
]
[[package]]
@ -261,60 +261,61 @@ 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 1.3.2",
"gdk-pixbuf-sys",
"gio",
"glib",
"glib 0.15.2",
"libc",
]
[[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",
"glib-sys 0.15.1",
"gobject-sys 0.15.1",
"libc",
"system-deps 3.2.0",
"system-deps 6.0.0",
]
[[package]]
name = "gdk4"
version = "0.3.1"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f97a162c17214d1bf981af3f683156a0b1667dd1927057c4f0a68513251ecf0f"
checksum = "f1023950739cd692fbf559507cad031bf2b0369d68466121f8a1316bc5ae29f0"
dependencies = [
"bitflags 1.3.2",
"cairo-rs",
"gdk-pixbuf",
"gdk4-sys",
"gio",
"glib",
"glib 0.15.2",
"libc",
"pango",
]
[[package]]
name = "gdk4-sys"
version = "0.3.1"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9498f4e06969fb96a4e4234dfe1d308a3ac6b120b3c6d93e3ec5c77fe88bc6d5"
checksum = "401b6be19db1e0ad2978fde7b46989b82f7595affa09cb56fe6f1302bc4f19e3"
dependencies = [
"cairo-sys-rs",
"gdk-pixbuf-sys",
"gio-sys",
"glib-sys",
"gobject-sys",
"graphene-sys",
"glib-sys 0.15.1",
"gobject-sys 0.15.1",
"libc",
"pango-sys",
"system-deps 5.0.0",
"pkg-config",
"system-deps 6.0.0",
]
[[package]]
@ -345,16 +346,16 @@ checksum = "78cc372d058dcf6d5ecd98510e7fbc9e5aec4d21de70f65fea8fecebcd881bd4"
[[package]]
name = "gio"
version = "0.14.8"
version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "711c3632b3ebd095578a9c091418d10fed492da9443f58ebc8f45efbeb215cb0"
checksum = "5e14e0166f772d6295cfda361d227a63194497641a42da81b9e531c9f5a4d77f"
dependencies = [
"bitflags 1.3.2",
"futures-channel",
"futures-core",
"futures-io",
"gio-sys",
"glib",
"glib 0.15.2",
"libc",
"once_cell",
"thiserror",
@ -362,14 +363,14 @@ 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",
"glib-sys 0.15.1",
"gobject-sys 0.15.1",
"libc",
"system-deps 3.2.0",
"system-deps 6.0.0",
"winapi",
]
@ -384,14 +385,34 @@ dependencies = [
"futures-core",
"futures-executor",
"futures-task",
"glib-macros",
"glib-sys",
"gobject-sys",
"glib-macros 0.14.1",
"glib-sys 0.14.0",
"gobject-sys 0.14.0",
"libc",
"once_cell",
"smallvec",
]
[[package]]
name = "glib"
version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "30a3e6b2e5ef2ecfb10c1e083074a81160b8f6408fcc08195c872e9de37a361b"
dependencies = [
"bitflags 1.3.2",
"futures-channel",
"futures-core",
"futures-executor",
"futures-task",
"glib-macros 0.15.1",
"glib-sys 0.15.1",
"gobject-sys 0.15.1",
"libc",
"once_cell",
"smallvec",
"thiserror",
]
[[package]]
name = "glib-macros"
version = "0.14.1"
@ -399,7 +420,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2aad66361f66796bfc73f530c51ef123970eb895ffba991a234fcf7bea89e518"
dependencies = [
"anyhow",
"heck",
"heck 0.3.3",
"proc-macro-crate",
"proc-macro-error",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "glib-macros"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "54c0c7194ee4c597b334e3ce84d22d929405e94497828e1c54da762cbe8e3d93"
dependencies = [
"anyhow",
"heck 0.4.0",
"proc-macro-crate",
"proc-macro-error",
"proc-macro2",
@ -417,50 +453,71 @@ dependencies = [
"system-deps 3.2.0",
]
[[package]]
name = "glib-sys"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c668102c6e15e0a7f6b99b59f602c2e806967bb86414f617b77e19b1de5b3fac"
dependencies = [
"libc",
"system-deps 6.0.0",
]
[[package]]
name = "gobject-sys"
version = "0.14.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa92cae29759dae34ab5921d73fff5ad54b3d794ab842c117e36cafc7994c3f5"
dependencies = [
"glib-sys",
"glib-sys 0.14.0",
"libc",
"system-deps 3.2.0",
]
[[package]]
name = "graphene-rs"
version = "0.14.8"
name = "gobject-sys"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e3380f132530ef9eb9e0a2bac180e30390aa5e49892d20294f822a974117a563"
checksum = "6edb1f0b3e4c08e2a0a490d1082ba9e902cdff8ff07091e85c6caec60d17e2ab"
dependencies = [
"glib",
"glib-sys 0.15.1",
"libc",
"system-deps 6.0.0",
]
[[package]]
name = "graphene-rs"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7c54f9fbbeefdb62c99f892dfca35f83991e2cb5b46a8dc2a715e58612f85570"
dependencies = [
"glib 0.15.2",
"graphene-sys",
"libc",
]
[[package]]
name = "graphene-sys"
version = "0.14.8"
version = "0.15.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a9ac7450b3aa80792513a3c029920a2ede419de13fb5169a4e51b07a5685332"
checksum = "03f311acb023cf7af5537f35de028e03706136eead7f25a31e8fd26f5011e0b3"
dependencies = [
"glib-sys",
"glib-sys 0.15.1",
"libc",
"pkg-config",
"system-deps 3.2.0",
"system-deps 6.0.0",
]
[[package]]
name = "gsk4"
version = "0.3.1"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eff59ca46c4fc5087fd7a0c3770a71ea4b6e94f8c24c12e2c2e8538f9f6fd764"
checksum = "d3dd7c79a864b8c4606d39fad3fd872688ea20ba8e833a9f38e905a458a29a8c"
dependencies = [
"bitflags 1.3.2",
"cairo-rs",
"gdk4",
"glib",
"glib 0.15.2",
"graphene-rs",
"gsk4-sys",
"libc",
@ -469,18 +526,18 @@ dependencies = [
[[package]]
name = "gsk4-sys"
version = "0.3.1"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13aa53ce70234da02f9954339d988d5ab853d746a8f47a4ae17735ff873545b5"
checksum = "6d25ee96f7d1bdb6fa9945425aea95ce60efedf60c994eceb671fd93ad11d541"
dependencies = [
"cairo-sys-rs",
"gdk4-sys",
"glib-sys",
"gobject-sys",
"glib-sys 0.15.1",
"gobject-sys 0.15.1",
"graphene-sys",
"libc",
"pango-sys",
"system-deps 5.0.0",
"system-deps 6.0.0",
]
[[package]]
@ -489,7 +546,6 @@ version = "0.1.0"
dependencies = [
"anyhow",
"gettext-rs",
"glib",
"gstreamer",
"gtk4",
"log 0.4.14",
@ -512,7 +568,7 @@ dependencies = [
"futures-channel",
"futures-core",
"futures-util",
"glib",
"glib 0.14.8",
"gstreamer-sys",
"libc",
"muldiv",
@ -530,17 +586,17 @@ version = "0.17.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a81704feeb3e8599913bdd1e738455c2991a01ff4a1780cb62200993e454cc3e"
dependencies = [
"glib-sys",
"gobject-sys",
"glib-sys 0.14.0",
"gobject-sys 0.14.0",
"libc",
"system-deps 3.2.0",
]
[[package]]
name = "gtk4"
version = "0.3.1"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "58a04f421d1485ba4739e723199f5828bca05ab4e622ed39a96a342b6b1a6a3d"
checksum = "a6fda2b49a25eefc1116f15d06585d333c21fc3ce499ab0a86641fac2fbf40ac"
dependencies = [
"bitflags 1.3.2",
"cairo-rs",
@ -549,7 +605,7 @@ dependencies = [
"gdk-pixbuf",
"gdk4",
"gio",
"glib",
"glib 0.15.2",
"graphene-rs",
"gsk4",
"gtk4-macros",
@ -561,13 +617,11 @@ dependencies = [
[[package]]
name = "gtk4-macros"
version = "0.3.1"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5068d4354af02454f44687adc613100aa98ae11e273cdcac84f89dc08be2b4a1"
checksum = "5b17860e493ada8a40577f0e92bce8249a97c831e39d7811ef21de6281d67f86"
dependencies = [
"anyhow",
"heck",
"itertools",
"proc-macro-crate",
"proc-macro-error",
"proc-macro2",
@ -577,21 +631,21 @@ dependencies = [
[[package]]
name = "gtk4-sys"
version = "0.3.1"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e20a64c8f0ddcff8902ff04c130747f2fb7834a43530f75d03d6c71335733b49"
checksum = "ffc1047ea7a0ff2947fbfb703eecfcca6b58912171037a4c55b1577015f079d5"
dependencies = [
"cairo-sys-rs",
"gdk-pixbuf-sys",
"gdk4-sys",
"gio-sys",
"glib-sys",
"gobject-sys",
"glib-sys 0.15.1",
"gobject-sys 0.15.1",
"graphene-sys",
"gsk4-sys",
"libc",
"pango-sys",
"system-deps 5.0.0",
"system-deps 6.0.0",
]
[[package]]
@ -603,6 +657,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 = "idna"
version = "0.1.5"
@ -806,12 +866,12 @@ checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56"
[[package]]
name = "pango"
version = "0.14.8"
version = "0.15.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "546fd59801e5ca735af82839007edd226fe7d3bb06433ec48072be4439c28581"
checksum = "79211eff430c29cc38c69e0ab54bc78fa1568121ca9737707eee7f92a8417a94"
dependencies = [
"bitflags 1.3.2",
"glib",
"glib 0.15.2",
"libc",
"once_cell",
"pango-sys",
@ -819,14 +879,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",
"glib-sys 0.15.1",
"gobject-sys 0.15.1",
"libc",
"system-deps 3.2.0",
"system-deps 6.0.0",
]
[[package]]
@ -864,9 +924,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
[[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 = "pretty-hex"
@ -1117,7 +1177,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",
@ -1154,27 +1214,27 @@ checksum = "480c269f870722b3b08d2f13053ce0c2ab722839f472863c3e2d61ff3a1c2fa6"
dependencies = [
"anyhow",
"cfg-expr 0.8.1",
"heck",
"heck 0.3.3",
"itertools",
"pkg-config",
"strum",
"strum_macros",
"thiserror",
"toml 0.5.8",
"version-compare",
"version-compare 0.0.11",
]
[[package]]
name = "system-deps"
version = "5.0.0"
version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "18db855554db7bd0e73e06cf7ba3df39f97812cb11d3f75e71c39bf45171797e"
checksum = "7b1487aaddaacbc5d60a2a507ba1617c5ca66c57dd0dd07d0c5efd5b693841d4"
dependencies = [
"cfg-expr 0.9.0",
"heck",
"heck 0.3.3",
"pkg-config",
"toml 0.5.8",
"version-compare",
"version-compare 0.1.0",
]
[[package]]
@ -1306,6 +1366,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

@ -6,10 +6,9 @@ edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
gtk = { version = "0.3", package = "gtk4" }
gtk = { version = "0.4.1", package = "gtk4" }
anyhow = "1"
gettext-rs = {version = "0.7", features = ["gettext-system"]}
glib = "0.14"
gstreamer = "0.17"
log = "0.4.11"
once_cell = "1.7.2"

View file

@ -19,6 +19,7 @@
use crate::app::GPSApp;
use crate::config;
use gettextrs::gettext;
use gtk::builders::AboutDialogBuilder;
use gtk::prelude::*;
use gtk::ApplicationWindow;
@ -28,7 +29,7 @@ pub fn display_about_dialog(app: &GPSApp) {
.builder
.object("mainwindow")
.expect("Couldn't get window");
let about_dialog = gtk::AboutDialogBuilder::new()
let about_dialog = AboutDialogBuilder::new()
.modal(true)
.program_name("GstPipelineStudio")
.version(config::VERSION)

View file

@ -214,12 +214,12 @@ impl GPSApp {
if let Some((x, y)) = widget.translate_coordinates(&mainwindow, x, y) {
let point = graphene::Point::new(x as f32, y as f32);
pop_menu.set_pointing_to(&Rectangle {
x: point.to_vec2().x() as i32,
y: point.to_vec2().y() as i32,
width: 0,
height: 0,
});
pop_menu.set_pointing_to(Some(&Rectangle::new(
point.to_vec2().x() as i32,
point.to_vec2().y() as i32,
0,
0,
)));
}
pop_menu
}
@ -398,10 +398,7 @@ impl GPSApp {
let app = upgrade_weak!(app_weak);
let selection = tree_view.selection();
if let Some((model, iter)) = selection.selected() {
let element_name = model
.get(&iter, 0)
.get::<String>()
.expect("Treeview selection, column 1");
let element_name = model.get::<String>(&iter, 1);
GPS_DEBUG!("{} selected", element_name);
app.add_new_element(&element_name);
}
@ -416,9 +413,7 @@ impl GPSApp {
let selection = favorite_list.selection();
if let Some((model, iter)) = selection.selected() {
let element_name = model
.get(&iter, 0)
.get::<String>()
.expect("Treeview selection, column 0");
.get::<String>(&iter, 1);
GPS_DEBUG!("Element {} selected", element_name);
let pop_menu = app.app_pop_menu_at_position(&favorite_list, x, y);
@ -594,9 +589,7 @@ impl GPSApp {
});
let app_weak = self.downgrade();
self.graphview
.borrow()
.connect_local(
self.graphview.borrow().connect_local(
"graph-updated",
false,
glib::clone!(@weak application => @default-return None, move |values: &[Value]| {
@ -612,8 +605,7 @@ impl GPSApp {
.map_err(|e| GPS_WARN!("Unable to save file {}", e));
None
}),
)
.expect("Failed to register graph-updated signal of graphview");
);
// When user clicks on port with right button
let app_weak = self.downgrade();
self.graphview
@ -642,14 +634,14 @@ impl GPSApp {
pop_menu.show();
None
}),
)
.expect("Failed to register graph-right-clicked signal of graphview");
);
// When user clicks on port with right button
let app_weak = self.downgrade();
self.graphview
.borrow()
.connect_local("port-right-clicked", false, move |values: &[Value]| {
self.graphview.borrow().connect_local(
"port-right-clicked",
false,
move |values: &[Value]| {
let app = upgrade_weak!(app_weak, None);
let port_id = values[1].get::<u32>().expect("port id args[1]");
@ -673,8 +665,8 @@ impl GPSApp {
});
pop_menu.show();
None
})
.expect("Failed to register port-right-clicked signal of graphview");
},
);
// When user clicks on node with right button
let app_weak = self.downgrade();
@ -752,8 +744,7 @@ impl GPSApp {
pop_menu.show();
None
}),
)
.expect("Failed to register node-right-clicked signal of graphview");
);
// Setup the favorite list
self.setup_favorite_list(application);

View file

@ -1,5 +1,4 @@
use glib::Sender;
use gtk::glib;
use gtk::glib::Sender;
use log::{debug, error, info, trace, warn};
use simplelog::*;
use std::fmt;

View file

@ -21,6 +21,7 @@ use crate::graphmanager::{GraphView, Node, NodeType, PortDirection};
use crate::logger;
use crate::GPS_INFO;
use gst::glib;
use gst::prelude::*;
use gstreamer as gst;
use std::cell::{Cell, RefCell};

View file

@ -92,9 +92,7 @@ pub fn display_plugin_list(app: &GPSApp, elements: &[ElementInfo]) {
let selection = tree_view.selection();
if let Some((model, iter)) = selection.selected() {
let element_name = model
.get(&iter, 1)
.get::<String>()
.expect("Unable to get the treeview selection, column 1");
.get::<String>(&iter, 1);
let description = Pipeline::element_description(&element_name).expect("Unable to get element description from GStreamer");
text_buffer.set_text("");
text_buffer.insert_markup(&mut text_buffer.end_iter(), &description);
@ -108,9 +106,7 @@ pub fn display_plugin_list(app: &GPSApp, elements: &[ElementInfo]) {
let selection = tree_view.selection();
if let Some((model, iter)) = selection.selected() {
let element_name = model
.get(&iter, 1)
.get::<String>()
.expect("Unable to get the treeview selection, column 1");
.get::<String>(&iter, 1);
app.add_new_element(&element_name);
}
}),

View file

@ -1,3 +1,4 @@
use gtk::glib;
use std::fs::create_dir_all;
use std::path::PathBuf;