From 36c58e211df1d6ec7e9464e58b7fb4440ad47981 Mon Sep 17 00:00:00 2001 From: Byson94 Date: Mon, 22 Dec 2025 18:18:26 +0530 Subject: [PATCH] feat: update props of icon widget --- CHANGELOG.md | 5 +++++ Cargo.toml | 2 +- crates/ewwii/src/widgets/widget_definitions.rs | 12 ++++++------ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b19852b..f200997 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/). - `transition_duration` property to stack widget. - `widget_control` utility function for dynamic widget handling. - `text` and `show_text` property to progressbar widget. +- Improved image widget rendering. + +### Changed + +- `image_width` and `image_height` property of icon to `icon_width` and `icon_height`. ### Fixed diff --git a/Cargo.toml b/Cargo.toml index e40d3a7..267e3ec 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,7 +26,7 @@ derive_more = { version = "1", features = [ extend = "1.2" futures = "0.3.30" grass = "0.13.4" -gtk4 = "0.10.1" +gtk4 = { version = "0.10.1", features = ["v4_8"] } itertools = "0.13.0" libc = "0.2" log = "0.4" diff --git a/crates/ewwii/src/widgets/widget_definitions.rs b/crates/ewwii/src/widgets/widget_definitions.rs index d442e54..3869d2c 100644 --- a/crates/ewwii/src/widgets/widget_definitions.rs +++ b/crates/ewwii/src/widgets/widget_definitions.rs @@ -1591,8 +1591,8 @@ pub(super) fn build_icon(props: &Map, widget_registry: &mut WidgetRegistry) -> R let apply_props = |props: &Map, widget: >k4::Image| -> Result<()> { let path = get_string_prop(&props, "path", None)?; - let image_width = get_i32_prop(&props, "image_width", Some(-1))?; - let image_height = get_i32_prop(&props, "image_height", Some(-1))?; + let icon_width = get_i32_prop(&props, "icon_width", Some(-1))?; + let icon_height = get_i32_prop(&props, "icon_height", Some(-1))?; let preserve_aspect_ratio = get_bool_prop(&props, "preserve_aspect_ratio", Some(true))?; let fill_svg = get_string_prop(&props, "fill_svg", Some(""))?; @@ -1636,8 +1636,8 @@ pub(super) fn build_icon(props: &Map, widget_registry: &mut WidgetRegistry) -> R )); pixbuf = gtk4::gdk_pixbuf::Pixbuf::from_stream_at_scale( &stream, - image_width, - image_height, + icon_width, + icon_height, preserve_aspect_ratio, None::<>k4::gio::Cancellable>, )?; @@ -1645,8 +1645,8 @@ pub(super) fn build_icon(props: &Map, widget_registry: &mut WidgetRegistry) -> R } else { pixbuf = gtk4::gdk_pixbuf::Pixbuf::from_file_at_scale( std::path::PathBuf::from(path), - image_width, - image_height, + icon_width, + icon_height, preserve_aspect_ratio, )?; }