feat: update props of icon widget

This commit is contained in:
Byson94
2025-12-22 18:18:26 +05:30
parent 70de347bcf
commit 36c58e211d
3 changed files with 12 additions and 7 deletions

View File

@@ -15,6 +15,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
- `transition_duration` property to stack widget. - `transition_duration` property to stack widget.
- `widget_control` utility function for dynamic widget handling. - `widget_control` utility function for dynamic widget handling.
- `text` and `show_text` property to progressbar widget. - `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 ### Fixed

View File

@@ -26,7 +26,7 @@ derive_more = { version = "1", features = [
extend = "1.2" extend = "1.2"
futures = "0.3.30" futures = "0.3.30"
grass = "0.13.4" grass = "0.13.4"
gtk4 = "0.10.1" gtk4 = { version = "0.10.1", features = ["v4_8"] }
itertools = "0.13.0" itertools = "0.13.0"
libc = "0.2" libc = "0.2"
log = "0.4" log = "0.4"

View File

@@ -1591,8 +1591,8 @@ pub(super) fn build_icon(props: &Map, widget_registry: &mut WidgetRegistry) -> R
let apply_props = |props: &Map, widget: &gtk4::Image| -> Result<()> { let apply_props = |props: &Map, widget: &gtk4::Image| -> Result<()> {
let path = get_string_prop(&props, "path", None)?; let path = get_string_prop(&props, "path", None)?;
let image_width = get_i32_prop(&props, "image_width", Some(-1))?; let icon_width = get_i32_prop(&props, "icon_width", Some(-1))?;
let image_height = get_i32_prop(&props, "image_height", 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 preserve_aspect_ratio = get_bool_prop(&props, "preserve_aspect_ratio", Some(true))?;
let fill_svg = get_string_prop(&props, "fill_svg", Some(""))?; 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( pixbuf = gtk4::gdk_pixbuf::Pixbuf::from_stream_at_scale(
&stream, &stream,
image_width, icon_width,
image_height, icon_height,
preserve_aspect_ratio, preserve_aspect_ratio,
None::<&gtk4::gio::Cancellable>, None::<&gtk4::gio::Cancellable>,
)?; )?;
@@ -1645,8 +1645,8 @@ pub(super) fn build_icon(props: &Map, widget_registry: &mut WidgetRegistry) -> R
} else { } else {
pixbuf = gtk4::gdk_pixbuf::Pixbuf::from_file_at_scale( pixbuf = gtk4::gdk_pixbuf::Pixbuf::from_file_at_scale(
std::path::PathBuf::from(path), std::path::PathBuf::from(path),
image_width, icon_width,
image_height, icon_height,
preserve_aspect_ratio, preserve_aspect_ratio,
)?; )?;
} }