feat: update props of icon widget
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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,
|
||||
)?;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user