From 906cc41a680a350c58f2d44f95ed2e1d3abaf160 Mon Sep 17 00:00:00 2001 From: ranfdev Date: Wed, 3 Jul 2024 19:15:24 +0200 Subject: [PATCH 1/3] v1.6.0 --- Cargo.lock | 2 +- Cargo.toml | 2 +- data/com.ranfdev.Geopard.metainfo.xml.in.in | 5 +++++ meson.build | 2 +- nix/geopard.nix | 2 +- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index caf11b0..33a855c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -467,7 +467,7 @@ dependencies = [ [[package]] name = "geopard" -version = "1.5.0" +version = "1.6.0" dependencies = [ "anyhow", "async-fs", diff --git a/Cargo.toml b/Cargo.toml index 4771555..0371657 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "geopard" -version = "1.5.0" +version = "1.6.0" authors = ["ranfdev "] edition = "2021" diff --git a/data/com.ranfdev.Geopard.metainfo.xml.in.in b/data/com.ranfdev.Geopard.metainfo.xml.in.in index e723496..d4b45b5 100644 --- a/data/com.ranfdev.Geopard.metainfo.xml.in.in +++ b/data/com.ranfdev.Geopard.metainfo.xml.in.in @@ -84,6 +84,11 @@ + + +

Various small fixes

+
+

Updated to latest libadwaita and GTK to improve performance and compatibility, diff --git a/meson.build b/meson.build index 16a6117..da347f0 100644 --- a/meson.build +++ b/meson.build @@ -1,7 +1,7 @@ project( 'geopard', 'rust', - version: '1.5.0', + version: '1.6.0', meson_version: '>= 0.59', # license: MIT, ) diff --git a/nix/geopard.nix b/nix/geopard.nix index 6005aae..45db81e 100644 --- a/nix/geopard.nix +++ b/nix/geopard.nix @@ -22,7 +22,7 @@ stdenv.mkDerivation { pname = "geopard"; - version = "1.5.0"; + version = "1.6.0"; cargoDeps = rustPlatform.importCargoLock { lockFile = ../Cargo.lock; From 25cd1c6b8ce97fea3e1ebde6af5d429e7d471aff Mon Sep 17 00:00:00 2001 From: ranfdev Date: Thu, 26 Sep 2024 17:01:00 +0000 Subject: [PATCH 2/3] Update to gnome 47 sdk --- Cargo.lock | 191 +++++++++-------------- Cargo.toml | 6 +- build-aux/com.ranfdev.Geopard.Devel.json | 6 +- gemini/Cargo.toml | 4 +- src/widgets/window.rs | 6 +- 5 files changed, 83 insertions(+), 130 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 33a855c..3b709f6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -76,7 +76,7 @@ checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn", ] [[package]] @@ -104,9 +104,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] name = "bitflags" -version = "2.4.2" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "blocking" @@ -126,22 +126,21 @@ dependencies = [ [[package]] name = "cairo-rs" -version = "0.19.1" +version = "0.20.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc1c415b7088381c53c575420899c34c9e6312df5ac5defd05614210e9fd6e1b" +checksum = "e8a0ea147c94108c9613235388f540e4d14c327f7081c9e471fc8ee8a2533e69" dependencies = [ "bitflags", "cairo-sys-rs", "glib", "libc", - "thiserror", ] [[package]] name = "cairo-sys-rs" -version = "0.19.1" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75b6a5fefce2eadb8333e3c604ac964ba6573ec4f28bdd17f67032c4a2831831" +checksum = "428290f914b9b86089f60f5d8a9f6e440508e1bcff23b25afd51502b0a2da88f" dependencies = [ "glib-sys", "libc", @@ -150,9 +149,9 @@ dependencies = [ [[package]] name = "cfg-expr" -version = "0.15.7" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa50868b64a9a6fda9d593ce778849ea8715cd2a3d2cc17ffdb4a2f2f2f1961d" +checksum = "d0890061c4d3223e7267f3bad2ec40b997d64faac1c2815a4a9d95018e2b9e9c" dependencies = [ "smallvec", "target-lexicon", @@ -361,7 +360,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn", ] [[package]] @@ -396,9 +395,9 @@ dependencies = [ [[package]] name = "gdk-pixbuf" -version = "0.19.0" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c311c47800051b87de1335e8792774d7cec551c91a0a3d109ab21d76b36f208f" +checksum = "c4c29071a9e92337d8270a85cb0510cda4ac478be26d09ad027cc1d081911b19" dependencies = [ "gdk-pixbuf-sys", "gio", @@ -408,9 +407,9 @@ dependencies = [ [[package]] name = "gdk-pixbuf-sys" -version = "0.19.0" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dcbd04c1b2c4834cc008b4828bc917d062483b88d26effde6342e5622028f96" +checksum = "687343b059b91df5f3fbd87b4307038fa9e647fcc0461d0d3f93e94fee20bf3d" dependencies = [ "gio-sys", "glib-sys", @@ -421,9 +420,9 @@ dependencies = [ [[package]] name = "gdk4" -version = "0.8.0" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6771942f85a2beaa220c64739395e4401b9fab4a52aba9b503fa1e6ed4d4d806" +checksum = "c121aeeb0cf7545877ae615dac6bfd088b739d8abee4d55e7143b06927d16a31" dependencies = [ "cairo-rs", "gdk-pixbuf", @@ -436,9 +435,9 @@ dependencies = [ [[package]] name = "gdk4-sys" -version = "0.8.0" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eb95854fab65072023a7814434f003db571d6e45c287c0b0c540c1c78bdf6ae" +checksum = "7d3c03d1ea9d5199f14f060890fde68a3b5ec5699144773d1fa6abf337bfbc9c" dependencies = [ "cairo-sys-rs", "gdk-pixbuf-sys", @@ -487,9 +486,9 @@ dependencies = [ [[package]] name = "gio" -version = "0.19.0" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1aaa2d926710a27f3b35822806b1513b393b71174dd2601c9d02fdab0cb82" +checksum = "b8d999e8fb09583e96080867e364bc1e701284ad206c76a5af480d63833ad43c" dependencies = [ "futures-channel", "futures-core", @@ -500,14 +499,13 @@ dependencies = [ "libc", "pin-project-lite", "smallvec", - "thiserror", ] [[package]] name = "gio-sys" -version = "0.19.0" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcf8e1d9219bb294636753d307b030c1e8a032062cba74f493c431a5c8b81ce4" +checksum = "4f7efc368de04755344f0084104835b6bb71df2c1d41e37d863947392a894779" dependencies = [ "glib-sys", "gobject-sys", @@ -518,9 +516,9 @@ dependencies = [ [[package]] name = "glib" -version = "0.19.0" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "170ee82b9b44b3b5fd1cf4971d6cf0eadec38303bb84c7bcc4e6b95a18934e71" +checksum = "adcf1ec6d3650bf9fdbc6cee242d4fcebc6f6bfd9bea5b929b6a8b7344eb85ff" dependencies = [ "bitflags", "futures-channel", @@ -535,27 +533,26 @@ dependencies = [ "libc", "memchr", "smallvec", - "thiserror", ] [[package]] name = "glib-macros" -version = "0.19.0" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ff52fff7e4d1bb8598ae744e9bb90c8c76271712483c3f0ce931bee9814de85" +checksum = "a6bf88f70cd5720a6197639dcabcb378dd528d0cb68cb1f45e3b358bcb841cd7" dependencies = [ "heck", "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.48", + "syn", ] [[package]] name = "glib-sys" -version = "0.19.0" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "630f097773d7c7a0bb3258df4e8157b47dc98bbfa0e60ad9ab56174813feced4" +checksum = "5f9eca5d88cfa6a453b00d203287c34a2b7cac3a7831779aa2bb0b3c7233752b" dependencies = [ "libc", "system-deps", @@ -563,9 +560,9 @@ dependencies = [ [[package]] name = "gobject-sys" -version = "0.19.0" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c85e2b1080b9418dd0c58b498da3a5c826030343e0ef07bde6a955d28de54979" +checksum = "a4c674d2ff8478cf0ec29d2be730ed779fef54415a2fb4b565c52def62696462" dependencies = [ "glib-sys", "libc", @@ -574,9 +571,9 @@ dependencies = [ [[package]] name = "graphene-rs" -version = "0.19.0" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147827e4f506f8073ac3ec5b28cc2255bdf3abc30f5b4e101a80506eebe11d2c" +checksum = "1f53144c7fe78292705ff23935f1477d511366fb2f73c43d63b37be89076d2fe" dependencies = [ "glib", "graphene-sys", @@ -585,9 +582,9 @@ dependencies = [ [[package]] name = "graphene-sys" -version = "0.19.0" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "236ed66cc9b18d8adf233716f75de803d0bf6fc806f60d14d948974a12e240d0" +checksum = "e741797dc5081e59877a4d72c442c72d61efdd99161a0b1c1b29b6b988934b99" dependencies = [ "glib-sys", "libc", @@ -597,9 +594,9 @@ dependencies = [ [[package]] name = "gsk4" -version = "0.8.0" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e8ce8dee0fd87a11002214b1204ff18c9272fbd530408f0884a0f9b25dc31de" +checksum = "aa21a2f7c51ee1c6cc1242c2faf3aae2b7566138f182696759987bde8219e922" dependencies = [ "cairo-rs", "gdk4", @@ -612,9 +609,9 @@ dependencies = [ [[package]] name = "gsk4-sys" -version = "0.8.0" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2660a652da5b662d43924df19ba40d73f015ed427329ef51d2b1360a4e0dc0e4" +checksum = "0f9fb607554f9f4e8829eb7ea301b0fde051e1dbfd5d16b143a8a9c2fac6c01b" dependencies = [ "cairo-sys-rs", "gdk4-sys", @@ -628,9 +625,9 @@ dependencies = [ [[package]] name = "gtk4" -version = "0.8.0" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d26ffa3ec6316ccaa1df62d3e7f5bae1637c0acbb43f250fabef38319f73c64" +checksum = "31e2d105ce672f5cdcb5af2602e91c2901e91c72da15ab76f613ad57ecf04c6d" dependencies = [ "cairo-rs", "field-offset", @@ -649,23 +646,21 @@ dependencies = [ [[package]] name = "gtk4-macros" -version = "0.8.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8b86439e9896f6f3f47c3d8077c5c8205174078760afdabd9098a8e9e937d97" +checksum = "e9e7b362c8fccd2712297903717d65d30defdab2b509bc9d209cbe5ffb9fabaf" dependencies = [ - "anyhow", "proc-macro-crate", - "proc-macro-error", "proc-macro2", "quote", - "syn 1.0.109", + "syn", ] [[package]] name = "gtk4-sys" -version = "0.8.0" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2abc0a6d356d59a3806021829ce6ed3e70bba3509b41a535fedcb09fae13fbc0" +checksum = "cbe4325908b1c1642dbb48e9f49c07a73185babf43e8b2065b0f881a589f55b8" dependencies = [ "cairo-sys-rs", "gdk-pixbuf-sys", @@ -688,9 +683,9 @@ checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" [[package]] name = "heck" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "hermit-abi" @@ -738,11 +733,10 @@ dependencies = [ [[package]] name = "libadwaita" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91b4990248b9e1ec5e72094a2ccaea70ec3809f88f6fd52192f2af306b87c5d9" +checksum = "2ff9c222b5c783729de45185f07b2fec2d43a7f9c63961e777d3667e20443878" dependencies = [ - "gdk-pixbuf", "gdk4", "gio", "glib", @@ -754,9 +748,9 @@ dependencies = [ [[package]] name = "libadwaita-sys" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23a748e4e92be1265cd9e93d569c0b5dfc7814107985aa6743d670ab281ea1a8" +checksum = "1c44d8bdbad31d6639e1f20cc9c1424f1a8e02d751fc28d44659bf743fb9eca6" dependencies = [ "gdk4-sys", "gio-sys", @@ -782,9 +776,9 @@ checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "memchr" -version = "2.7.1" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "memoffset" @@ -803,9 +797,9 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "pango" -version = "0.19.0" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78d7f779b957728c74fd1a060dfa6d89a0bea792ebc50cc2da80e4e87282d69e" +checksum = "aa26aa54b11094d72141a754901cd71d9356432bb8147f9cace8d9c7ba95f356" dependencies = [ "gio", "glib", @@ -815,9 +809,9 @@ dependencies = [ [[package]] name = "pango-sys" -version = "0.19.0" +version = "0.20.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f52ef6a881c19fbfe3b1484df5cad411acaaba29dbec843941c3110d19f340ea" +checksum = "84fd65917bf12f06544ae2bbc200abf9fc0a513a5a88a0fa81013893aef2b838" dependencies = [ "glib-sys", "gobject-sys", @@ -862,9 +856,9 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.29" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "proc-macro-crate" @@ -875,35 +869,11 @@ dependencies = [ "toml_edit 0.21.1", ] -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn 1.0.109", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - [[package]] name = "proc-macro2" -version = "1.0.78" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] @@ -978,7 +948,7 @@ checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn", ] [[package]] @@ -1007,20 +977,9 @@ checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.48" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -1029,9 +988,9 @@ dependencies = [ [[package]] name = "system-deps" -version = "6.2.0" +version = "7.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a2d580ff6a20c55dfb86be5f9c238f67835d0e81cbdea8bf5680e0897320331" +checksum = "66d23aaf9f331227789a99e8de4c91bf46703add012bdfd45fdecdfb2975a005" dependencies = [ "cfg-expr", "heck", @@ -1042,9 +1001,9 @@ dependencies = [ [[package]] name = "target-lexicon" -version = "0.12.13" +version = "0.12.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69758bda2e78f098e4ccb393021a0963bb3442eac05f135c30f61b7370bbafae" +checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" [[package]] name = "termcolor" @@ -1072,7 +1031,7 @@ checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn", ] [[package]] @@ -1194,15 +1153,9 @@ dependencies = [ [[package]] name = "version-compare" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "579a42fc0b8e0c63b76519a339be31bed574929511fa53c1a3acae26eb258f29" - -[[package]] -name = "version_check" -version = "0.9.4" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b" [[package]] name = "waker-fn" diff --git a/Cargo.toml b/Cargo.toml index 0371657..fd45102 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,8 +10,8 @@ edition = "2021" [dependencies.gtk] package = "gtk4" -version = "0.8" -features = ["v4_8"] +version = "0.9" +features = ["v4_12"] [dependencies] gemini = { path = "gemini" } @@ -26,4 +26,4 @@ toml = "0.5.6" serde = { version = "1.0.116", features = ["derive"] } env_logger = "0.8.1" log = "0.4.0" -adw = { package = "libadwaita", version = "0.6", features = ["v1_5"]} \ No newline at end of file +adw = { package = "libadwaita", version = "0.7", features = ["v1_5"]} \ No newline at end of file diff --git a/build-aux/com.ranfdev.Geopard.Devel.json b/build-aux/com.ranfdev.Geopard.Devel.json index dc6ae86..44b999f 100644 --- a/build-aux/com.ranfdev.Geopard.Devel.json +++ b/build-aux/com.ranfdev.Geopard.Devel.json @@ -1,11 +1,11 @@ { "app-id" : "com.ranfdev.Geopard.Devel", "runtime" : "org.gnome.Platform", - "runtime-version" : "46", + "runtime-version" : "47", "sdk" : "org.gnome.Sdk", "sdk-extensions" : [ "org.freedesktop.Sdk.Extension.rust-stable", - "org.freedesktop.Sdk.Extension.llvm16" + "org.freedesktop.Sdk.Extension.llvm18" ], "command" : "geopard", "tags" : [ @@ -20,7 +20,7 @@ "--filesystem=xdg-download" ], "build-options" : { - "append-path" : "/usr/lib/sdk/rust-stable/bin:/usr/lib/sdk/llvm16/bin", + "append-path" : "/usr/lib/sdk/rust-stable/bin:/usr/lib/sdk/llvm18/bin", "build-args" : [ "--share=network" ], diff --git a/gemini/Cargo.toml b/gemini/Cargo.toml index 06fde5c..c076bc6 100644 --- a/gemini/Cargo.toml +++ b/gemini/Cargo.toml @@ -12,9 +12,9 @@ futures = "0.3.5" log = "0.4.0" url = "2.1.1" thiserror = "1.0.20" -glib = "0.19" +glib = "0.20" [dependencies.gio] package = "gio" -version = "0.19" +version = "0.20" features = ["v2_70"] diff --git a/src/widgets/window.rs b/src/widgets/window.rs index fa8203a..ff7af4e 100644 --- a/src/widgets/window.rs +++ b/src/widgets/window.rs @@ -325,7 +325,7 @@ impl Window { this.close(); }; - true + glib::Propagation::Proceed }), ); imp.tab_overview.connect_create_tab( @@ -717,7 +717,7 @@ impl Window { ) }; - imp.style_provider.borrow().load_from_data(&stylesheet); + imp.style_provider.borrow().load_from_string(&stylesheet); Ok(()) } @@ -746,7 +746,7 @@ impl Window { .website("https://github.com/ranfdev/Geopard") .build(); about.add_link("Donate 💝", "https://github.com/sponsors/ranfdev"); - about.present(self); + about.present(Some(self)); } fn focus_next_tab(&self) { From 7b996f7ab8e17216afb6c8bc715d949e834fe8b9 Mon Sep 17 00:00:00 2001 From: ranfdev Date: Thu, 26 Sep 2024 17:37:34 +0000 Subject: [PATCH 3/3] Fix deprecated code --- src/common/mod.rs | 19 +++++++++++++++- src/macros.rs | 2 +- src/widgets/pages/hypertext.rs | 6 ++--- src/widgets/tab.rs | 12 +++++----- src/widgets/window.rs | 40 ++++++++++++++++++++-------------- 5 files changed, 52 insertions(+), 27 deletions(-) diff --git a/src/common/mod.rs b/src/common/mod.rs index eb3f777..9d4aecf 100644 --- a/src/common/mod.rs +++ b/src/common/mod.rs @@ -1,4 +1,4 @@ -use gtk::glib; +use gtk::{glib, gio}; use once_cell::sync::Lazy; use url::Url; @@ -57,3 +57,20 @@ pub fn bookmarks_url() -> Url { pub fn glibctx() -> glib::MainContext { glib::MainContext::default() } + +pub fn open_uri_externally(uri: &str) { + gtk::UriLauncher::new(&uri).launch(None::<>k::Window>, None::<&gio::Cancellable>, |res| { + if let Err(e) = res { + log::error!("error opening external uri {:?}", e); + } + }); +} + +pub fn open_file_externally(path: &std::path::Path) { + let file = gio::File::for_path(path); + gtk::FileLauncher::new(Some(&file)).launch(None::<>k::Window>, None::<&gio::Cancellable>, |res| { + if let Err(e) = res { + log::error!("error opening external file {:?}", e); + } + }); +} diff --git a/src/macros.rs b/src/macros.rs index 770fb75..086928d 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -4,7 +4,7 @@ macro_rules! self_action { { let this = &$self; let action = gio::SimpleAction::new($name, None); - action.connect_activate(clone!(@weak this => move |_,_| this.$method())); + action.connect_activate(clone!(#[weak] this, move |_,_| this.$method())); $self.add_action(&action); action } diff --git a/src/widgets/pages/hypertext.rs b/src/widgets/pages/hypertext.rs index 7175542..e788a7c 100644 --- a/src/widgets/pages/hypertext.rs +++ b/src/widgets/pages/hypertext.rs @@ -237,7 +237,7 @@ impl Hypertext { let motion_ctrl = gtk::EventControllerMotion::new(); left_click_ctrl.connect_released( - clone!(@strong this => @default-panic, move |ctrl, _n_press, x, y| { + clone!(#[strong] this, move |ctrl, _n_press, x, y| { if let Err(e) = this.handle_click(ctrl, x, y) { log::info!("{}", e); }; @@ -245,14 +245,14 @@ impl Hypertext { ); right_click_ctrl.connect_pressed( - clone!(@strong this => @default-panic, move |_ctrl, _n_press, x, y| { + clone!(#[strong] this, move |_ctrl, _n_press, x, y| { if let Err(e) = this.handle_right_click(x, y) { log::info!("{}", e); }; }), ); - motion_ctrl.connect_motion(clone!(@strong this => @default-panic,move |_ctrl, x, y| { + motion_ctrl.connect_motion(clone!(#[strong] this, move |_ctrl, x, y| { let _ = this.handle_motion(x, y); })); diff --git a/src/widgets/tab.rs b/src/widgets/tab.rs index 65970ec..7440078 100644 --- a/src/widgets/tab.rs +++ b/src/widgets/tab.rs @@ -22,7 +22,7 @@ use url::Url; use super::pages::{self, hypertext}; use crate::common; -use crate::common::glibctx; +use crate::common::{glibctx, open_uri_externally, open_file_externally}; use crate::lossy_text_read::*; use crate::session_provider::SessionProvider; @@ -470,7 +470,7 @@ impl Tab { let downloaded_file_url = format!("file://{}", d_path.as_os_str().to_str().unwrap()); info!("Downloading to {}", downloaded_file_url); page.imp().open_btn.connect_clicked(move |_| { - gtk::show_uri(None::<>k::Window>, &downloaded_file_url, 0); + open_file_externally(&std::path::Path::new(&downloaded_file_url)); }); let ext = file_name.split('.').last(); @@ -594,7 +594,7 @@ impl Tab { button.set_halign(gtk::Align::Center); let url_clone = url.clone(); button.connect_clicked(move |_| { - gtk::show_uri(None::<>k::Window>, url_clone.as_str(), 0); + open_uri_externally(url_clone.as_str()); }); child.append(&button); @@ -615,7 +615,7 @@ impl Tab { p.connect_local( "open", false, - clone!(@weak self as this => @default-panic, move |s| { + clone!(#[weak(rename_to = this)] self, #[upgrade_or_panic] move |s| { let s: String = s[1].get().unwrap(); let url = Url::parse(&s); if let Ok(url) = url { @@ -705,7 +705,7 @@ impl Tab { p.set_icon_name(Some("dialog-error-symbolic")); let override_btn = gtk::Button::with_label("Trust New Certificate"); - override_btn.connect_clicked(clone!(@weak self as this => move |_| { + override_btn.connect_clicked(clone!(#[weak(rename_to = this)] self, move |_| { let url = Url::parse(&this.url()).unwrap(); this.session().validator().remove_known(url.host_str().unwrap()); @@ -733,7 +733,7 @@ impl Tab { p.set_icon_name(Some("dialog-error-symbolic")); let override_btn = gtk::Button::with_label("Continue"); - override_btn.connect_clicked(clone!(@weak self as this => move |_| { + override_btn.connect_clicked(clone!(#[weak(rename_to = this)] self, move |_| { let url = Url::parse(&this.url()).unwrap(); this.session().validator().override_trust(url.host_str().unwrap()); diff --git a/src/widgets/window.rs b/src/widgets/window.rs index ff7af4e..992fba2 100644 --- a/src/widgets/window.rs +++ b/src/widgets/window.rs @@ -122,7 +122,7 @@ pub mod imp { fn set_zoom(&self, v: f64) { let Zoom { value, provider } = &mut *self.zoom.borrow_mut(); *value = v.clamp(1.0 / ZOOM_MAX_FACTOR, ZOOM_MAX_FACTOR); - provider.load_from_data(&format!( + provider.load_from_string(&format!( "textview {{ font-size: {}rem; }}", @@ -232,26 +232,26 @@ impl Window { let act_open_page = gio::SimpleAction::new("open-omni", Some(glib::VariantTy::STRING)); act_open_page.connect_activate( - clone!(@weak self as this => move |_,v| this.open_omni(v.unwrap().get::().unwrap().as_str())), + clone!(#[weak(rename_to = this)] self, move |_,v| this.open_omni(v.unwrap().get::().unwrap().as_str())), ); self.add_action(&act_open_page); let act_open_url = gio::SimpleAction::new("open-url", Some(glib::VariantTy::STRING)); act_open_url.connect_activate( - clone!(@weak self as this => move |_,v| this.open_url_str(v.unwrap().get::().unwrap().as_str())), + clone!(#[weak(rename_to = this)] self, move |_,v| this.open_url_str(v.unwrap().get::().unwrap().as_str())), ); self.add_action(&act_open_url); let act_open_in_new_tab = gio::SimpleAction::new("open-in-new-tab", Some(glib::VariantTy::STRING)); act_open_in_new_tab.connect_activate( - clone!(@weak self as this => move |_,v| this.open_in_new_tab(v.unwrap().get::().unwrap().as_str())), + clone!(#[weak(rename_to = this)] self, move |_,v| this.open_in_new_tab(v.unwrap().get::().unwrap().as_str())), ); self.add_action(&act_open_in_new_tab); let act_set_clipboard = gio::SimpleAction::new("set-clipboard", Some(glib::VariantTy::STRING)); - act_set_clipboard.connect_activate(clone!(@weak self as this => move |_,v| { + act_set_clipboard.connect_activate(clone!(#[weak(rename_to = this)] self, move |_,v| { this.set_clipboard(v.unwrap().get::().unwrap().as_str()); this.imp().toast_overlay.add_toast(adw::Toast::new("Copied to clipboard")); })); @@ -267,7 +267,8 @@ impl Window { imp.scroll_ctrl .set_flags(gtk::EventControllerScrollFlags::VERTICAL); imp.scroll_ctrl.connect_scroll( - clone!(@weak self as this => @default-panic, move |ctrl, _, y| { + clone!(#[weak(rename_to = this)] self, #[upgrade_or_panic] + move |ctrl, _, y| { let up = y < 0.0; if let Some(gdk::ModifierType::CONTROL_MASK) = ctrl.current_event().map(|e| e.modifier_state()) { if up { @@ -283,7 +284,7 @@ impl Window { ); imp.mouse_prev_next_ctrl.set_button(0); imp.mouse_prev_next_ctrl.connect_pressed( - clone!(@weak self as this => @default-panic, move |ctrl, _, _, _| { + clone!(#[weak(rename_to = this)] self, move |ctrl, _, _, _| { match ctrl.current_button() { 8 => { this.previous(); @@ -299,7 +300,8 @@ impl Window { self.connect_local( "notify::url", false, - clone!(@weak self as this => @default-panic, move |_| { + clone!(#[weak(rename_to = this)] self, #[upgrade_or_default] + move |_| { this.update_domain_color(); let bar = &this.imp().url_bar; @@ -313,12 +315,14 @@ impl Window { ); imp.tab_view.connect_selected_page_notify( - clone!(@weak self as this => @default-panic, move |tab_view| { + clone!(#[weak(rename_to = this)] self, move |tab_view| { this.page_switched(tab_view); }), ); imp.tab_view.connect_close_page( - clone!(@weak self as this => @default-panic, move |tab_view, page| { + clone!(#[weak(rename_to = this)] self, + #[upgrade_or_panic] + move |tab_view, page| { tab_view.close_page_finish(page, !page.is_pinned()); if tab_view.n_pages() == 0 { @@ -329,19 +333,21 @@ impl Window { }), ); imp.tab_overview.connect_create_tab( - clone!(@weak self as this => @default-panic, move |_| { + clone!(#[weak(rename_to = this)] self, + #[upgrade_or_panic] + move |_| { this.new_tab(); this.imp().tab_view.selected_page().unwrap() }), ); imp.url_bar - .connect_activate(clone!(@weak self as this => @default-panic, move |_sq| { + .connect_activate(clone!(#[weak(rename_to = this)] self, move |_sq| { this.open_omni(this.imp().url_bar.text().as_str()); })); adw::StyleManager::default().connect_dark_notify( - clone!(@weak self as this => @default-panic, move |_| { + clone!(#[weak(rename_to = this)] self, move |_| { this.update_domain_color() }), ); @@ -358,7 +364,8 @@ impl Window { ctrl.set_propagation_phase(gtk::PropagationPhase::Capture); ctrl.connect_key_pressed( - clone!(@weak self as this => @default-panic, move |_, key, _, modif| { + clone!(#[weak(rename_to = this)] self, #[upgrade_or_panic] + move |_, key, _, modif| { let action = match (modif.contains(gdk::ModifierType::CONTROL_MASK), key) { (true, gdk::Key::ISO_Left_Tab) => Some("win.focus-previous-tab"), (true, gdk::Key::Tab) => Some("win.focus-next-tab"), @@ -380,7 +387,8 @@ impl Window { .build(); drop_target.connect_drop( - clone!(@weak self as this => @default-return false, move |_, value, _, _| { + clone!(#[weak(rename_to = this)] self, #[upgrade_or_panic] + move |_, value, _, _| { if let Ok(files) = value.get::() { for f in files.files() { this.open_in_new_tab(&format!("file://{}", f.path().unwrap().to_str().unwrap())); @@ -626,7 +634,7 @@ impl Window { let imp = self.imp(); let url = imp.url_bar.text().to_string(); - glibctx().spawn_local(clone!(@weak imp => async move { + glibctx().spawn_local(clone!(#[weak] imp, async move { match Self::append_bookmark(&url).await { Ok(_) => { info!("{} saved to bookmarks", url);