From 17dcfe9ebfae409f836d3ff423bc7b2ce198a024 Mon Sep 17 00:00:00 2001 From: Marcus Behrendt Date: Thu, 11 May 2023 20:28:22 +0200 Subject: [PATCH 1/6] fix(widget): Provide fallbacks for lookup colors The user could set a custom theme lacking the requested colors. Although this will look broken and completely out of place, we still don't want the application to crash because it couldn't find a color. Fixes #641 --- src/view/component/circular_progress_bar.rs | 63 ++++++++++++++++----- src/view/component/spinner.rs | 10 +++- src/view/container/tty.rs | 20 ++++++- 3 files changed, 77 insertions(+), 16 deletions(-) diff --git a/src/view/component/circular_progress_bar.rs b/src/view/component/circular_progress_bar.rs index f0f2bebd6..1074bd739 100644 --- a/src/view/component/circular_progress_bar.rs +++ b/src/view/component/circular_progress_bar.rs @@ -129,18 +129,45 @@ mod imp { percentage = 0.0; } - let fg_color = style_context - .lookup_color(if percentage < 0.8 { - "accent_color" - } else if percentage < 0.95 { - "warning_color" - } else { - "error_color" - }) - .unwrap(); + let fg_color = if percentage < 0.8 { + style_context + .lookup_color("accent_color") + .unwrap_or_else(|| { + if style_manager.is_dark() { + gdk::RGBA::new(0.471, 0.682, 0.929, 1.0) + } else { + gdk::RGBA::new(0.11, 0.443, 0.847, 1.0) + } + }) + } else if percentage < 0.95 { + style_context + .lookup_color("warning_color") + .unwrap_or_else(|| { + if style_manager.is_dark() { + gdk::RGBA::new(0.973, 0.894, 0.361, 1.0) + } else { + gdk::RGBA::new(0.612, 0.431, 0.012, 1.0) + } + }) + } else { + style_context + .lookup_color("error_color") + .unwrap_or_else(|| { + if style_manager.is_dark() { + gdk::RGBA::new(1.0, 0.482, 0.388, 1.0) + } else { + gdk::RGBA::new(0.753, 0.11, 0.157, 1.0) + } + }) + }; let (bg_color, maybe_compiled_masked_shader) = if style_manager.is_high_contrast() { - (style_context.lookup_color("dark_1").unwrap(), None) + ( + style_context + .lookup_color("dark_1") + .unwrap_or_else(|| gdk::RGBA::new(0.467, 0.463, 0.482, 1.0)), + None, + ) } else { let maybe_compiled_masked_shader = widget.ensure_mask_shader(); @@ -161,11 +188,21 @@ mod imp { }, ) }) - .unwrap() + .unwrap_or_else(|| { + if style_manager.is_dark() { + gdk::RGBA::new(1.0, 1.0, 1.0, 0.15) + } else { + gdk::RGBA::new(0.0, 0.0, 0.0, 0.12) + } + }) } else if style_manager.is_dark() { - style_context.lookup_color("dark_2").unwrap() + style_context + .lookup_color("dark_2") + .unwrap_or_else(|| gdk::RGBA::new(0.369, 0.361, 0.392, 1.0)) } else { - style_context.lookup_color("light_3").unwrap() + style_context + .lookup_color("light_3") + .unwrap_or_else(|| gdk::RGBA::new(0.871, 0.867, 0.855, 1.0)) }; (color, maybe_compiled_masked_shader) diff --git a/src/view/component/spinner.rs b/src/view/component/spinner.rs index c6bea0ab3..d4d332c35 100644 --- a/src/view/component/spinner.rs +++ b/src/view/component/spinner.rs @@ -223,7 +223,15 @@ mod imp { } else { snapshot.push_rounded_clip(&gsk::RoundedRect::from_rect(rect, size / 2.0)); snapshot.append_color( - &style_context.lookup_color("dialog_bg_color").unwrap(), + &style_context + .lookup_color("dialog_bg_color") + .unwrap_or_else(|| { + if adw::StyleManager::default().is_dark() { + gdk::RGBA::new(0.22, 0.22, 0.22, 1.0) + } else { + gdk::RGBA::new(0.98, 0.98, 0.98, 1.0) + } + }), &rect, ); snapshot.pop(); diff --git a/src/view/container/tty.rs b/src/view/container/tty.rs index ba3b7e935..6b523461a 100644 --- a/src/view/container/tty.rs +++ b/src/view/container/tty.rs @@ -431,8 +431,24 @@ impl Tty { let style_context = self.style_context(); let terminal = &*self.imp().terminal; - terminal.set_color_background(&style_context.lookup_color("view_bg_color").unwrap()); - terminal.set_color_foreground(&style_context.lookup_color("view_fg_color").unwrap()); + terminal.set_color_background(&style_context.lookup_color("view_bg_color").unwrap_or_else( + || { + if adw::StyleManager::default().is_dark() { + gdk::RGBA::new(0.118, 0.118, 0.118, 1.0) + } else { + gdk::RGBA::new(1.0, 1.0, 1.0, 1.0) + } + }, + )); + terminal.set_color_foreground(&style_context.lookup_color("view_fg_color").unwrap_or_else( + || { + if adw::StyleManager::default().is_dark() { + gdk::RGBA::new(1.0, 1.0, 1.0, 1.0) + } else { + gdk::RGBA::new(0.0, 0.0, 0.0, 0.8) + } + }, + )); } pub(crate) fn zoom_out(&self) { From 0afdbe28d2cd70df348e639419dc3f4ed7cd4c29 Mon Sep 17 00:00:00 2001 From: Marcus Behrendt Date: Sat, 13 May 2023 20:02:00 +0200 Subject: [PATCH 2/6] fix(source-view-search-widget): Delegate `GtkEditable` props This will prevent a crash when setting properties that belong to `GtkEditable`. --- podman-api-rs | 1 + src/view/component/source_view_search_widget.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) create mode 160000 podman-api-rs diff --git a/podman-api-rs b/podman-api-rs new file mode 160000 index 000000000..8e0190fc5 --- /dev/null +++ b/podman-api-rs @@ -0,0 +1 @@ +Subproject commit 8e0190fc5af56f91d2614780e960279b523ada0c diff --git a/src/view/component/source_view_search_widget.rs b/src/view/component/source_view_search_widget.rs index a5c394532..21e4164e8 100644 --- a/src/view/component/source_view_search_widget.rs +++ b/src/view/component/source_view_search_widget.rs @@ -81,7 +81,7 @@ mod imp { fn set_property(&self, _id: usize, value: &glib::Value, pspec: &glib::ParamSpec) { match pspec.name() { "source-view" => self.obj().set_source_view(value.get().unwrap()), - _ => unimplemented!(), + other => self.search_entry.set_property(other, value), } } From df604ddf22590f67b8f1bb9d78ec909124c76942 Mon Sep 17 00:00:00 2001 From: Marcus Behrendt Date: Sat, 13 May 2023 22:29:44 +0200 Subject: [PATCH 3/6] fix(health-check-log-row): Notify correct property --- src/view/health_check_log/row.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/view/health_check_log/row.rs b/src/view/health_check_log/row.rs index 4f912a91c..4df03660c 100644 --- a/src/view/health_check_log/row.rs +++ b/src/view/health_check_log/row.rs @@ -107,7 +107,7 @@ mod imp { } self.log.set(value); - obj.notify("env-var"); + obj.notify("log"); } } } From 867f011e0f05d12116282445f35d02c866b0b7aa Mon Sep 17 00:00:00 2001 From: Marcus Behrendt Date: Sat, 13 May 2023 22:42:55 +0200 Subject: [PATCH 4/6] chore(cargo): Update dependencies --- Cargo.lock | 140 +++++++++-------------------------------------------- 1 file changed, 23 insertions(+), 117 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bd7e65b10..ad71a6900 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -205,16 +205,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "codespan-reporting" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" -dependencies = [ - "termcolor", - "unicode-width", -] - [[package]] name = "containers-api" version = "0.8.0" @@ -230,7 +220,7 @@ dependencies = [ "log", "mime", "paste", - "pin-project 1.0.12", + "pin-project 1.1.0", "serde", "serde_json", "tar", @@ -273,50 +263,6 @@ dependencies = [ "typenum", ] -[[package]] -name = "cxx" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f61f1b6389c3fe1c316bf8a4dccc90a38208354b330925bce1f74a6c4756eb93" -dependencies = [ - "cc", - "cxxbridge-flags", - "cxxbridge-macro", - "link-cplusplus", -] - -[[package]] -name = "cxx-build" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12cee708e8962df2aeb38f594aae5d827c022b6460ac71a7a3e2c3c2aae5a07b" -dependencies = [ - "cc", - "codespan-reporting", - "once_cell", - "proc-macro2", - "quote", - "scratch", - "syn 2.0.15", -] - -[[package]] -name = "cxxbridge-flags" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7944172ae7e4068c533afbb984114a56c46e9ccddda550499caa222902c7f7bb" - -[[package]] -name = "cxxbridge-macro" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2345488264226bf682893e25de0769f3360aac9957980ec49361b083ddaa5bc5" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.15", -] - [[package]] name = "derivative" version = "2.2.0" @@ -1015,7 +961,7 @@ dependencies = [ "futures-util", "hex", "hyper", - "pin-project 1.0.12", + "pin-project 1.1.0", "tokio", ] @@ -1035,12 +981,11 @@ dependencies = [ [[package]] name = "iana-time-zone-haiku" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" dependencies = [ - "cxx", - "cxx-build", + "cc", ] [[package]] @@ -1177,15 +1122,6 @@ dependencies = [ "system-deps", ] -[[package]] -name = "link-cplusplus" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" -dependencies = [ - "cc", -] - [[package]] name = "linux-raw-sys" version = "0.3.7" @@ -1434,11 +1370,11 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.0.12" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" +checksum = "c95a7476719eab1e366eaf73d0260af3021184f18177925b07f54b30089ceead" dependencies = [ - "pin-project-internal 1.0.12", + "pin-project-internal 1.1.0", ] [[package]] @@ -1454,13 +1390,13 @@ dependencies = [ [[package]] name = "pin-project-internal" -version = "1.0.12" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" +checksum = "39407670928234ebc5e6e580247dd567ad73a3578460c5990f9503df207e8f07" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.15", ] [[package]] @@ -1695,12 +1631,6 @@ version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" -[[package]] -name = "scratch" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1" - [[package]] name = "semver" version = "1.0.17" @@ -1709,18 +1639,18 @@ checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" [[package]] name = "serde" -version = "1.0.162" +version = "1.0.163" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71b2f6e1ab5c2b98c05f0f35b236b22e8df7ead6ffbf51d7808da7f8817e7ab6" +checksum = "2113ab51b87a539ae008b5c6c02dc020ffa39afd2d83cffcb3f4eb2722cebec2" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.162" +version = "1.0.163" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2a0814352fd64b58489904a44ea8d90cb1a91dcb6b4f5ebabc32c8318e93cb6" +checksum = "8c805777e3930c8883389c602315a24224bcc738b63905ef87cd1420353ea93e" dependencies = [ "proc-macro2", "quote", @@ -1920,15 +1850,6 @@ dependencies = [ "windows-sys 0.45.0", ] -[[package]] -name = "termcolor" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" -dependencies = [ - "winapi-util", -] - [[package]] name = "thiserror" version = "1.0.40" @@ -2112,9 +2033,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.30" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" +checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" dependencies = [ "once_cell", ] @@ -2162,12 +2083,6 @@ dependencies = [ "tinyvec", ] -[[package]] -name = "unicode-width" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" - [[package]] name = "url" version = "2.3.1" @@ -2342,15 +2257,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" -[[package]] -name = "winapi-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi", -] - [[package]] name = "winapi-x86_64-pc-windows-gnu" version = "0.4.0" @@ -2577,9 +2483,9 @@ dependencies = [ [[package]] name = "zbus_names" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f34f314916bd89bdb9934154627fab152f4f28acdda03e7c4c68181b214fe7e3" +checksum = "82441e6033be0a741157a72951a3e4957d519698f3a824439cc131c5ba77ac2a" dependencies = [ "serde", "static_assertions", @@ -2588,9 +2494,9 @@ dependencies = [ [[package]] name = "zvariant" -version = "3.12.0" +version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46fe4914a985446d6fd287019b5fceccce38303d71407d9e6e711d44954a05d8" +checksum = "5cb36cd95352132911c9c99fdcc1635de5c2c139bd34cbcf6dfb8350ee8ff6a7" dependencies = [ "byteorder", "enumflags2", @@ -2603,9 +2509,9 @@ dependencies = [ [[package]] name = "zvariant_derive" -version = "3.12.0" +version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34c20260af4b28b3275d6676c7e2a6be0d4332e8e0aba4616d34007fd84e462a" +checksum = "9b34951e1ac64f3a1443fe7181256b9ed6a811a1631917566c3d5ca718d8cf33" dependencies = [ "proc-macro-crate", "proc-macro2", From e72bab9e42aed30278e6a40eb4d16a790564420b Mon Sep 17 00:00:00 2001 From: Marcus Behrendt Date: Sat, 13 May 2023 22:42:41 +0200 Subject: [PATCH 5/6] chore(app-data): Update changelog --- data/com.github.marhkb.Pods.metainfo.xml.in.in | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/data/com.github.marhkb.Pods.metainfo.xml.in.in b/data/com.github.marhkb.Pods.metainfo.xml.in.in index 979e98d32..ae256c7d0 100644 --- a/data/com.github.marhkb.Pods.metainfo.xml.in.in +++ b/data/com.github.marhkb.Pods.metainfo.xml.in.in @@ -42,6 +42,17 @@ https://github.com/marhkb/pods/issues + + +

