Sha256: f8c745664c627032f8640967e25cd39302cf02e5092d0e3399939f386f8f8952

Contents?: true

Size: 942 Bytes

Versions: 2

Compression:

Stored size: 942 Bytes

Contents

Gtk.load_class :Container
module Gtk
  # Overrides for GtkContainer
  class Container
    def add_with_properties(widget, properties)
      add widget
      properties.each do |property_name, value|
        child_set_property widget, property_name.to_s, value
      end
    end

    setup_instance_method :child_get_property

    def child_get_property_with_override(widget, property_name)
      param_spec = object_class.find_child_property property_name
      unless param_spec
        raise ArgumentError,
          "child property named '#{property_name}' not found in #{self.class}"
      end
      gtype = param_spec.value_type
      gvalue = GObject::Value.for_gtype gtype

      child_get_property_without_override widget, property_name, gvalue
      gvalue.get_value
    end

    alias_method :child_get_property_without_override, :child_get_property
    alias_method :child_get_property, :child_get_property_with_override
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gir_ffi-gtk-0.10.0 lib/gir_ffi-gtk/container.rb
gir_ffi-gtk-0.9.0 lib/gir_ffi-gtk/container.rb