Sha256: f7c5f3605d30fcfb8f77640e488a0ddf868b7c0e9a78e5e8264a40ba419982fa

Contents?: true

Size: 959 Bytes

Versions: 6

Compression:

Stored size: 959 Bytes

Contents

# frozen_string_literal: true

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 child_get_property_without_override child_get_property
    alias child_get_property child_get_property_with_override
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gir_ffi-gtk-0.15.1 lib/gir_ffi-gtk/container.rb
gir_ffi-gtk-0.15.0 lib/gir_ffi-gtk/container.rb
gir_ffi-gtk-0.14.1 lib/gir_ffi-gtk/container.rb
gir_ffi-gtk-0.14.0 lib/gir_ffi-gtk/container.rb
gir_ffi-gtk-0.13.1 lib/gir_ffi-gtk/container.rb
gir_ffi-gtk-0.13.0 lib/gir_ffi-gtk/container.rb