File tree Expand file tree Collapse file tree 3 files changed +34
-5
lines changed
Expand file tree Collapse file tree 3 files changed +34
-5
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,12 @@ All notable changes to `ewwii` are documented here.
55This changelog follows the [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) format,
66and this project adheres to [ Semantic Versioning] ( https://semver.org/ ) .
77
8+ ## [ UNRELEASED]
9+
10+ ### Fixed
11+
12+ - A few issue related with ` property-get ` subcommand.
13+
814## [ 0.4.0] - 2026-02-14
915
1016### Added
Original file line number Diff line number Diff line change @@ -809,8 +809,12 @@ impl<B: DisplayBackend> App<B> {
809809 if let Some ( widget_registry) = maybe_registry. as_mut ( ) {
810810 let property_value = widget_registry
811811 . get_property_by_name ( & widget_name, & property)
812- . unwrap_or ( String :: new ( ) ) ;
813- return Ok ( property_value) ;
812+ . ok_or_else ( || anyhow:: anyhow!(
813+ "Property '{}' not found or wrong type" ,
814+ property
815+ ) ) ?;
816+
817+ return Ok ( property_value)
814818 } else {
815819 log:: error!( "Widget registry is empty" ) ;
816820 }
Original file line number Diff line number Diff line change @@ -242,10 +242,29 @@ impl WidgetRegistry {
242242 }
243243
244244 pub fn get_property_by_name ( & self , widget_name : & str , property : & str ) -> Option < String > {
245- let entry =
246- self . widgets . values ( ) . find ( |entry| entry. widget . widget_name ( ) == widget_name) ?;
245+ let entry = self . widgets
246+ . values ( )
247+ . find ( |entry| entry. widget . widget_name ( ) == widget_name) ?;
247248
248- Some ( entry. widget . property ( property) )
249+ let value: glib:: Value = entry. widget . property_value ( property) ;
250+
251+ if let Ok ( s) = value. get :: < String > ( ) {
252+ return Some ( s) ;
253+ }
254+
255+ if let Ok ( b) = value. get :: < bool > ( ) {
256+ return Some ( b. to_string ( ) ) ;
257+ }
258+
259+ if let Ok ( i) = value. get :: < i32 > ( ) {
260+ return Some ( i. to_string ( ) ) ;
261+ }
262+
263+ if let Ok ( f) = value. get :: < f64 > ( ) {
264+ return Some ( f. to_string ( ) ) ;
265+ }
266+
267+ None
249268 }
250269
251270 pub fn update_property_by_name (
You can’t perform that action at this time.
0 commit comments