jhass / crystal-gobject

gobject-introspection for Crystal
BSD 3-Clause "New" or "Revised" License
127 stars 13 forks source link

Question about Interfaces and includes #28

Closed thiagojedi closed 4 years ago

thiagojedi commented 4 years ago

Hi.

I was reading the Gtk documentation, and found that some classes, i.e. Gtk::ApplicationWindow, implement some interfaces, i.e. Gio::ActionMap.

The thing is it doesn't look like it's been mapped to crystal by the generator.

I found putting this at my project make it work:

module Gtk
  class Application
    include Gio::ActionMap
  end

  class ApplicationWindow
    include Gio::ActionMap
  end
end

Then I found the following code:

https://github.com/jhass/crystal-gobject/blob/3022dec48bf958779c2685b3ef7d92364166f054/src/g_i_repository/info/object_info.cr#L69-L72

And tried to change it to include #{interface.namespace}::#{interface.name}, but it seems to crash in some references.

Is there any plans to make it work at "generator-time" or do you think it's better to patch it by the consumer?

jhass commented 4 years ago

I definitely would love to have the generator do it, just didn't have the time yet myself to make it work. Any contributions welcome!

Edge cases the generator cannot solve are also welcome to be included as manual patches into this shard (or maybe a specific child shard per GObject library in the mid-term).

jhass commented 4 years ago

Okay, that was simpler than thought. Well at least it parses now.