diff --git a/Cargo.lock b/Cargo.lock index 4bf620f..cffe3e0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,12 +17,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" -[[package]] -name = "adler2" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" - [[package]] name = "ahash" version = "0.8.3" @@ -285,7 +279,7 @@ dependencies = [ "cc", "cfg-if", "libc", - "miniz_oxide 0.6.2", + "miniz_oxide", "object", "rustc-demangle", ] @@ -567,15 +561,6 @@ dependencies = [ "libc", ] -[[package]] -name = "crc32fast" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" -dependencies = [ - "cfg-if", -] - [[package]] name = "crossbeam-channel" version = "0.5.8" @@ -904,15 +889,6 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" -[[package]] -name = "fdeflate" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07c6f4c64c1d33a3111c4466f7365ebdcc37c5bd1ea0d62aae2e3d722aacbedb" -dependencies = [ - "simd-adler32", -] - [[package]] name = "field-offset" version = "0.3.5" @@ -935,16 +911,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "flate2" -version = "1.0.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1b589b4dc103969ad3cf85c950899926ec64300a1a46d76c03a6072957036f0" -dependencies = [ - "crc32fast", - "miniz_oxide 0.8.0", -] - [[package]] name = "fnv" version = "1.0.7" @@ -1733,7 +1699,6 @@ dependencies = [ "mpris", "nix 0.29.0", "notify", - "png", "regex", "reqwest", "schemars", @@ -1958,16 +1923,6 @@ dependencies = [ "adler", ] -[[package]] -name = "miniz_oxide" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" -dependencies = [ - "adler2", - "simd-adler32", -] - [[package]] name = "mio" version = "1.0.1" @@ -2402,19 +2357,6 @@ version = "0.3.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" -[[package]] -name = "png" -version = "0.17.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52f9d46a34a05a6a57566bc2bfae066ef07585a6e3fa30fbbdff5936380623f0" -dependencies = [ - "bitflags 1.3.2", - "crc32fast", - "fdeflate", - "flate2", - "miniz_oxide 0.8.0", -] - [[package]] name = "polling" version = "2.7.0" @@ -3046,12 +2988,6 @@ dependencies = [ "libc", ] -[[package]] -name = "simd-adler32" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" - [[package]] name = "slab" version = "0.4.8" diff --git a/Cargo.toml b/Cargo.toml index d86e8c5..b90979a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -68,7 +68,7 @@ notifications = ["zbus"] sys_info = ["sysinfo", "regex"] -tray = ["system-tray", "png"] +tray = ["system-tray"] upower = ["upower_dbus", "zbus", "futures-lite"] @@ -149,7 +149,6 @@ sysinfo = { version = "0.29.11", optional = true } # tray system-tray = { version = "0.4.0", features = ["dbusmenu-gtk3"], optional = true } -png = { version = "0.17.14", optional = true } # upower upower_dbus = { version = "0.3.2", optional = true } diff --git a/src/modules/tray/icon.rs b/src/modules/tray/icon.rs index 3b78a9c..a187702 100644 --- a/src/modules/tray/icon.rs +++ b/src/modules/tray/icon.rs @@ -7,7 +7,6 @@ use gtk::ffi::gtk_icon_theme_get_search_path; use gtk::gdk_pixbuf::{Colorspace, InterpType, Pixbuf}; use gtk::prelude::IconThemeExt; use gtk::{IconLookupFlags, IconTheme, Image}; -use png::ColorType; use std::collections::HashSet; use std::ffi::CStr; use std::os::raw::{c_char, c_int}; @@ -126,36 +125,3 @@ fn get_image_from_pixmap(item: &TrayMenu, size: u32) -> Result { ImageProvider::create_and_load_surface(&pixbuf, &image)?; Ok(image) } - -pub struct PngData<'a>(pub &'a [u8]); -impl TryFrom> for Image { - type Error = Report; - - fn try_from(value: PngData) -> std::result::Result { - let data = value.0; - - let decoder = png::Decoder::new(data); - let mut reader = decoder.read_info()?; - let mut buf = vec![0; reader.output_buffer_size()]; - - let info = reader.next_frame(&mut buf)?; - let bytes = glib::Bytes::from(&buf[..info.buffer_size()]); - - let has_alpha = matches!(info.color_type, ColorType::Rgba | ColorType::GrayscaleAlpha); - let row_stride_multiplier = if has_alpha { 4 } else { 3 }; - - let pixbuf = Pixbuf::from_bytes( - &bytes, - Colorspace::Rgb, - has_alpha, - info.bit_depth as i32, - info.width as i32, - info.height as i32, - (info.width * row_stride_multiplier) as i32, - ); - - let image = Image::new(); - ImageProvider::create_and_load_surface(&pixbuf, &image)?; - Ok(image) - } -}