From b297fe91799fedc33d31fa86820f7f1fa0947067 Mon Sep 17 00:00:00 2001 From: Nicolai Syvertsen Date: Tue, 26 Dec 2023 15:33:00 +0100 Subject: [PATCH] Load from resource instead --- data/resources/resources.gresource.xml | 1 + data/resources/ui/levelbar.css | 13 +++++++++++++ src/main.rs | 18 +----------------- 3 files changed, 15 insertions(+), 17 deletions(-) create mode 100644 data/resources/ui/levelbar.css diff --git a/data/resources/resources.gresource.xml b/data/resources/resources.gresource.xml index d2e1f99..b3e6270 100644 --- a/data/resources/resources.gresource.xml +++ b/data/resources/resources.gresource.xml @@ -12,6 +12,7 @@ ui/profile-dropdown.ui ui/devicebox.ui ui/profilerow.ui + ui/levelbar.css ../icons/com.saivert.pwvucontrol.svg diff --git a/data/resources/ui/levelbar.css b/data/resources/ui/levelbar.css new file mode 100644 index 0000000..6700919 --- /dev/null +++ b/data/resources/ui/levelbar.css @@ -0,0 +1,13 @@ +levelbar block.filled { + filter: blur(2px); +} +levelbar trough { + background-color: rgba(0,0,0,0); + border: none; +} +levelbar block.empty { + background-color: rgba(0,0,0,0); +} +levelbar block { + border: none; +} diff --git a/src/main.rs b/src/main.rs index 8258918..7d12182 100644 --- a/src/main.rs +++ b/src/main.rs @@ -80,23 +80,7 @@ fn main() -> gtk::glib::ExitCode { gio::resources_register(&resources); let css = gtk::CssProvider::new(); - css.load_from_data( - r#" - levelbar block.filled { - filter: blur(2px); - } - levelbar trough { - background-color: rgba(0,0,0,0); - border: none; - } - levelbar block.empty { - background-color: rgba(0,0,0,0); - } - levelbar block { - border: none; - } - "#, - ); + css.load_from_resource("/com/saivert/pwvucontrol/ui/levelbar.css"); gtk::style_context_add_provider_for_display( >k::gdk::Display::default().unwrap(),