gir_ffi-gtk icon indicating copy to clipboard operation
gir_ffi-gtk copied to clipboard

Missing constants? How to proceed in this case? Example: Gtk::StyleProvider::PRIORITY_APPLICATION

Open rubyFeedback opened this issue 1 year ago • 2 comments

Hi,

I am experimenting with gir_ffi-gtk right now.

One thing I want to get to work is CSS support. I have a lot of CSS that allows me to tweak a lot, starting this from the www era before I used ruby, and then also for ruby-gtk3 lateron.

I had this code in ruby-gtk3:

screen = Gdk::Screen.default

in gir_ffi-gtk this also works but I have to use this:

screen = Gdk::Screen.get_default

Not a big change/difference so this is fine.

I solved this issue, but now I have another problem.

In ruby-gtk3 I would use this to initialize a new style context:

::Gtk::StyleContext.add_provider_for_screen(
  screen,
  provider,
  ::Gtk::StyleProvider::PRIORITY_APPLICATION
)

But the last part, aka:

Gtk::StyleProvider::PRIORITY_APPLICATION

is not known by gir_ffi-gtk.

It is a constant.

So my next idea was to use pp:

pp ::Gtk::StyleProvider.constants.sort

But only three constants are shown via Array here:

[:GIR_FFI_BUILDER, :GIR_INFO, :G_TYPE]

No PRIORITY_APPLICATION. Perhaps the name is different or I have to use constants differently - I really don't know right now. Or perhaps there is a bug with gir_ffi-gtk so I report this here just in case. Others may also find this via a google search.

rubyFeedback avatar Sep 16 '22 19:09 rubyFeedback