Pods 1.1.3 contains the following fixes and chores:

+
    +
  • The app no longer crashes when overriding the GTK theme.
  • +
  • Fixed a bug that caused the application to crash when changing certain properties of the search field in the Inspector.
  • +
  • It was notified about an incorrect property in the Health Check log.
  • +
  • Dependencies have been updated.
  • +
+
+

Pods 1.1.2 contains the following fixes and performance improvements and chores:

From 9ae1688bb46925fc1c8e86810d7d15145591fd5e Mon Sep 17 00:00:00 2001 From: Marcus Behrendt Date: Sat, 13 May 2023 22:45:16 +0200 Subject: [PATCH 6/6] chore: Release v1.1.3 --- Cargo.lock | 2 +- Cargo.toml | 2 +- meson.build | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ad71a6900..36d3cbea6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1454,7 +1454,7 @@ dependencies = [ [[package]] name = "pods" -version = "1.1.2" +version = "1.1.3" dependencies = [ "anyhow", "ashpd", diff --git a/Cargo.toml b/Cargo.toml index 9c4ed552d..dd5946c89 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "pods" -version = "1.1.2" +version = "1.1.3" authors = ["Marcus Behrendt "] edition = "2021" diff --git a/meson.build b/meson.build index f10b600ad..670b6b9ac 100644 --- a/meson.build +++ b/meson.build @@ -1,7 +1,7 @@ project( 'pods', 'rust', - version: '1.1.2', + version: '1.1.3', meson_version: '>= 0.59', license: 'GPL3+', )