module GObject::Object::Overrides
Public Instance Methods
get_property(property_name)
click to toggle source
Calls superclass method
# File lib/ffi-gobject/object.rb, line 126 def get_property(property_name) gvalue = gvalue_for_property property_name super property_name, gvalue value = gvalue.get_value type_info = get_property_type property_name value = property_value_post_conversion(value, type_info) if type_info value end
set_property(property_name, value)
click to toggle source
Calls superclass method
# File lib/ffi-gobject/object.rb, line 137 def set_property(property_name, value) type_info = get_property_type property_name value = property_value_pre_conversion(value, type_info) if type_info gvalue = gvalue_for_property(property_name) gvalue.set_value value super property_name, gvalue end
Private Instance Methods
get_property_type(property_name)
click to toggle source
# File lib/ffi-gobject/object.rb, line 149 def get_property_type(property_name) self.class.find_property(property_name)&.property_type end
property_value_post_conversion(val, type_info)
click to toggle source
TODO: Move to ITypeInfo and unify with ArgHelper.cast_from_pointer
# File lib/ffi-gobject/object.rb, line 154 def property_value_post_conversion(val, type_info) case type_info.flattened_tag when :ghash GLib::HashTable.from type_info.element_type, val when :glist GLib::List.from type_info.element_type, val when :callback GirFFI::Builder.build_class(type_info.interface).wrap val else val end end
property_value_pre_conversion(val, type_info)
click to toggle source
TODO: Move to ITypeInfo and unify with ArgHelper.cast_from_pointer
# File lib/ffi-gobject/object.rb, line 168 def property_value_pre_conversion(val, type_info) case type_info.flattened_tag when :ghash GLib::HashTable.from type_info.element_type, val when :glist GLib::List.from type_info.element_type, val when :strv GLib::Strv.from val when :byte_array GLib::ByteArray.from val when :callback GirFFI::Builder.build_class(type_info.interface).from val else val end end