#!/usr/bin/ruby -w
# Encoding: UTF-8
# frozen_string_literal: true
# =========================================================================== #
require 'gtk2'

alias e puts

e 'Enter "G", "t" on the entry box, a dropdown will appear.'

window = Gtk::Window.new
window.set_default_size(200, 200)
window.move(0, 0)
entry = Gtk::Entry.new
completion = Gtk::EntryCompletion.new
entry.completion = completion

model = Gtk::ListStore.new(String)
%w( GNOME GNAME total totally tota ).each { |v|
  iter = model.append
  iter[0] = v
}

completion.model = model
completion.text_column = 0

window.add(entry).show_all.signal_connect(:destroy) { Gtk.main_quit }
Gtk.main