Sha256: 655cbf3bb16a00104d2a7db3178c75424f862a6aba93c62e44536b151ad363af

Contents?: true

Size: 1011 Bytes

Versions: 8

Compression:

Stored size: 1011 Bytes

Contents

# frozen_string_literal: true

Gtk.load_class :Builder
module Gtk
  # Overrides for GtkBuilder
  class Builder
    setup_instance_method! :add_from_string

    def add_from_string_with_auto_length(buffer)
      add_from_string_without_auto_length buffer, buffer.length
    end

    alias add_from_string_without_auto_length add_from_string
    alias add_from_string add_from_string_with_auto_length

    setup_instance_method! :connect_signals_full
    remove_method :connect_signals

    AFTER_FLAG = GObject::ConnectFlags[:after]

    def connect_signals
      # rubocop:disable Metrics/ParameterLists
      connect_signals_full do |_, object, signal_name, handler_name, _, flags, _|
        handler = yield handler_name
        return unless handler

        if flags & AFTER_FLAG == AFTER_FLAG
          object.signal_connect_after signal_name, &handler
        else
          object.signal_connect signal_name, &handler
        end
      end
      # rubocop:enable Metrics/ParameterLists
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
gir_ffi-gtk-0.17.0 lib/gir_ffi-gtk/builder.rb
gir_ffi-gtk-0.16.0 lib/gir_ffi-gtk/builder.rb
gir_ffi-gtk-0.15.1 lib/gir_ffi-gtk/builder.rb
gir_ffi-gtk-0.15.0 lib/gir_ffi-gtk/builder.rb
gir_ffi-gtk-0.14.1 lib/gir_ffi-gtk/builder.rb
gir_ffi-gtk-0.14.0 lib/gir_ffi-gtk/builder.rb
gir_ffi-gtk-0.13.1 lib/gir_ffi-gtk/builder.rb
gir_ffi-gtk-0.13.0 lib/gir_ffi-gtk/builder.rb