Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
rubyFeedback opened this issue Sep 16, 2022 · 2 comments

Comments

@rubyFeedback
Copy link

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.

@mvz
Copy link
Owner

mvz commented Sep 16, 2022

Hi @rubyFeedback, due to how these constants are defined in Gtk's introspection data, this constant is called Gtk::STYLE_PROVIDER_PRIORITY_APPLICATION.

@mvz
Copy link
Owner

mvz commented Sep 18, 2022

Such constant names can be found in /usr/share/gir-1.0/Gtk-3.0.gir.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants